IndigoDomotics / indigo-pushover

Indigo plugin to send push notifications via Pushover.
MIT License
17 stars 11 forks source link

Fetch sound list via API instead of hard-coded #32

Closed FlyingDiver closed 3 years ago

FlyingDiver commented 3 years ago

Would include user custom sounds instead of pull #31

jcs commented 3 years ago

0b87fe92f works for me, thanks.

FlyingDiver commented 3 years ago

Does it show all standard and your custom sounds? And the sounds all work properly? I rarely use Pushover, so it's hard for me to test thoroughly.

jcs commented 3 years ago

Yes, it lists both and my tests with both worked fine. It would better if the list were not sorted after fetching, since they are sorted a particular way from the API (custom ones first, then built-ins in a particular order), but it's not a huge deal.

FlyingDiver commented 3 years ago

OK, I'll take the sort out.

FlyingDiver commented 3 years ago

Try latest commit.

jcs commented 3 years ago

They appear in a seemingly random order now.

FlyingDiver commented 3 years ago

Yeah, I was afraid of that. It's returned as a JSON dict, and dict are unordered by definition. Here's the JSON string:

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

Which looks like a specific order (default first, etc). But when I convert that to a Dict, I get:

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

Which looks pretty random.

FlyingDiver commented 3 years ago

OK, try latest commit.

jcs commented 3 years ago

Looks good!

indigodomo commented 3 years ago

OK, try latest commit.

Did you use the object_pairs_hook option? I hear that in Python 3.14 (or some such) all dicts will be ordered. Don't know how I feel about that...

FlyingDiver commented 3 years ago

Yes, with an OrderedDict. I'm going to close this and mark it a pre-release.