summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Taylor <jackson@jacksontaylor.xyz>2021-11-10 14:58:37 -0500
committerJackson Taylor <jackson@jacksontaylor.xyz>2022-04-05 16:52:04 -0400
commit21a66c218fef01863d00dbb43a78ef6d45ab0579 (patch)
tree49b3d548d6a83186ec83e6f18d73dc11d74e2791
parent7f5543c4d711d0275d928fc751b8056a135c1fe3 (diff)
Pick the first artist if multiple are available
If the artist has a comma in it, this will effect the path on *nix systems. For now, just split at the comma and then use the first result
-rwxr-xr-xjamos7
1 files changed, 6 insertions, 1 deletions
diff --git a/jamos b/jamos
index 6a2d532..2e6350e 100755
--- a/jamos
+++ b/jamos
@@ -126,7 +126,12 @@ def move_file(file, metadata):
title = 'unknownsong'
if ('artist' in metadata.keys()) and (metadata['artist'] is not None):
- artist = metadata['artist'].replace(' ', '_').lower()
+ if len(metadata['artist'].split(',')) > 1:
+ # If there are multiple artists, pick the first one
+ # NOTE: This may break if the artist has a comma in their name
+ artist = metadata['artist'].split(',')[0].replace(' ', '_').lower()
+ else:
+ artist = metadata['artist'].replace(' ', '_').lower()
if ('album' in metadata.keys()) and (metadata['album'] is not None):
album = metadata['album'].replace(' ', '_').lower()