Linux: codefireX NotifyMyAndroid Script

I wrote up a quick cfx_nma.sh script in bash that parses the synergye.codefi.re/__ pages for new updates. It then uses the Notify My Android (NMA) API to send notifications to my phone.

You will need to register at Notify My Android and generate an API key, then enter it when the script prompts you to do so. On the first execution it downloads the nma.pl script, requests the API key from the user and saves it in the 10.18.2012 EDIT: apikey text file. Then it then simply retrieves the relevant page(s), parses out the zip names, finds the newest ones, and creates and populates a text file with those  zip names. Note that it won’t notify you on the first run.

On all subsequent executions,  it compares the currest newest zips from the webpages to the text file containing a list of previously saved zips that were the newest ones at the time they were saved. If newer ones are found, it uses the NMA API to, obviously, notify my Android phone (on which the NMA app is installed); it also populates the text file with the updated zip names.

At the top of the script I can customize several things: the location of the nma.sh script, the location of the text file, and the list of folders I want to check (ie. codefireX-Ace, KangBang-Ace-Kernels, Ace-TestBuilds, etc.), and the length of the polling interval (if empty, it will only execute once and quit).

Note that, while this is obviously native to Linux, it can be used on Windows. You will need to download  Cygwin and make sure to add curl to the dependencies when installing it with the included setup.exe. From there, save this cfx_nma.sh script and this cfx_nma.bat script in $HOME/.scripts (or you can change the paths in the .sh and .bat to your heart’s content). The .bat will run the .sh script; just double-click the .bat script when you want to run it. If you’d like to have the script run constantly on startup, you could create a shortcut to the .bat script in Start Menu -> Programs -> Startup. (You should change cfx_nma.sh’s polling interval to poll automatically then.)

It works for me so far! Let me know if there are any issues.

10.18.2012 EDIT: I’ve changed the script to use nma.pl instead of nma.sh. There were a couple portability issues with Cygwin on Windows, and despite the fact that I use Linux for my daily desktop and laptop I perversely use Windows for my HTPC and server. (I fought with MythBuntu and my video card for about a week before I sold out.) This requires an additional customization and text file, which stores the apikey.

Advertisements
Tagged , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: