Skip to content

Commit dea23b1

Browse files
committed
docs: Update docstrings to reflect Show in Explorer changes
1 parent 9cf1c15 commit dea23b1

File tree

3 files changed

+71
-21
lines changed

3 files changed

+71
-21
lines changed

tidal_dl_ng/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ def _perform_post_processing(
10121012
10131013
Args:
10141014
media (Track | Video): Media item.
1015-
path_media_dst (pathlib.Path): Destination file path.
1015+
path_media_src (pathlib.Path): Source file path.
10161016
quality_audio (Quality | None): Audio quality setting.
10171017
quality_video (QualityVideo | None): Video quality setting.
10181018
quality_audio_old (Quality | None): Previous audio quality.

tidal_dl_ng/gui.py

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,18 +2265,18 @@ def on_queue_download(
22652265
quality_audio: Quality | None = None,
22662266
quality_video: QualityVideo | None = None,
22672267
) -> tuple[QueueDownloadStatus, pathlib.Path]:
2268-
"""Download media item(s) and return status and path.
2268+
"""Download the specified media item(s) and return the result status and path.
22692269
22702270
Args:
2271-
media: The TIDAL media object to download.
2272-
quality_audio: Desired audio quality for the download.
2273-
quality_video: Desired video quality for the download.
2271+
media (Track | Album | Playlist | Video | Mix | Artist): The media item(s) to download.
2272+
quality_audio (Quality | None, optional): Desired audio quality. Defaults to None.
2273+
quality_video (QualityVideo | None, optional): Desired video quality. Defaults to None.
22742274
22752275
Returns:
2276-
Tuple of (download status, path to downloaded file/directory).
2277-
For Artists, returns the artist's root directory.
2278-
For Albums/Playlists, returns the album/playlist directory.
2279-
For Tracks/Videos, returns the file path.
2276+
tuple[QueueDownloadStatus, pathlib.Path]: Tuple of (download status, path to downloaded file/directory).
2277+
For Artists, returns the artist's root directory.
2278+
For Albums/Playlists, returns the album/playlist directory.
2279+
For Tracks/Videos, returns the file path.
22802280
"""
22812281
result_status: QueueDownloadStatus
22822282
path_file: pathlib.Path = pathlib.Path()
@@ -2328,17 +2328,17 @@ def download(
23282328
quality_audio: Quality | None = None,
23292329
quality_video: QualityVideo | None = None,
23302330
) -> tuple[QueueDownloadStatus, pathlib.Path | str]:
2331-
"""Download a media item and return the result status.
2331+
"""Download a media item and return the result status and path.
23322332
23332333
Args:
2334-
media: The media item to download.
2335-
dl: The Download object to use.
2336-
delay_track: Whether to apply download delay.
2337-
quality_audio: Desired audio quality.
2338-
quality_video: Desired video quality.
2334+
media (Track | Album | Playlist | Video | Mix | Artist): The media item to download.
2335+
dl (Download): The Download object to use.
2336+
delay_track (bool, optional): Whether to apply download delay. Defaults to False.
2337+
quality_audio (Quality | None, optional): Desired audio quality. Defaults to None.
2338+
quality_video (QualityVideo | None, optional): Desired video quality. Defaults to None.
23392339
23402340
Returns:
2341-
(QueueDownloadStatus, path_file): The status and the final file path.
2341+
tuple[QueueDownloadStatus, pathlib.Path | str]: The status and the final file path.
23422342
"""
23432343
result_dl: bool
23442344
path_file: str | pathlib.Path = ""
@@ -2505,7 +2505,11 @@ def on_download_album_from_track(self, point: QtCore.QPoint) -> None:
25052505
logger_gui.warning("Could not retrieve album information from the selected track.")
25062506

25072507
def on_show_in_explorer(self, path: pathlib.Path | None) -> None:
2508-
"""Open the containing folder and (when possible) select/reveal the file in the OS file manager."""
2508+
"""Open the containing folder and (when possible) select/reveal the file in the OS file manager.
2509+
2510+
Args:
2511+
path: Path to the file or directory to show in explorer.
2512+
"""
25092513
if not path:
25102514
logger_gui.error("Attempted to show in explorer but no path was provided")
25112515
return
@@ -2517,15 +2521,26 @@ def on_show_in_explorer(self, path: pathlib.Path | None) -> None:
25172521
self._open_in_file_manager(resolved_path)
25182522

25192523
def _resolve_path(self, path: pathlib.Path) -> pathlib.Path | None:
2520-
"""Expand and resolve path, log errors if invalid."""
2524+
"""Expand and resolve path, log errors if invalid.
2525+
2526+
Args:
2527+
path: The path to resolve.
2528+
2529+
Returns:
2530+
The resolved path, or None if invalid.
2531+
"""
25212532
try:
25222533
return path.expanduser().resolve()
25232534
except (OSError, RuntimeError) as e:
25242535
logger_gui.error(f"Invalid path cannot be resolved: {path!s}{e}")
25252536
return None
25262537

25272538
def _open_in_file_manager(self, path: pathlib.Path) -> None:
2528-
"""Open path in system file manager with platform-specific command."""
2539+
"""Open path in system file manager with platform-specific command.
2540+
2541+
Args:
2542+
path: The resolved path to open.
2543+
"""
25292544
try:
25302545
if sys.platform == "win32":
25312546
self._open_windows(path)
@@ -2537,14 +2552,29 @@ def _open_in_file_manager(self, path: pathlib.Path) -> None:
25372552
logger_gui.exception(f"Unexpected error opening file manager for {path}")
25382553

25392554
def _open_windows(self, path: pathlib.Path) -> None:
2555+
"""Open path in Windows Explorer.
2556+
2557+
Args:
2558+
path: The path to open.
2559+
"""
25402560
cmd = ["explorer", "/select,", str(path)] if path.is_file() else ["explorer", str(path)]
25412561
subprocess.Popen(cmd, shell=True) # noqa: S602 # Required for /select, on Windows; path is trusted
25422562

25432563
def _open_macos(self, path: pathlib.Path) -> None:
2564+
"""Open path in macOS Finder.
2565+
2566+
Args:
2567+
path: The path to open.
2568+
"""
25442569
cmd = ["open", "-R", str(path)] if path.is_file() else ["open", str(path)]
25452570
subprocess.run(cmd, check=True) # noqa: S603 # `open` is trusted system command
25462571

25472572
def _open_linux(self, path: pathlib.Path) -> None:
2573+
"""Open path in Linux file manager.
2574+
2575+
Args:
2576+
path: The path to open.
2577+
"""
25482578
target = path.parent if path.is_file() else path
25492579
subprocess.run(["xdg-open", str(target)], check=True) # noqa: S603, S607 # `xdg-open` is trusted system utility
25502580

tidal_dl_ng/model/gui_data.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ class StatusbarMessage:
4444

4545
@dataclass
4646
class QueueDownloadItem:
47+
"""Download queue item model.
48+
49+
Attributes:
50+
status (str): Current download status.
51+
name (str): Display name of the media item.
52+
type_media (str): Type of media (Track, Album, etc).
53+
quality_audio (Quality): Audio quality setting.
54+
quality_video (QualityVideo): Video quality setting.
55+
obj (object): The actual media object.
56+
file_path (pathlib.Path | None): Path to downloaded file/directory (thread-safe property).
57+
"""
58+
4759
status: str
4860
name: str
4961
type_media: str
@@ -55,12 +67,20 @@ class QueueDownloadItem:
5567

5668
@property
5769
def file_path(self) -> pathlib.Path | None:
58-
"""Get the downloaded file path (thread-safe)."""
70+
"""Get the downloaded file path (thread-safe).
71+
72+
Returns:
73+
pathlib.Path | None: Path to the downloaded file or directory, or None if not yet set.
74+
"""
5975
with self._lock:
6076
return self._file_path
6177

6278
@file_path.setter
6379
def file_path(self, path: pathlib.Path | None) -> None:
64-
"""Set the downloaded file path (thread-safe)."""
80+
"""Set the downloaded file path (thread-safe).
81+
82+
Args:
83+
path (pathlib.Path | None): Path to the downloaded file or directory.
84+
"""
6585
with self._lock:
6686
self._file_path = path

0 commit comments

Comments
 (0)