From 21a66c218fef01863d00dbb43a78ef6d45ab0579 Mon Sep 17 00:00:00 2001 From: Jackson Taylor Date: Wed, 10 Nov 2021 14:58:37 -0500 Subject: 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 --- jamos | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'jamos') 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() -- cgit v1.2.3