diff options
author | Jackson Taylor <jackson@jacksontaylor.xyz> | 2021-11-10 14:58:37 -0500 |
---|---|---|
committer | Jackson Taylor <jackson@jacksontaylor.xyz> | 2022-04-05 16:52:04 -0400 |
commit | 21a66c218fef01863d00dbb43a78ef6d45ab0579 (patch) | |
tree | 49b3d548d6a83186ec83e6f18d73dc11d74e2791 /jamos | |
parent | 7f5543c4d711d0275d928fc751b8056a135c1fe3 (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
Diffstat (limited to 'jamos')
-rwxr-xr-x | jamos | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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() |