mirror of
https://github.com/fergalmoran/picard.git
synced 2026-04-16 09:25:14 +00:00
album_artist_from_path(): remove useless code
len(dirs) == 0 cannot happen, because `whatever.split('/')` is always a list with at least 1 element.
So simplify code and remove useless tests
This commit is contained in:
@@ -391,13 +391,10 @@ def album_artist_from_path(filename, album, artist):
|
||||
"""
|
||||
if not album:
|
||||
dirs = os.path.dirname(filename).replace('\\', '/').lstrip('/').split('/')
|
||||
if len(dirs) == 0:
|
||||
return album, artist
|
||||
# Strip disc subdirectory from list
|
||||
if len(dirs) > 0:
|
||||
if re.search(r'(^|\s)(CD|DVD|Disc)\s*\d+(\s|$)', dirs[-1], re.I):
|
||||
del dirs[-1]
|
||||
if len(dirs) > 0:
|
||||
if re.search(r'(^|\s)(CD|DVD|Disc)\s*\d+(\s|$)', dirs[-1], re.I):
|
||||
del dirs[-1]
|
||||
if dirs:
|
||||
# For clustering assume %artist%/%album%/file or %artist% - %album%/file
|
||||
album = dirs[-1]
|
||||
if ' - ' in album:
|
||||
|
||||
Reference in New Issue
Block a user