summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/cli.py
diff options
context:
space:
mode:
authorV3ntus <29584644+V3ntus@users.noreply.github.com>2025-01-03 15:28:32 +0000
committerV3ntus <29584644+V3ntus@users.noreply.github.com>2025-01-03 15:28:32 +0000
commit6f21eaee76d32e74f43ad857b6f3e059b3ef00a6 (patch)
treec1905da372d0d75dc98e0ddbc3d64f3f223481f3 /tidal_dl_ng/cli.py
parent31b260f690ebc476585bb1334dbfadef0d409b50 (diff)
downloadtidal-dl-ng-6f21eaee76d32e74f43ad857b6f3e059b3ef00a6.tar.gz
feat: add dl_fav tracks/artists/albums/videos subcommands
Diffstat (limited to 'tidal_dl_ng/cli.py')
-rw-r--r--tidal_dl_ng/cli.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/tidal_dl_ng/cli.py b/tidal_dl_ng/cli.py
index 92e36cf..cdd1409 100644
--- a/tidal_dl_ng/cli.py
+++ b/tidal_dl_ng/cli.py
@@ -240,6 +240,58 @@ def download(
return _download(ctx, urls)
+@dl_fav_group.command(
+ name="tracks",
+ help="Download your saved, favorite tracks collection.",
+)
+def download_fav_tracks(ctx: typer.Context):
+ # Call login method to validate the token.
+ ctx.invoke(login, ctx)
+
+ # Get favorite tracks
+ track_urls = [track.share_url for track in ctx.obj[CTX_TIDAL].session.user.favorites.tracks()]
+ return _download(ctx, track_urls, try_login=False)
+
+
+@dl_fav_group.command(
+ name="artists",
+ help="Download your saved, favorite artists collection.",
+)
+def download_fav_artists(ctx: typer.Context):
+ # Call login method to validate the token.
+ ctx.invoke(login, ctx)
+
+ # Get favorite artists
+ artist_urls = [artist.share_url for artist in ctx.obj[CTX_TIDAL].session.user.favorites.artists()]
+ return _download(ctx, artist_urls, try_login=False)
+
+
+@dl_fav_group.command(
+ name="albums",
+ help="Download your saved, favorite albums collection.",
+)
+def download_fav_albums(ctx: typer.Context):
+ # Call login method to validate the token.
+ ctx.invoke(login, ctx)
+
+ # Get favorite artists
+ artist_urls = [artist.share_url for artist in ctx.obj[CTX_TIDAL].session.user.favorites.albums()]
+ return _download(ctx, artist_urls, try_login=False)
+
+
+@dl_fav_group.command(
+ name="videos",
+ help="Download your saved, favorite videos collection.",
+)
+def download_fav_videos(ctx: typer.Context):
+ # Call login method to validate the token.
+ ctx.invoke(login, ctx)
+
+ # Get favorite artists
+ artist_urls = [artist.share_url for artist in ctx.obj[CTX_TIDAL].session.user.favorites.videos()]
+ return _download(ctx, artist_urls, try_login=False)
+
+
@app.command()
def gui(ctx: typer.Context):
from tidal_dl_ng.gui import gui_activate