diff --git a/PLUGINS.md b/PLUGINS.md index 93e10967..f1c5ef8f 100644 --- a/PLUGINS.md +++ b/PLUGINS.md @@ -116,7 +116,7 @@ This gets called when EDMC sees a new entry in the game's journal. `state` is a A special "StartUp" entry is sent if EDMC is started while the game is already running. In this case you won't receive initial events such as "LoadGame", "Rank", "Location", etc. However the `state` dictionary will reflect the cumulative effect of these missed events. -Similarly, a special "ShutDown" entry is sent when the game is quitted while EDMC is running. This event is not sent when EDMC is running on a different machine or when quitting to the main menu, so you should not *rely* on receiving this event. +Similarly, a special "ShutDown" entry is sent when the game is quitted while EDMC is running. This event is not sent when EDMC is running on a different machine so you should not *rely* on receiving this event. ```python def journal_entry(cmdr, is_beta, system, station, entry, state): diff --git a/monitor.py b/monitor.py index 26f80019..e235989a 100644 --- a/monitor.py +++ b/monitor.py @@ -506,6 +506,8 @@ class EDLogs(FileSystemEventHandler): if not self.live and entry['event'] not in [None, 'Fileheader']: self.live = True self.event_queue.append('{ "timestamp":"%s", "event":"StartUp" }' % strftime('%Y-%m-%dT%H:%M:%SZ', gmtime())) + elif self.live and entry['event'] == 'Music' and entry.get('MusicTrack') == 'MainMenu': + self.event_queue.append('{ "timestamp":"%s", "event":"ShutDown" }' % strftime('%Y-%m-%dT%H:%M:%SZ', gmtime())) return entry def game_running(self):