summaryrefslogtreecommitdiff
path: root/scripts/mgLyric.py
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2009-01-11 18:49:32 +0100
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2009-01-11 18:49:32 +0100
commit45ccb381fdc28e4a33f8494d6352b64963d30c7b (patch)
tree994efa4ac06959a08d0b7c07f3556af9980f5a14 /scripts/mgLyric.py
parent343e1dfc3d31e49f74c3d006e3bc4a882c1aa7a7 (diff)
downloadvdr-plugin-muggle-45ccb381fdc28e4a33f8494d6352b64963d30c7b.tar.gz
vdr-plugin-muggle-45ccb381fdc28e4a33f8494d6352b64963d30c7b.tar.bz2
rewrote the shell script muggle_getlyrics in python and
talk directly to the googlyrics2 python code
Diffstat (limited to 'scripts/mgLyric.py')
-rwxr-xr-xscripts/mgLyric.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/scripts/mgLyric.py b/scripts/mgLyric.py
deleted file mode 100755
index 97042f5..0000000
--- a/scripts/mgLyric.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-import os, sys, locale
-
-title = sys.argv[1]
-artist = sys.argv[2]
-outdir = sys.argv[3]
-
-# add other possible paths here:
-googlFound = False
-for scriptdir in ('/usr/share/apps/amarok/scripts/Googlyrics2', \
- 'NULL'):
- if os.path.isdir(scriptdir+'/sites/'):
- sys.path.append(scriptdir + "/lib/")
- sys.path.append(scriptdir + "/sites/")
- os.chdir(scriptdir)
- googlFound = True
- break
-
-if not googlFound:
- outfile = open(outdir + '/1.raw',"w")
- outfile.write("Googlyrics2 is not installed\nSee http://quicode.com/googlyircs2")
- outfile.close
- sys.exit(0)
-
-Debugging = False
-
-if Debugging:
- outlyric=["Version 1","Version 2","Version 3"]
- for idx,item in enumerate(outlyric):
- outfile = open(outdir + '/' + str(idx) + '.raw',"w")
- outfile.write(item)
- outfile.close
- sys.exit(0)
-
-from Googlyrics import *
-g = Googlyrics()
-
-outlyric = g.find_lyrics(title, artist)
-if len(outlyric) > 0:
- for idx,item in enumerate(outlyric):
- l = item.getLyric()
- if l is not None:
- if l.lyrics is not None:
- if len(l.lyrics)>2:
-# if we pipe or write output to a file, python by default recodes into ascii,
-# and sys.stdout.encoding is also set to ascii. But if the system
-# default locale is for example utf-8, we also want the file to be
-# encoded like that
- outfile = open(outdir + '/' + str(idx) + '.raw',"w")
- outfile.write(l.lyrics.encode(locale.getdefaultlocale()[1]))
- outfile.close
-