jaroslawhartman / TimeZones-Alfred

Alfred Workflow
https://jhartman.pl/tag/time-zones/
Apache License 2.0
496 stars 20 forks source link

add_city.sh: Fix adding phone codes #54

Closed vitorgalvao closed 6 months ago

vitorgalvao commented 1 year ago

This workflow was suggested as an addition to the upcoming Alfred Gallery, and while reviewing I noticed adding new cities wasn’t working.

The URL being queried is dead. But even if it wasn’t, the python call wouldn’t work out of the box for people with macOS 12.3 or later. This all results in a 20 second wait and an error every time, in which it feels as if the workflow doesn’t work.

This PR adds a working URL and uses JavaScript for Automation (which ships with macOS) to get the country phone code. I’m doing it this way for consistency with the previous code, but I’d recommend just adding the list of phone codes as an extra file in the workflow. After all, it’s not like those change.