caleb531/play-song — pull request #20 by caleb531 (2015-01-01 05:37:21+00:00)
Title: Fix script compilation issue for synced Alfred installs

@Tyilo, I have an interesting issue to discuss with you.

I recently got a new MacBook Pro to replace the one I use in addition to my iMac. After adding a few songs from my iMac's iTunes library to the library for my new MacBook, Play Song seemed to stop working on my new MacBook (the results would never show).

After much experimentation, I discovered that (seemingly) `config.scpt` could *only* be loaded by the workflow *if* that configuration file was compiled on the same Mac. This seemed very odd to me, because I had two Macs before, and I never had this issue. *Perhaps* because my new Mac is a newer model, there is some difference in architecture or software that affects how AppleScripts are compiled/executed.

To solve this issue, I've modified `compile-config.sh` to compile the configration to a different location, and I've updated the filter/action scripts to account for this change. The compile script now saves `config.scpt` to Alfred's local workflow cache. It also copies `config.applescript` to the cache as well, so it can be compared with the installed copy of the configuration file (this allows for new versions of the workflow to recognize changes to the configuration).

As for the changes to the filter/action scripts, you'll notice that I moved the configuration-loading logic into a separate handler. I realize that this makes the codebase slightly less DRY, and so I was curious if you'd like to implement a new syntax for inserting that loading logic when running `update-workflow.py` (`@include: load-config@`, perhaps, assuming `load-config.applescript` exists in the repository somewhere). We could potentially expand this syntax into a sort of preprocessing directive (`@include: foo`), but then I fear we might be making the workflow overly complex. Would be interested in hearing your thoughts.

Thanks, and Happy New Year. :)
Caleb