mirror of
https://github.com/yaronzz/Tidal-Media-Downloader.git
synced 2026-01-16 16:04:25 -05:00
Removed tidal. import.
This commit is contained in:
@@ -6,20 +6,20 @@
|
||||
@Author : Yaronzz
|
||||
@Version : 3.0
|
||||
@Contact : yaronhuang@foxmail.com
|
||||
@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.")
|
||||
@@ -52,11 +52,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 +71,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 +115,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 +149,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__':
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
@Author : Yaronzz
|
||||
@Version : 1.0
|
||||
@Contact : yaronhuang@foxmail.com
|
||||
@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 paths import *
|
||||
from printf import *
|
||||
from decryption import *
|
||||
from tidal import *
|
||||
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
@@ -114,7 +114,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)
|
||||
|
||||
@@ -199,7 +199,7 @@ def downloadTracks(tracks, album: Album = None, playlist : Playlist=None):
|
||||
if SETTINGS.saveCovers and not SETTINGS.usePlaylistFolder:
|
||||
downloadCover(album)
|
||||
return album
|
||||
|
||||
|
||||
if not SETTINGS.multiThread:
|
||||
for index, item in enumerate(tracks):
|
||||
itemAlbum = album
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
@Author : Yaronzz
|
||||
@Version : 1.0
|
||||
@Contact : yaronhuang@foxmail.com
|
||||
@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 model import *
|
||||
from enums import *
|
||||
from tidal import *
|
||||
from printf import *
|
||||
from download import *
|
||||
|
||||
'''
|
||||
=================================
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
@Author : Yaronzz
|
||||
@Version : 1.0
|
||||
@Contact : yaronhuang@foxmail.com
|
||||
@Desc :
|
||||
@Desc :
|
||||
"""
|
||||
import sys
|
||||
import aigpy
|
||||
import _thread
|
||||
import importlib
|
||||
|
||||
from tidal_dl.events import *
|
||||
from tidal_dl.settings import *
|
||||
from tidal_dl.printf import *
|
||||
from tidal_dl.enums import *
|
||||
from events import *
|
||||
from settings import *
|
||||
from printf import *
|
||||
from enums import *
|
||||
|
||||
|
||||
def enableGui():
|
||||
@@ -42,25 +42,25 @@ else:
|
||||
def __init__(self, ) -> None:
|
||||
super().__init__()
|
||||
self.initView()
|
||||
|
||||
|
||||
def initView(self):
|
||||
self.c_pathDownload = QtWidgets.QLineEdit()
|
||||
self.c_pathAlbumFormat = QtWidgets.QLineEdit()
|
||||
self.c_pathTrackFormat = QtWidgets.QLineEdit()
|
||||
self.c_pathVideoFormat = QtWidgets.QLineEdit()
|
||||
|
||||
|
||||
self.mainGrid = QtWidgets.QVBoxLayout(self)
|
||||
self.mainGrid.addWidget(self.c_pathDownload)
|
||||
self.mainGrid.addWidget(self.c_pathAlbumFormat)
|
||||
self.mainGrid.addWidget(self.c_pathTrackFormat)
|
||||
self.mainGrid.addWidget(self.c_pathVideoFormat)
|
||||
|
||||
|
||||
class EmittingStream(QObject):
|
||||
textWritten = pyqtSignal(str)
|
||||
|
||||
def write(self, text):
|
||||
self.textWritten.emit(str(text))
|
||||
|
||||
|
||||
class MainView(QtWidgets.QWidget):
|
||||
s_downloadEnd = pyqtSignal(str, bool, str)
|
||||
|
||||
@@ -95,7 +95,7 @@ else:
|
||||
self.m_supportType = [Type.Album, Type.Playlist, Type.Track, Type.Video, Type.Artist]
|
||||
for item in self.m_supportType:
|
||||
self.c_combType.addItem(item.name, item)
|
||||
|
||||
|
||||
for item in AudioQuality:
|
||||
self.c_combTQuality.addItem(item.name, item)
|
||||
for item in VideoQuality:
|
||||
@@ -146,7 +146,7 @@ else:
|
||||
self.funcGrid.addWidget(self.c_tableInfo)
|
||||
self.funcGrid.addLayout(self.line2Grid)
|
||||
self.funcGrid.addWidget(self.c_printTextEdit)
|
||||
|
||||
|
||||
self.mainGrid = QtWidgets.QGridLayout(self)
|
||||
self.mainGrid.addLayout(self.funcGrid, 0, 0)
|
||||
self.mainGrid.addWidget(self.c_widgetSetting, 0, 0)
|
||||
@@ -237,7 +237,7 @@ else:
|
||||
start_type(type, item)
|
||||
if isinstance(item, Artist):
|
||||
downloading_item = item.name
|
||||
else:
|
||||
else:
|
||||
downloading_item = item.title
|
||||
model.s_downloadEnd.emit(downloading_item, True, '')
|
||||
except Exception as e:
|
||||
@@ -257,18 +257,18 @@ else:
|
||||
def checkLogin(self):
|
||||
if not loginByConfig():
|
||||
self.__info__('Login failed. Please log in using the command line first.')
|
||||
|
||||
|
||||
def changeTQuality(self, index):
|
||||
SETTINGS.audioQuality = self.c_combTQuality.itemData(index)
|
||||
SETTINGS.save()
|
||||
|
||||
|
||||
def changeVQuality(self, index):
|
||||
SETTINGS.videoQuality = self.c_combVQuality.itemData(index)
|
||||
SETTINGS.save()
|
||||
|
||||
|
||||
def showSettings(self):
|
||||
self.c_widgetSetting.show()
|
||||
|
||||
|
||||
def startGui():
|
||||
aigpy.cmd.enableColor(False)
|
||||
|
||||
|
||||
@@ -6,31 +6,31 @@
|
||||
@Author : Yaronzz
|
||||
@Version : 1.0
|
||||
@Contact : yaronhuang@foxmail.com
|
||||
@Desc :
|
||||
@Desc :
|
||||
'''
|
||||
|
||||
from tidal_dl.lang.arabic import LangArabic
|
||||
from tidal_dl.lang.chinese import LangChinese
|
||||
from tidal_dl.lang.croatian import LangCroatian
|
||||
from tidal_dl.lang.czech import LangCzech
|
||||
from tidal_dl.lang.danish import LangDanish
|
||||
from tidal_dl.lang.dutch import LangDutch
|
||||
from tidal_dl.lang.english import LangEnglish
|
||||
from tidal_dl.lang.filipino import LangFilipino
|
||||
from tidal_dl.lang.french import LangFrench
|
||||
from tidal_dl.lang.german import LangGerman
|
||||
from tidal_dl.lang.hungarian import LangHungarian
|
||||
from tidal_dl.lang.italian import LangItalian
|
||||
from tidal_dl.lang.norwegian import LangNorwegian
|
||||
from tidal_dl.lang.polish import LangPolish
|
||||
from tidal_dl.lang.portuguese import LangPortuguese
|
||||
from tidal_dl.lang.russian import LangRussian
|
||||
from tidal_dl.lang.spanish import LangSpanish
|
||||
from tidal_dl.lang.turkish import LangTurkish
|
||||
from tidal_dl.lang.ukrainian import LangUkrainian
|
||||
from tidal_dl.lang.vietnamese import LangVietnamese
|
||||
from tidal_dl.lang.korean import LangKorean
|
||||
from tidal_dl.lang.japanese import LangJapanese
|
||||
from lang.arabic import LangArabic
|
||||
from lang.chinese import LangChinese
|
||||
from lang.croatian import LangCroatian
|
||||
from lang.czech import LangCzech
|
||||
from lang.danish import LangDanish
|
||||
from lang.dutch import LangDutch
|
||||
from lang.english import LangEnglish
|
||||
from lang.filipino import LangFilipino
|
||||
from lang.french import LangFrench
|
||||
from lang.german import LangGerman
|
||||
from lang.hungarian import LangHungarian
|
||||
from lang.italian import LangItalian
|
||||
from lang.norwegian import LangNorwegian
|
||||
from lang.polish import LangPolish
|
||||
from lang.portuguese import LangPortuguese
|
||||
from lang.russian import LangRussian
|
||||
from lang.spanish import LangSpanish
|
||||
from lang.turkish import LangTurkish
|
||||
from lang.ukrainian import LangUkrainian
|
||||
from lang.vietnamese import LangVietnamese
|
||||
from lang.korean import LangKorean
|
||||
from lang.japanese import LangJapanese
|
||||
|
||||
_ALL_LANGUAGE_ = [
|
||||
['English', LangEnglish()],
|
||||
@@ -66,7 +66,7 @@ class Language(object):
|
||||
return int(str)
|
||||
except:
|
||||
return 0
|
||||
|
||||
|
||||
def setLang(self, index):
|
||||
index = self.__toInt__(index)
|
||||
if index >= 0 and index < len(_ALL_LANGUAGE_):
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
@Author : Yaronzz
|
||||
@Version : 1.0
|
||||
@Contact : yaronhuang@foxmail.com
|
||||
@Desc :
|
||||
@Desc :
|
||||
"""
|
||||
import os
|
||||
import aigpy
|
||||
import datetime
|
||||
|
||||
from tidal_dl.tidal import *
|
||||
from tidal_dl.settings import *
|
||||
from tidal import *
|
||||
from settings import *
|
||||
|
||||
|
||||
def __fixPath__(name: str):
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
@Author : Yaronzz
|
||||
@Version : 3.0
|
||||
@Contact : yaronhuang@foxmail.com
|
||||
@Desc :
|
||||
@Desc :
|
||||
'''
|
||||
from pickle import GLOBAL
|
||||
import threading
|
||||
@@ -14,12 +14,12 @@ import aigpy
|
||||
import logging
|
||||
import prettytable
|
||||
|
||||
import tidal_dl.apiKey as apiKey
|
||||
import apiKey as apiKey
|
||||
|
||||
from tidal_dl.model import *
|
||||
from tidal_dl.paths import *
|
||||
from tidal_dl.settings import *
|
||||
from tidal_dl.lang.language import *
|
||||
from model import *
|
||||
from paths import *
|
||||
from settings import *
|
||||
from lang.language import *
|
||||
|
||||
|
||||
VERSION = '2022.10.31.1'
|
||||
@@ -32,9 +32,9 @@ __LOGO__ = f'''
|
||||
| $$ | $$| $$ | $$ /$$__ $$| $$ | $$ | $$| $$
|
||||
| $$ | $$| $$$$$$$| $$$$$$$| $$ | $$$$$$$| $$
|
||||
|__/ |__/ \_______/ \_______/|__/ \_______/|__/
|
||||
|
||||
https://github.com/yaronzz/Tidal-Media-Downloader
|
||||
|
||||
|
||||
https://github.com/yaronzz/Tidal-Media-Downloader
|
||||
|
||||
{VERSION}
|
||||
'''
|
||||
|
||||
@@ -56,7 +56,7 @@ class Printf(object):
|
||||
for item in rows:
|
||||
tb.add_row(item)
|
||||
return tb
|
||||
|
||||
|
||||
@staticmethod
|
||||
def usage():
|
||||
print("=============TIDAL-DL HELP==============")
|
||||
@@ -70,7 +70,7 @@ class Printf(object):
|
||||
["-r or --resolution", "video resolution('P1080', 'P720', 'P480', 'P360')"]
|
||||
])
|
||||
print(tb)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def checkVersion():
|
||||
onlineVer = aigpy.pip.getLastVersion('tidal-dl')
|
||||
@@ -90,11 +90,11 @@ class Printf(object):
|
||||
[LANG.select.SETTING_PLAYLIST_FOLDER_FORMAT, data.playlistFolderFormat],
|
||||
[LANG.select.SETTING_TRACK_FILE_FORMAT, data.trackFileFormat],
|
||||
[LANG.select.SETTING_VIDEO_FILE_FORMAT, data.videoFileFormat],
|
||||
|
||||
|
||||
#settings - quality
|
||||
[LANG.select.SETTING_AUDIO_QUALITY, data.audioQuality],
|
||||
[LANG.select.SETTING_VIDEO_QUALITY, data.videoQuality],
|
||||
|
||||
|
||||
#settings - else
|
||||
[LANG.select.SETTING_USE_PLAYLIST_FOLDER, data.usePlaylistFolder],
|
||||
[LANG.select.SETTING_CHECK_EXIST, data.checkExist],
|
||||
@@ -135,7 +135,7 @@ class Printf(object):
|
||||
aigpy.cmd.colorPrint(string, aigpy.cmd.TextColor.Yellow, None)
|
||||
ret = input("")
|
||||
return ret
|
||||
|
||||
|
||||
@staticmethod
|
||||
def enterBool(string):
|
||||
aigpy.cmd.colorPrint(string, aigpy.cmd.TextColor.Yellow, None)
|
||||
@@ -180,7 +180,7 @@ class Printf(object):
|
||||
print(aigpy.cmd.red(LANG.select.PRINT_ERR + " ") + string)
|
||||
# logging.error(string)
|
||||
print_mutex.release()
|
||||
|
||||
|
||||
@staticmethod
|
||||
def info(string):
|
||||
global print_mutex
|
||||
@@ -295,15 +295,15 @@ class Printf(object):
|
||||
def apikeys(items):
|
||||
print("-------------API-KEYS---------------")
|
||||
tb = prettytable.PrettyTable()
|
||||
tb.field_names = [aigpy.cmd.green('Index'),
|
||||
tb.field_names = [aigpy.cmd.green('Index'),
|
||||
aigpy.cmd.green('Valid'),
|
||||
aigpy.cmd.green('Platform'),
|
||||
aigpy.cmd.green('Platform'),
|
||||
aigpy.cmd.green('Formats'), ]
|
||||
tb.align = 'l'
|
||||
|
||||
|
||||
for index, item in enumerate(items):
|
||||
tb.add_row([str(index),
|
||||
tb.add_row([str(index),
|
||||
aigpy.cmd.green('True') if item["valid"] == "True" else aigpy.cmd.red('False'),
|
||||
item["platform"],
|
||||
item["platform"],
|
||||
item["formats"]])
|
||||
print(tb)
|
||||
|
||||
@@ -12,8 +12,8 @@ import json
|
||||
import aigpy
|
||||
import base64
|
||||
|
||||
from tidal_dl.lang.language import *
|
||||
from tidal_dl.enums import *
|
||||
from lang.language import *
|
||||
from enums import *
|
||||
|
||||
|
||||
class Settings(aigpy.model.ModelBase):
|
||||
@@ -61,7 +61,7 @@ class Settings(aigpy.model.ModelBase):
|
||||
if item.name == value:
|
||||
return item
|
||||
return VideoQuality.P360
|
||||
|
||||
|
||||
def read(self, path):
|
||||
self._path_ = path
|
||||
txt = aigpy.file.getContent(self._path_)
|
||||
@@ -83,7 +83,7 @@ class Settings(aigpy.model.ModelBase):
|
||||
self.videoFileFormat = self.getDefaultPathFormat(Type.Video)
|
||||
if self.apiKeyIndex is None:
|
||||
self.apiKeyIndex = 0
|
||||
|
||||
|
||||
LANG.setLang(self.language)
|
||||
|
||||
def save(self):
|
||||
|
||||
@@ -17,9 +17,9 @@ import base64
|
||||
import requests
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from tidal_dl.model import *
|
||||
from tidal_dl.enums import *
|
||||
from tidal_dl.settings import *
|
||||
from model import *
|
||||
from enums import *
|
||||
from settings import *
|
||||
|
||||
# SSL Warnings | retry number
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
@@ -341,7 +341,7 @@ class TidalAPI(object):
|
||||
|
||||
tracks.append(track_urls)
|
||||
return tracks
|
||||
|
||||
|
||||
def getStreamUrl(self, id, quality: AudioQuality):
|
||||
squality = "HI_RES"
|
||||
if quality == AudioQuality.Normal:
|
||||
@@ -378,7 +378,7 @@ class TidalAPI(object):
|
||||
if len(ret.urls) > 0:
|
||||
ret.url = ret.urls[0]
|
||||
return ret
|
||||
|
||||
|
||||
raise Exception("Can't get the streamUrl, type is " + resp.manifestMimeType)
|
||||
|
||||
def getVideoStreamUrl(self, id, quality: VideoQuality):
|
||||
|
||||
Reference in New Issue
Block a user