Skip to content

Commit 9ae1d00

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

File tree

3 files changed

+56
-6
lines changed

3 files changed

+56
-6
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: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)