summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Rohdewald <wolfgang@rohdewald.de>2009-01-15 00:43:43 +0100
committerWolfgang Rohdewald <wolfgang@rohdewald.de>2009-01-15 00:43:43 +0100
commit69ee1a1e3d2a17a5512541a4135a5783391b6e24 (patch)
tree210e4200a694269a32fa95e5025136036c45bdab
parent10a3979d0c68ee3a212840853d8f49a296946cf6 (diff)
downloadvdr-plugin-muggle-69ee1a1e3d2a17a5512541a4135a5783391b6e24.tar.gz
vdr-plugin-muggle-69ee1a1e3d2a17a5512541a4135a5783391b6e24.tar.bz2
minor cleanups in muggle_getlyrics
-rwxr-xr-xscripts/muggle_getlyrics13
1 files changed, 3 insertions, 10 deletions
diff --git a/scripts/muggle_getlyrics b/scripts/muggle_getlyrics
index b187487..f6fba8e 100755
--- a/scripts/muggle_getlyrics
+++ b/scripts/muggle_getlyrics
@@ -6,9 +6,11 @@ import os, sys, locale, re, codecs
import filecmp
from htmlentitydefs import name2codepoint as n2cp
+# adjust MAXLINELENGTH to your needs
MAXLINELENGTH = 50
def writeFile(name,s):
+ """create directory if needed. Wrap lines without splitting words."""
if not os.path.isdir(outdir):
os.mkdir(outdir)
outname = outdir + '/' + name
@@ -74,15 +76,7 @@ def countFiles():
return 0
return len(os.listdir(outdir))
-def load(debug=False):
- if debug:
- 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)
-
+def load():
g = Googlyrics()
outlyric = g.find_lyrics(title, artist)
@@ -129,7 +123,6 @@ try:
itemfile = outdir + '/' + item
if os.path.exists(lyricsfile):
if filecmp.cmp(lyricsfile,itemfile) == 1:
- print 'removing duplicate ',itemfile
os.remove(itemfile)
if countFiles() > 0:
os.rename(outdir+'/'+os.listdir(outdir)[0],outfile)