From 890c2de63935e3663a3d28b0dff669d41757481c Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Mon, 27 Feb 2017 20:05:45 +0000 Subject: [PATCH] Suppress auto update if carrying Rares Mitigates #92 --- EDMarketConnector.py | 6 ++++++ monitor.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index e87ab23f..c8497523 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -394,6 +394,12 @@ class AppWindow: if not monitor.cmdr or not monitor.mode or monitor.is_beta: return # In CQC or Beta - do nothing + if auto_update and monitor.carrying_rares(): + # https://github.com/Marginal/EDMarketConnector/issues/92 + self.status['text'] = _("Didn't update: Carrying Rares") # Status text displayed when auto-update is suppressed - https://github.com/Marginal/EDMarketConnector/issues/92 + hotkeymgr.play_bad() + return + if not retrying: if time() < self.holdofftime: # Was invoked by key while in cooldown self.status['text'] = '' diff --git a/monitor.py b/monitor.py index ee047992..bc144089 100644 --- a/monitor.py +++ b/monitor.py @@ -62,6 +62,36 @@ class EDLogs(FileSystemEventHandler): _POLL = 1 # Polling is cheap, so do it often + # Mostly taken from http://elite-dangerous.wikia.com/wiki/List_of_Rare_Commodities + RARES = set([ + 'cetiaepyornisegg', 'aganipperush', 'alacarakmoskinart', 'albinoquechuamammoth', 'altairianskin', 'alyabodilysoap', + 'anduligafireworks', 'anynacoffee', 'aroucaconventualsweets', 'azcancriformula42', 'bluemilk', + 'baltahsinevacuumkrill', 'bakedgreebles', 'bankiamphibiousleather', 'bastsnakegin', 'belalansrayleather', + 'borasetanipathogenetics', 'burnhambiledistillate', 'cd75catcoffee', 'centaurimegagin', 'ceremonialheiketea', + 'cetirabbits', 'chameleoncloth', 'chateaudeaegaeon', 'cherbonesbloodcrystals', 'chieridanimarinepaste', + 'coquimspongiformvictuals', 'cromsilverfesh', 'crystallinespheres', 'damnacarapaces', 'deltaphoenicispalms', + 'deuringastruffles', 'disomacorn', 'aerialedenapple', 'eleuthermals', 'eraninpearlwhisky', 'eshuumbrellas', + 'esusekucaviar', 'ethgrezeteabuds', 'fujintea', 'galactictravelguide', 'geawendancedust', 'gerasiangueuzebeer', + 'giantirukamasnails', 'giantverrix', 'gilyasignatureweapons', 'gomanyauponcoffee', 'haidneblackbrew', + 'havasupaidreamcatcher', 'helvetitjpearls', 'hip10175bushmeat', 'hip118311swarm', 'hiporganophosphates', + 'hip41181squid', 'holvaduellingblades', 'honestypills', 'hr7221wheat', 'indibourbon', 'jaquesquinentianstill', + 'jaradharrepuzzlebox', 'jarouarice', 'jotunmookah', 'kachiriginleaches', 'kamitracigars', 'kamorinhistoricweapons', + 'karetiicouture', 'karsukilocusts', 'kinagoinstruments', 'konggaale', 'korrokungpellets', 'lavianbrandy', + 'alieneggs', 'leestianeviljuice', 'livehecateseaworms', 'ltthypersweet', 'lyraeweed', 'transgeniconionhead', + 'masterchefs', 'mechucoshightea', 'medbstarlube', 'mokojingbeastfeast', 'momusbogspaniel', 'motronaexperiencejelly', + 'mukusubiichitinos', 'mulachigiantfungus', 'neritusberries', 'ngadandarifireopals', 'ngunamodernantiques', + 'njangarisaddles', 'noneuclidianexotanks', 'ochoengchillies', 'onionhead', 'onionheada', 'onionheadb', 'onionheadc', + 'onionheadd', 'onionheade', 'onionheadderivatives', 'onionheadsamples', 'ophiuchiexinoartefacts', + 'orrerianviciousbrew', 'pantaaprayersticks', 'pavoniseargrubs', 'personalgifts', 'rajukrustoves', + 'rapabaosnakeskins', 'rusanioldsmokey', 'sanumameat', 'saxonwine', 'shanscharisorchid', 'soontillrelics', + 'sothiscrystallinegold', 'tanmarktranquiltea', 'tarachtorspice', 'taurichimes', 'terramaterbloodbores', + 'thehuttonmug', 'thrutiscream', 'tiegfriessynthsilk', 'tiolcewaste2pasteunits', 'toxandjivirocide', 'advert1', + 'uszaiantreegrub', 'utgaroarmillenialeggs', 'uzumokulowgwings', 'vherculisbodyrub', 'vacuumkrill', + 'vanayequirhinofur', 'vegaslimweed', 'vidavantianlace', 'lftvoidextractcoffee', 'voidworms', 'volkhabbeedrones', + 'watersofshintara', 'wheemetewheatcakes', 'witchhaulkobebeef', 'wolf1301fesh', 'wulpahyperboresystems', + 'wuthielokufroth', 'xihecompanions', 'yasokondileaf', 'zeesszeantglue', 'buckyballbeermats', + ]) + def __init__(self): FileSystemEventHandler.__init__(self) # futureproofing - not need for current version of watchdog self.root = None @@ -399,6 +429,12 @@ class EDLogs(FileSystemEventHandler): self.event_queue.append('{ "timestamp":"%s", "event":"StartUp" }' % strftime('%Y-%m-%dT%H:%M:%SZ', gmtime())) return entry + def carrying_rares(self): + for commodity in self.state['Cargo']: + if commodity in self.RARES: + return True + return False + # singleton monitor = EDLogs()