Skip to content

Commit

Permalink
Added display of lyric link
Browse files Browse the repository at this point in the history
  • Loading branch information
Koronen committed Mar 9, 2011
1 parent 1c4a691 commit 74070e0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions spotify-notify.py 100644 → 100755
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# -*- encoding: utf8 -*-
#
# Spotify-Notify - Notifications and media keys support for Spotify
# Copyright (C) 2011 Victor Koronen and contributors
Expand All @@ -19,8 +20,10 @@
#

import os, time, sys, datetime, string, re
import urllib2
import pynotify
import tempfile
import webbrowser

sys.path.append("./lib")
import pylast
Expand Down Expand Up @@ -69,7 +72,6 @@ def fetchLastFmAlbumCover(self, artist, title, album = None):

url = album.get_cover_image(size = 1) #Equals medium size (best speed/quality compromise)
self.albumname = album.get_name()
import urllib2
coverfile = urllib2.urlopen(url)

# Remove old tmp if any
Expand Down Expand Up @@ -97,7 +99,6 @@ def fetchLastFmAlbumCover(self, artist, title, album = None):

def fetchCoverImageSpotify(self, trackid):
try:
import urllib2
url = SPOTIFY_OPEN_URL + trackid
tracksite = urllib2.urlopen(url).read()
matchobject = re.search('/image/(.*)" alt', tracksite)
Expand Down Expand Up @@ -156,6 +157,15 @@ def on_track_change(self, meta):
n.show()
self.old_id = n.props.id

# show link to lyrics on lyric wiki
if True:
def e(s):
return "_".join(map(urllib2.quote, s.title().split(" ")))

url = "http://lyrics.wikia.com/%s:%s" % (e(artist), e(title))
print url
#webbrowser.open()

""" main (duh!) """
def main():
# dependency check
Expand Down

0 comments on commit 74070e0

Please sign in to comment.