@@ -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
0 commit comments