Jump to content

Airports


Recommended Posts

Alfred Airports Workflow

https://github.com/otherguy/alfred-airports-workflow

 

Get information about any airport in the world. Search by IATA code, country, city, etc.

 

When hitting ⏎ Return on a selected item, the workflow tries to be helpful by opening either the airports website or its Wikipedia page if it has one. If it has neither a website nor an entry in Wikipedia, it opens the Apple Maps.app with the location of the airport.

 

When holding down a modifier key, the action can be specified:

 

Modifier Action
Open the website of the selected airport.
ctrl Open the Wikipedia page of the selected airport.
Show the airports location in Maps.app

 

screencast-1-resized.gif

 

 

 

Edited by otherguy
Changed URL
Link to comment
  • 4 weeks later...
  • 2 weeks later...
  • 2 weeks later...

I have tried versions 0.1.4 and 0.1.5 and both don't work.Version 0.1.3 works. When I input anything after the keyword "airport", I get an error message.

 

I can't figure out why this is. Can you help?

 

Here is the log:

 

Starting debug for 'Airports'

[2017-09-22 12:48:41][ERROR: input.scriptfilter] Code 1: 12:48:41 workflow.py:2249 DEBUG    workflow version: 0.1.5
12:48:41 workflow.py:1657 DEBUG    reading settings from /Users/[HIDDEN]/Library/Application Support/Alfred 3/Workflow Data/tirol.basecamp.alfredworkflow.airport-codes/settings.json
12:48:41 workflow.py:2532 DEBUG    Update check not due
12:48:41 workflow.py:1884 DEBUG    loading cached data: /Users/[HIDDEN]/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/tirol.basecamp.alfredworkflow.airport-codes/__workflow_update_status.cpickle
12:48:41 workflow.py:2462 DEBUG    update_data: {u'available': False}
12:48:41 workflow.py:1884 DEBUG    loading cached data: /Users/[HIDDEN]/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/tirol.basecamp.alfredworkflow.airport-codes/airports.cpickle
./lib/unidecode/__init__.py:46: RuntimeWarning: Argument <class 'dotmap.DotMap'> is not an unicode object. Passing an encoded string will likely have unexpected results.
  _warn_if_not_unicode(string)
12:48:41 workflow.py:2267 ERROR    'DotMap' object is not callable
Traceback (most recent call last):
  File "/Users/[HIDDEN]/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.684F4439-C6FA-49F8-8470-A4EF92900BD1/workflow/workflow.py", line 2260, in run
    func(self)
  File "airports.py", line 100, in main
    filtered_airports = wf.filter(airportquery, all_airports, key_for_airports, min_score=70, match_on=MATCH_ATOM | MATCH_SUBSTRING, include_score=True)
  File "/Users/[HIDDEN]/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.684F4439-C6FA-49F8-8470-A4EF92900BD1/workflow/workflow.py", line 2076, in filter
    value = key(item).strip()
  File "airports.py", line 71, in key_for_airports
    searchkey = '{},{},{},{},{}'.format(unidecode(airport.iata_code), unidecode(airport.name), unidecode(airport.icao_code), unidecode(airport.country), unidecode(airport.city))
  File "./lib/unidecode/__init__.py", line 48, in unidecode_expect_ascii
    bytestring = string.encode('ASCII')
TypeError: 'DotMap' object is not callable
12:48:41 workflow.py:2290 DEBUG    workflow finished in 0.687 seconds
[2017-09-22 12:48:42][ERROR: input.scriptfilter] Code 1: 12:48:42 workflow.py:2249 DEBUG    workflow version: 0.1.5
12:48:42 workflow.py:1657 DEBUG    reading settings from /Users/[HIDDEN]/Library/Application Support/Alfred 3/Workflow Data/tirol.basecamp.alfredworkflow.airport-codes/settings.json
12:48:42 workflow.py:2532 DEBUG    Update check not due
12:48:42 workflow.py:1884 DEBUG    loading cached data: /Users/[HIDDEN]/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/tirol.basecamp.alfredworkflow.airport-codes/__workflow_update_status.cpickle
12:48:42 workflow.py:2462 DEBUG    update_data: {u'available': False}
12:48:42 workflow.py:1884 DEBUG    loading cached data: /Users/[HIDDEN]/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/tirol.basecamp.alfredworkflow.airport-codes/airports.cpickle
./lib/unidecode/__init__.py:46: RuntimeWarning: Argument <class 'dotmap.DotMap'> is not an unicode object. Passing an encoded string will likely have unexpected results.
  _warn_if_not_unicode(string)
12:48:42 workflow.py:2267 ERROR    'DotMap' object is not callable
Traceback (most recent call last):
  File "/Users/[HIDDEN]/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.684F4439-C6FA-49F8-8470-A4EF92900BD1/workflow/workflow.py", line 2260, in run
    func(self)
  File "airports.py", line 100, in main
    filtered_airports = wf.filter(airportquery, all_airports, key_for_airports, min_score=70, match_on=MATCH_ATOM | MATCH_SUBSTRING, include_score=True)
  File "/Users/[HIDDEN]/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.684F4439-C6FA-49F8-8470-A4EF92900BD1/workflow/workflow.py", line 2076, in filter
    value = key(item).strip()
  File "airports.py", line 71, in key_for_airports
    searchkey = '{},{},{},{},{}'.format(unidecode(airport.iata_code), unidecode(airport.name), unidecode(airport.icao_code), unidecode(airport.country), unidecode(airport.city))
  File "./lib/unidecode/__init__.py", line 48, in unidecode_expect_ascii
    bytestring = string.encode('ASCII')
TypeError: 'DotMap' object is not callable
12:48:42 workflow.py:2290 DEBUG    workflow finished in 0.646 seconds

Link to comment
On 22/09/2017 at 1:50 PM, Guy Stan said:

searchkey = '{},{},{},{},{}'.format(unidecode(airport.iata_code), unidecode(airport.name), unidecode(airport.icao_code), unidecode(airport.country), unidecode(airport.city))

 

@darkwinternight Why are you using unidecode? All your input is coming in via Alfred-Workflow, so it's guaranteed to be Unicode. unidecode is a massive library, and appears to be unnecessary.

Link to comment
  • 1 year later...
  • 1 month later...
On 9/22/2017 at 6:46 PM, jeffsui said:

This seems VERY similar to my workflow:  https://github.com/jeeftor/alfredAirports

 

Feel free to check it out - may or may not have more features - such as runway configurations and frequencies.  

 

Love this tool, be on the lookout for a pull request soon! I don't know if you're a pilot or not, but as a pilot, I have some small lexical changes I'm going to make so the information is more uniform with other sources of information pilots are used to. 

 

I wouldn't be making edits if I didn't already love the project. 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...