-
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1106 from exislow/gui-playlists
[GUI] Show user's playlists and allow to download them.
- Loading branch information
Showing
10 changed files
with
256 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ lyricsgenius==3.0.1 | |
pydub==0.25.1 | ||
PyQt5==5.15.7 | ||
qt-material==2.12 | ||
lxml==4.7.1 | ||
lxml==4.7.1 | ||
tidalapi==0.7.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,27 +6,28 @@ | |
@Author : Yaronzz | ||
@Version : 3.0 | ||
@Contact : [email protected] | ||
@Desc : | ||
@Desc : | ||
''' | ||
import sys | ||
import getopt | ||
|
||
from tidal_dl.events import * | ||
from tidal_dl.settings import * | ||
from tidal_dl.gui import startGui | ||
from events import * | ||
from settings import * | ||
from gui import startGui | ||
|
||
|
||
def mainCommand(): | ||
try: | ||
opts, args = getopt.getopt(sys.argv[1:], | ||
"hvgl:o:q:r:", | ||
opts, args = getopt.getopt(sys.argv[1:], | ||
"hvgl:o:q:r:", | ||
["help", "version", "gui", "link=", "output=", "quality", "resolution"]) | ||
except getopt.GetoptError as errmsg: | ||
Printf.err(vars(errmsg)['msg'] + ". Use 'tidal-dl -h' for useage.") | ||
Printf.err(vars(errmsg)['msg'] + ". Use 'tidal-dl -h' for usage.") | ||
return | ||
|
||
link = None | ||
showGui = False | ||
|
||
for opt, val in opts: | ||
if opt in ('-h', '--help'): | ||
Printf.usage() | ||
|
@@ -52,11 +53,11 @@ def mainCommand(): | |
SETTINGS.videoQuality = SETTINGS.getVideoQuality(val) | ||
SETTINGS.save() | ||
continue | ||
|
||
if not aigpy.path.mkdirs(SETTINGS.downloadPath): | ||
Printf.err(LANG.select.MSG_PATH_ERR + SETTINGS.downloadPath) | ||
return | ||
|
||
if showGui: | ||
startGui() | ||
return | ||
|
@@ -71,22 +72,22 @@ def main(): | |
SETTINGS.read(getProfilePath()) | ||
TOKEN.read(getTokenPath()) | ||
TIDAL_API.apiKey = apiKey.getItem(SETTINGS.apiKeyIndex) | ||
|
||
if len(sys.argv) > 1: | ||
mainCommand() | ||
return | ||
|
||
Printf.logo() | ||
Printf.settings() | ||
|
||
if not apiKey.isItemValid(SETTINGS.apiKeyIndex): | ||
changeApiKey() | ||
loginByWeb() | ||
elif not loginByConfig(): | ||
loginByWeb() | ||
|
||
Printf.checkVersion() | ||
|
||
while True: | ||
Printf.choices() | ||
choice = Printf.enter(LANG.select.PRINT_ENTER_CHOICE) | ||
|
@@ -115,10 +116,10 @@ def main(): | |
def test(): | ||
SETTINGS.read(getProfilePath()) | ||
TOKEN.read(getTokenPath()) | ||
|
||
if not loginByConfig(): | ||
loginByWeb() | ||
|
||
SETTINGS.audioQuality = AudioQuality.Master | ||
SETTINGS.videoFileFormat = VideoQuality.P240 | ||
SETTINGS.checkExist = False | ||
|
@@ -149,7 +150,7 @@ def test(): | |
# playlist 98235845-13e8-43b4-94e2-d9f8e603cee7 | ||
# start('98235845-13e8-43b4-94e2-d9f8e603cee7') | ||
# video 155608351 188932980 https://tidal.com/browse/track/55130637 | ||
# start("155608351")https://tidal.com/browse/track/199683732 | ||
# start("155608351")https://tidal.com/browse/track/199683732 | ||
|
||
|
||
if __name__ == '__main__': | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,18 +6,16 @@ | |
@Author : Yaronzz | ||
@Version : 1.0 | ||
@Contact : [email protected] | ||
@Desc : | ||
@Desc : | ||
''' | ||
import aigpy | ||
import logging | ||
|
||
from tidal_dl.paths import * | ||
from tidal_dl.printf import * | ||
from tidal_dl.decryption import * | ||
from tidal_dl.tidal import * | ||
|
||
from concurrent.futures import ThreadPoolExecutor | ||
|
||
from decryption import * | ||
from printf import * | ||
from tidal import * | ||
|
||
|
||
def __isSkip__(finalpath, url): | ||
if not SETTINGS.checkExist: | ||
return False | ||
|
@@ -114,7 +112,7 @@ def downloadVideo(video: Video, album: Album = None, playlist: Playlist = None): | |
try: | ||
stream = TIDAL_API.getVideoStreamUrl(video.id, SETTINGS.videoQuality) | ||
path = getVideoPath(video, album, playlist) | ||
|
||
Printf.video(video, stream) | ||
logging.info("[DL Video] name=" + aigpy.path.getFileName(path) + "\nurl=" + stream.m3u8Url) | ||
|
||
|
@@ -164,7 +162,7 @@ def downloadTrack(track: Track, album=None, playlist=None, userProgress=None, pa | |
tool.setPartSize(partSize) | ||
check, err = tool.start(SETTINGS.showProgress and not SETTINGS.multiThread) | ||
if not check: | ||
Printf.err(f"DL Track[{track.title}] failed.{str(err)}") | ||
Printf.err(f"DL Track '{track.title}' failed: {str(err)}") | ||
return False, str(err) | ||
|
||
# encrypted -> decrypt and remove encrypted file | ||
|
@@ -187,19 +185,20 @@ def downloadTrack(track: Track, album=None, playlist=None, userProgress=None, pa | |
|
||
__setMetaData__(track, album, path, contributors, lyrics) | ||
Printf.success(track.title) | ||
|
||
return True, '' | ||
except Exception as e: | ||
Printf.err(f"DL Track[{track.title}] failed.{str(e)}") | ||
Printf.err(f"DL Track '{track.title}' failed: {str(e)}") | ||
return False, str(e) | ||
|
||
|
||
def downloadTracks(tracks, album: Album = None, playlist : Playlist=None): | ||
def downloadTracks(tracks, album: Album = None, playlist: Playlist = None): | ||
def __getAlbum__(item: Track): | ||
album = TIDAL_API.getAlbum(item.album.id) | ||
if SETTINGS.saveCovers and not SETTINGS.usePlaylistFolder: | ||
downloadCover(album) | ||
return album | ||
|
||
if not SETTINGS.multiThread: | ||
for index, item in enumerate(tracks): | ||
itemAlbum = album | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,17 +6,10 @@ | |
@Author : Yaronzz | ||
@Version : 1.0 | ||
@Contact : [email protected] | ||
@Desc : | ||
@Desc : | ||
""" | ||
|
||
import aigpy | ||
import time | ||
|
||
from tidal_dl.model import * | ||
from tidal_dl.enums import * | ||
from tidal_dl.tidal import * | ||
from tidal_dl.printf import * | ||
from tidal_dl.download import * | ||
from download import * | ||
|
||
''' | ||
================================= | ||
|
Oops, something went wrong.