TimeZones-Alfred
TimeZones-Alfred copied to clipboard
add_city.sh: Fix adding phone codes
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.