Skip to content

Commit

Permalink
Use default sounds list if API fetch fails
Browse files Browse the repository at this point in the history
  • Loading branch information
FlyingDiver committed Jun 15, 2021
1 parent c24fc10 commit c9e0c3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Pushover.indigoPlugin/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>PluginVersion</key>
<string>1.7.0</string>
<string>1.7.1</string>
<key>ServerApiVersion</key>
<string>2.0</string>
<key>IwsApiVersion</key>
Expand Down
6 changes: 4 additions & 2 deletions Pushover.indigoPlugin/Contents/Server Plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def startup(self):
customdecoder = json.JSONDecoder(object_pairs_hook=OrderedDict)
rdict = customdecoder.decode(r.text)
self.sounds = rdict['sounds']
self.logger.debug(u"Sounds = {}".format(self.sounds))
except Exception as err:
self.logger.warning(u"Error getting alert sounds list: {}".format(err))

self.sounds = OrderedDict([(u'pushover', u'Pushover (default)'), (u'bike', u'Bike'), (u'bugle', u'Bugle'), (u'cashregister', u'Cash Register'), (u'classical', u'Classical'), (u'cosmic', u'Cosmic'), (u'falling', u'Falling'), (u'gamelan', u'Gamelan'), (u'incoming', u'Incoming'), (u'intermission', u'Intermission'), (u'magic', u'Magic'), (u'mechanical', u'Mechanical'), (u'pianobar', u'Piano Bar'), (u'siren', u'Siren'), (u'spacealarm', u'Space Alarm'), (u'tugboat', u'Tug Boat'), (u'alien', u'Alien Alarm (long)'), (u'climb', u'Climb (long)'), (u'persistent', u'Persistent (long)'), (u'echo', u'Pushover Echo (long)'), (u'updown', u'Up Down (long)'), (u'vibrate', u'Vibrate Only'), (u'none', u'None (silent)')])
self.logger.debug(u"Sounds = {}".format(self.sounds))



def shutdown(self):
self.logger.debug(u"shutdown called")
Expand Down

0 comments on commit c9e0c3c

Please sign in to comment.