Skip to content

Commit 9cf1c15

Browse files
committed
Refactor: Simplify 'Show in Explorer' implementation
1 parent d2de1b4 commit 9cf1c15

File tree

4 files changed

+120
-334
lines changed

4 files changed

+120
-334
lines changed

tidal_dl_ng/download.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -571,12 +571,9 @@ def item(
571571
)
572572

573573
# Step 5: Post-processing
574-
575-
final_path = path_media_dst # Path before potential move
576-
577-
new_path_if_moved = self._perform_post_processing(
574+
self._perform_post_processing(
578575
media,
579-
final_path,
576+
path_media_dst,
580577
quality_audio,
581578
quality_video,
582579
quality_audio_old,
@@ -585,11 +582,7 @@ def item(
585582
skip_file,
586583
)
587584

588-
# If post-processing moved the file, update the final_path to the new location
589-
if new_path_if_moved:
590-
final_path = new_path_if_moved
591-
592-
return download_success, final_path
585+
return download_success, path_media_dst
593586

594587
def _validate_and_prepare_media(
595588
self,
@@ -1019,7 +1012,7 @@ def _perform_post_processing(
10191012
10201013
Args:
10211014
media (Track | Video): Media item.
1022-
path_media_src (pathlib.Path): The source file path (before potential move).
1015+
path_media_dst (pathlib.Path): Destination file path.
10231016
quality_audio (Quality | None): Audio quality setting.
10241017
quality_video (QualityVideo | None): Video quality setting.
10251018
quality_audio_old (Quality | None): Previous audio quality.
@@ -1028,7 +1021,7 @@ def _perform_post_processing(
10281021
skip_file (bool): Whether file was skipped.
10291022
10301023
Returns:
1031-
pathlib.Path | None: The new path if the file was moved, otherwise None.
1024+
pathlib.Path | None: The final path if the file was moved, otherwise None.
10321025
"""
10331026
new_path: pathlib.Path | None = None
10341027

@@ -1402,12 +1395,12 @@ def items(
14021395
quality_video (QualityVideo | None, optional): Video quality. Defaults to None.
14031396
14041397
Returns:
1405-
pathlib.Path | None: The path to the downloaded album/playlist directory, or None on failure.
1398+
pathlib.Path | None: The path to the created album/playlist directory, or None if failed.
14061399
"""
14071400
# Validate and prepare media collection
14081401
validated_media = self._validate_and_prepare_media(media, media_id, media_type, video_download)
14091402
if validated_media is None or not isinstance(validated_media, Album | Playlist | UserPlaylist | Mix):
1410-
return None
1403+
return
14111404

14121405
media = validated_media
14131406

0 commit comments

Comments
 (0)