From 83509ba623fdd7ce3b7e817dda842931572f9a31 Mon Sep 17 00:00:00 2001 From: Robert Pendell Date: Sat, 1 Mar 2025 00:08:26 -0500 Subject: [PATCH] Fix disc splitting error Might not be the most elegant way but didn't see another option. Original code add the parent twice to the output template and failed to re-introduce the filename template portion that was stripped during the split. This adds that back and corrects the second joinpath() so it references that rather than the split. split renamed to path to indicate what it contains. --- zotify/config.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/zotify/config.py b/zotify/config.py index 802d5ced..90d0876e 100644 --- a/zotify/config.py +++ b/zotify/config.py @@ -280,28 +280,33 @@ def get_output(cls, mode: str) -> str: return v if mode == 'playlist': if cls.get_split_album_discs(): - split = PurePath(OUTPUT_DEFAULT_PLAYLIST).parent - return PurePath(split).joinpath('Disc {disc_number}').joinpath(split) + path = PurePath(OUTPUT_DEFAULT_PLAYLIST).parent + file = PurePath(OUTPUT_DEFAULT_PLAYLIST).name + return str(PurePath(path).joinpath('Disc {disc_number}').joinpath(file)) return OUTPUT_DEFAULT_PLAYLIST if mode == 'extplaylist': if cls.get_split_album_discs(): - split = PurePath(OUTPUT_DEFAULT_PLAYLIST_EXT).parent - return PurePath(split).joinpath('Disc {disc_number}').joinpath(split) + path = PurePath(OUTPUT_DEFAULT_PLAYLIST_EXT).parent + file = PurePath(OUTPUT_DEFAULT_PLAYLIST_EXT).name + return str(PurePath(path).joinpath('Disc {disc_number}').joinpath(file)) return OUTPUT_DEFAULT_PLAYLIST_EXT if mode == 'liked': if cls.get_split_album_discs(): - split = PurePath(OUTPUT_DEFAULT_LIKED_SONGS).parent - return PurePath(split).joinpath('Disc {disc_number}').joinpath(split) + path = PurePath(OUTPUT_DEFAULT_LIKED_SONGS).parent + file = PurePath(OUTPUT_DEFAULT_LIKED_SONGS).name + return str(PurePath(path).joinpath('Disc {disc_number}').joinpath(file)) return OUTPUT_DEFAULT_LIKED_SONGS if mode == 'single': if cls.get_split_album_discs(): - split = PurePath(OUTPUT_DEFAULT_SINGLE).parent - return PurePath(split).joinpath('Disc {disc_number}').joinpath(split) + path = PurePath(OUTPUT_DEFAULT_SINGLE).parent + file = PurePath(OUTPUT_DEFAULT_SINGLE).name + return str(PurePath(path).joinpath('Disc {disc_number}').joinpath(file)) return OUTPUT_DEFAULT_SINGLE if mode == 'album': if cls.get_split_album_discs(): - split = PurePath(OUTPUT_DEFAULT_ALBUM).parent - return PurePath(split).joinpath('Disc {disc_number}').joinpath(split) + path = PurePath(OUTPUT_DEFAULT_ALBUM).parent + file = PurePath(OUTPUT_DEFAULT_ALBUM).name + return str(PurePath(path).joinpath('Disc {disc_number}').joinpath(file)) return OUTPUT_DEFAULT_ALBUM raise ValueError()