Permalink
Browse files

First commit

  • Loading branch information...
0 parents commit e42ac040f54237bc2321783199a4076834239dae ajotwani committed Jun 21, 2012
@@ -0,0 +1,77 @@
+Rovi Artist Age# What is "Rovi Artist Age"?
+
+"Rovi Artist Age" is a fun little [Alfred](http://www.alfredapp.com/) extension built using Python, that allows you to find the age and date of birth of any music artist using their first or last name using Rovi's artist info API. No more guessing, madonna & britney's date of births at your finger tips!
+
+## What is Alfred?
+[Alfred](http://alfredapp.com) is an award-winning productivity application for Mac OS X, which aims to save you time in searching your local computer and the web. Whether it's maps, Amazon, eBay, Wikipedia, you can feed your web addiction quicker than ever.
+
+The real power of Alfred lies in it's [powerpack](http://www.alfredapp.com/powerpack/) that allows you to create your very own Terminal shell scripts, AppleScripts, workflows, search filters and file groups to extend Alfred.
+
+## Summary
+
+Why? Cause it's easy, fun. Why open a browser when you can find madonna's age with just a keyboard shortcut? It obvious;y doesn't stop there. You can search for any artist by their first or last names. Think usher, britney!
+
+## Requirements
+
+1. [Alfred](http://www.alfredapp.com/) + [Alfred Powerpack](http://www.alfredapp.com/powerpack/)
+2. [Rovi API Key](http://developer.rovicorp.com)
+3. Growl
+4. Nice and shiny Mac - Of course you have one!
+
+## How to Use
+
+1. Make sure Alfred is running.
+
+2. Just hit your Alfred keyboard shortcut. In my case I have it configured it as CMD + SPACE. (The default is probably ALT + SPACE)
+
+ ![Alfred Launch Bar](https://github.com/ajotwani/rovi-artist-age/raw/master/images/alfred_launch_bar.png)
+
+3. Type the keyword **age** followed by the first or last name of the artist you want to find the date of birth for (You can change the keyword by editing the info.plist file)
+
+ ![Alfred Launch Bar](https://github.com/ajotwani/rovi-artist-age/raw/master/images/alfred_launch_bar_fill.png)
+
+4. You get a Growl notification with the date of birth and the age of the artist
+
+ ![Alfred Growl Notification](https://github.com/ajotwani/rovi-artist-age/raw/master/images/alfred_growl.png)
+
+
+## Examples ##
+ <pre>age britney</pre>
+ <pre>age usher</pre>
+
+## Installation
+
+
+1. Grab the latest source
+ <pre>git clone git://github.com/ajotwani/rovi-artist-age.git</pre>
+
+2. Copy the directory you just downloaded to -
+ <pre>~/Library/Application Support/Alfred/extensions/scripts</pre>
+
+3. Rename this directory to say "Rovi Artist Age"
+
+4. Open the file "~/Library/Application Support/Alfred/extensions/scripts/Rovi Artist Age/rovi_auth.py" and type in your Rovi **API key** & **Shared Secret**. Get your Rovi (Metadata and Search) API Key [here](http://developer.rovicorp.com)
+
+ ![Type your Rovi API Key](https://github.com/ajotwani/rovi-artist-age/raw/master/images/rovi_api_key.png)
+
+5. You're done. Just give Alfred a whirl now. Refer [How to Use](#how-to-use) above.
+
+## Development
+
+Be sure to follow the configuration steps above and use this step-by-step guide to tweak to your heart's content.
+
+1. Grab the latest source
+ <pre>git clone git://github.com/ajotwani/rovi-artist-age.git</pre>
+
+2. All the Rovi search related action takes place in the file 'rovi\_search\_.py'
+
+3. All the Rovi auth related action takes place in the file 'rovi_auth.py'
+
+4. Tweak away
+
+
+## About
+
+* No warranty expressed or implied. Software is as is.
+* [MIT License](http://www.opensource.org/licenses/mit-license.html)
+* Lovingly created by [Mashery Dev](http://dev.mashery.com)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>action</key>
+ <false/>
+ <key>category</key>
+ <string>SCRIPTS</string>
+ <key>command</key>
+ <string>URL=$(./rovi.py "{query}")
+echo $URL</string>
+ <key>disabled</key>
+ <false/>
+ <key>escapequery</key>
+ <true/>
+ <key>escapequerybackquotes</key>
+ <true/>
+ <key>escapequerybrackets</key>
+ <true/>
+ <key>escapequeryquotes</key>
+ <true/>
+ <key>escapequerysemicolons</key>
+ <true/>
+ <key>growloutput</key>
+ <true/>
+ <key>growloutputsticky</key>
+ <true/>
+ <key>keyword</key>
+ <string>age</string>
+ <key>logging</key>
+ <false/>
+ <key>parameter</key>
+ <integer>0</integer>
+ <key>silent</key>
+ <true/>
+ <key>subtitle</key>
+ <string>Rovi Artist Search</string>
+ <key>title</key>
+ <string>Rovi Artist Search</string>
+</dict>
+</plist>
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>creator</key>
+ <string>MasheryDev</string>
+ <key>website</key>
+ <string>http://dev.mashery.com</string>
+</dict>
+</plist>
@@ -0,0 +1,39 @@
+#! /usr/bin/python
+
+from encodings import hex_codec
+from encodings import ascii
+import httplib
+import urllib2
+import json
+import sys
+import datetime
+import rovi_auth
+
+sig = rovi_auth.sign()
+rovi_key = rovi_auth.apikey()
+
+# getting user input
+if len(sys.argv) < 2:
+ sys.exit(2)
+
+search = sys.argv[1]
+
+#Getting artist info from Rovi
+url = "http://api.rovicorp.com/data/v1/name/info?name=%s&duration=10080&inprogress=true&country=US&language=en&format=json&apikey=%s&sig=%s" % (search,rovi_key,sig)
+json = urllib2.urlopen(url).read()
+
+# convert to a native python object
+(true,false,null) = (True,False,None)
+rovi_data = eval(json)
+
+now = datetime.datetime.now()
+
+#Retrieving artist info from the payload
+artist_name = rovi_data ['name']['name']
+artist_birth = rovi_data ['name']['birth']['date']
+artist_birth_year = int(artist_birth.split ('-')[0])
+artist_age = now.year - artist_birth_year
+
+#Printing stuff
+print "%s was born on: %s" % (artist_name, artist_birth)
+print "%s is: %s years old" % (artist_name, artist_age)
@@ -0,0 +1,24 @@
+import time
+import hashlib
+
+# Get your Rovi API Key from http://developer.rovicorp.com
+APIKEY = 'your_rovi_api_key'
+SECRET = 'your_rovi_shared_secret'
+
+def apikey():
+ return APIKEY
+
+def secret():
+ return SECRET
+
+def sign():
+ my_time = int(time.time())
+ sig = hashlib.md5()
+ sig.update(APIKEY)
+ sig.update(SECRET)
+ sig.update(str(my_time))
+
+ return sig.hexdigest()
+
+if __name__ == '__main__':
+ print sign()

0 comments on commit e42ac04

Please sign in to comment.