Skip to content

Instantly share code, notes, and snippets.

@rassie
Created July 20, 2009 22:26
Show Gist options
  • Save rassie/150962 to your computer and use it in GitHub Desktop.
Save rassie/150962 to your computer and use it in GitHub Desktop.
--- /home/nikolai/Downloads/lastfmplus/__init__.py 2009-07-20 23:23:58.000000000 +0200
+++ __init__.py 2009-07-21 00:46:45.000000000 +0200
@@ -176,56 +176,60 @@
# join the information
join_tags = cfg["lastfm_join_tags_sign"]
- if join_tags:
+ def join_tags_or_not(list):
+ if join_tags:
+ return join_tags.join(list)
+ return list
+ if 1:
used = []
# write the major-tags
if "major/tags" in hold and len(hold["major/tags"])>0:
- metadata["grouping"] = join_tags.join(hold["major/tags"])
+ metadata["grouping"] = join_tags_or_not(hold["major/tags"])
used.extend(hold["major/tags"])
# write the decade-tags
if "decade/tags" in hold and len(hold["decade/tags"])>0:
- metadata["comment:Songs-DB_Custom1"] = str(join_tags.join(hold["decade/tags"]).lower())
+ metadata["comment:Songs-DB_Custom1"] = join_tags_or_not([item.lower() for item in hold["decade/tags"]])
used.extend(hold["decade/tags"])
# write country tag
if "country/tags" in hold and len(hold["country/tags"])>0 and "city/tags" in hold and len(hold["city/tags"])>0:
- metadata["comment:Songs-DB_Custom3"] = join_tags.join(hold["country/tags"]) + join_tags + join_tags.join(hold["city/tags"])
+ metadata["comment:Songs-DB_Custom3"] = join_tags_or_not(hold["country/tags"] + hold["city/tags"])
used.extend(hold["country/tags"])
used.extend(hold["city/tags"])
elif "country/tags" in hold and len(hold["country/tags"])>0 and "city/tags" not in hold:
- metadata["comment:Songs-DB_Custom3"] = join_tags.join(hold["country/tags"])
+ metadata["comment:Songs-DB_Custom3"] = join_tags_or_not(hold["country/tags"])
used.extend(hold["country/tags"])
elif "city/tags" in hold and len(hold["city/tags"])>0 and "country/tags" not in hold:
- metadata["comment:Songs-DB_Custom3"] = join_tags.join(hold["city/tags"])
+ metadata["comment:Songs-DB_Custom3"] = join_tags_or_not(hold["city/tags"])
used.extend(hold["city/tags"])
# write the mood-tags
if "mood/tags" in hold and len(hold["mood/tags"])>0:
- metadata["mood"] = join_tags.join(hold["mood/tags"])
+ metadata["mood"] = join_tags_or_not(hold["mood/tags"])
used.extend(hold["mood/tags"])
# write the occasion-tags
if "occasion/tags" in hold and len(hold["occasion/tags"])>0:
- metadata["comment:Songs-DB_Occasion"] = join_tags.join(hold["occasion/tags"])
+ metadata["comment:Songs-DB_Occasion"] = join_tags_or_not(hold["occasion/tags"])
used.extend(hold["occasion/tags"])
# write the category-tags
if "category/tags" in hold and len(hold["category/tags"])>0:
- metadata["comment:Songs-DB_Custom2"] = join_tags.join(hold["category/tags"])
+ metadata["comment:Songs-DB_Custom2"] = join_tags_or_not(hold["category/tags"])
used.extend(hold["category/tags"])
# include major tags as minor tags also copy major to minor if no minor genre
if cfg["lastfm_app_major2minor_tag"] and "major/tags" in hold and "minor/tags" in hold and len(hold["minor/tags"])>0:
used.extend(hold["major/tags"])
used.extend(hold["minor/tags"])
- if len(used) > 0: metadata["genre"] = join_tags.join(hold["major/tags"] + hold["minor/tags"])
+ if len(used) > 0: metadata["genre"] = join_tags_or_not(hold["major/tags"] + hold["minor/tags"])
elif cfg["lastfm_app_major2minor_tag"] and "major/tags" in hold and "minor/tags" not in hold:
used.extend(hold["major/tags"])
- if len(used) > 0: metadata["genre"] = join_tags.join(hold["major/tags"])
+ if len(used) > 0: metadata["genre"] = join_tags_or_not(hold["major/tags"])
elif "minor/tags" in hold and len(hold["minor/tags"])>0:
- metadata["genre"] = join_tags.join(hold["minor/tags"])
+ metadata["genre"] = join_tags_or_not(hold["minor/tags"])
used.extend(hold["minor/tags"])
else:
if "minor/tags" not in hold and "major/tags" in hold:
@@ -787,4 +791,4 @@
register_track_metadata_processor(process_track)
-register_options_page(LastfmOptionsPage)
\ Kein Zeilenumbruch am Dateiende.
+register_options_page(LastfmOptionsPage)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment