summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2015-02-15 18:35:12 +0100
committerRasmus Steinke <rasi@xssn.at>2015-02-15 18:35:12 +0100
commit2fafdd438ee2985d41313f4b351951d6a60536d1 (patch)
tree1d900c4e3c98a30277c27389c4a016a85cf4edc0
parentf082934f3ecfdf55bd65cd0c2a6310c60c9a06cb (diff)
downloadmppc-2fafdd438ee2985d41313f4b351951d6a60536d1.tar.gz
mppc-2fafdd438ee2985d41313f4b351951d6a60536d1.tar.bz2
add workaround for album.cache
-rw-r--r--[-rwxr-xr-x]mppc25
1 files changed, 13 insertions, 12 deletions
diff --git a/mppc b/mppc
index 047e883..a7db904 100755..100644
--- a/mppc
+++ b/mppc
@@ -180,22 +180,23 @@ def albumCache(args):
content = set()
errors = set()
errors2 = set()
- fields = ('albumartist', 'album', 'date')
+ fields = ('albumartist', 'date', 'album')
fh = open(os.getenv('HOME')+'/.config/clerk/album.cache', "w")
for artist in artistlist:
- try:
- for element in client.find('albumartist', artist):
- content.add(os.getenv('seperator').join((element[f] for f in fields)))
- except KeyError:
- errors.add(element['file'])
- except TypeError:
- errors2.add(element['file'])
+ for element in client.find('albumartist', artist):
+ # die werte aller felder
+ elementvalues = []
+ for field in fields:
+ # der wert dieses einen feldes
+ fieldvalue = element[field]
+ if isinstance(fieldvalue, list):
+ elementvalues.append(fieldvalue[0])
+ else:
+ elementvalues.append(fieldvalue)
+ # alle felder wurden abgegrast
+ content.add(os.getenv('seperator').join(elementvalues))
for line in sorted(content, key=str.lower):
fh.write(line+"\n")
- for line in sorted(errors, key=str.lower):
- print("Missing tags for file: "+line, file=sys.stderr)
- for line in sorted(errors2, key=str.lower):
- print("Duplicate tags for file: "+line, file=sys.stderr)
fh.close()
def lastCache(args):