Skip to content

Commit

Permalink
upload new version
Browse files Browse the repository at this point in the history
  • Loading branch information
yaronzz committed Jan 18, 2022
1 parent 69a7ff6 commit 7627c2a
Show file tree
Hide file tree
Showing 18 changed files with 158 additions and 49 deletions.
Binary file modified TIDALDL-PY/exe/tidal-dl.exe
Binary file not shown.
3 changes: 3 additions & 0 deletions TIDALDL-PY/guiStatic.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include tidal_gui/resource/themeDefault.qss
include tidal_gui/resource/svg/*.svg
include tidal_gui/resource/svg/*/*.svg
2 changes: 1 addition & 1 deletion TIDALDL-PY/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ prettytable==0.7.2
mutagen==1.45.1
psutil==5.7.3
pycryptodome==3.9.9
aigpy==2021.9.10.3
aigpy==2022.01.18.2
lyricsgenius==3.0.1
8 changes: 4 additions & 4 deletions TIDALDL-PY/setup-gui.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from setuptools import setup, find_packages
setup(
name = 'tidal-gui',
version = '1.0.0.4',
version = '2022.01.18.3',
license = "Apache2",
description = "Tidal Music Downloader.",
description = "Tidal Music Downloader-GUI.",

author = 'YaronH',
author_email = "[email protected]",

packages = find_packages(),
packages=find_packages(exclude=['tidal_dl*']),
include_package_data = True,
platforms = "any",
install_requires=["aigpy", "PyQt5", "requests>=2.22.0", "pycryptodome", "pydub", "prettytable", "lyricsgenius"],
install_requires=["tidal-dl", "PyQt5"],
entry_points={'console_scripts': [ 'tidal-gui = tidal_gui:main', ]}
)
7 changes: 4 additions & 3 deletions TIDALDL-PY/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
author='YaronH',
author_email="[email protected]",

packages=find_packages(),
include_package_data=True,
packages=find_packages(exclude=['tidal_gui*']),
include_package_data=False,
platforms="any",
install_requires=["aigpy>=2021.12.10.1", "requests>=2.22.0", "pycryptodome", "pydub", "prettytable", "lyricsgenius"],
install_requires=["aigpy>=2022.01.18.2", "requests>=2.22.0",
"pycryptodome", "pydub", "prettytable", "lyricsgenius"],
entry_points={'console_scripts': ['tidal-dl = tidal_dl:main', ]}
)
2 changes: 1 addition & 1 deletion TIDALDL-PY/tidal_dl/printf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
https://github.com/yaronzz/Tidal-Media-Downloader
'''
VERSION = '2022.01.11.1'
VERSION = '2022.01.18.2'


class Printf(object):
Expand Down
22 changes: 22 additions & 0 deletions TIDALDL-PY/tidal_dl/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,32 @@ def encrypted(stream, srcPath, descPath):
def getAudioQualityList():
return map(lambda quality: quality.name, tidal_dl.enums.AudioQuality)

def getCurAudioQuality():
return CONF.audioQuality.name

def setCurAudioQuality(text):
if CONF.audioQuality.name == text:
return
for item in tidal_dl.enums.AudioQuality:
if item.name == text:
CONF.audioQuality = item
break
Settings.save(CONF)

def getVideoQualityList():
return map(lambda quality: quality.name, tidal_dl.enums.VideoQuality)

def getCurVideoQuality():
return CONF.videoQuality.name

def setCurVideoQuality(text):
if CONF.videoQuality.name == text:
return
for item in tidal_dl.enums.VideoQuality:
if item.name == text:
CONF.videoQuality = item
break
Settings.save(CONF)

def skip(path, url):
if CONF.checkExist and isNeedDownload(path, url) is False:
Expand Down
5 changes: 4 additions & 1 deletion TIDALDL-PY/tidal_gui/control/framelessWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def __createWindowsButtonLayout__(self):

def __clickInValidMoveWidget__(self, x=-1, y=-1) -> bool:
if self.validMoveWidget is None:
return True
return False
if self.clickPos is None:
return False

if x == -1 and y == -1:
x = self.clickPos.x()
y = self.clickPos.y()
Expand Down
4 changes: 4 additions & 0 deletions TIDALDL-PY/tidal_gui/control/scrollWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def __init__(self):
def addWidgetItem(self, widget: QWidget):
self._layout.insertWidget(self._numWidget, widget)
self._numWidget += 1

def delWidgetItem(self, widget: QWidget):
self._layout.removeWidget(widget)
self._numWidget -= 1

def resizeEvent(self, e: QResizeEvent):
super().resizeEvent(e)
Expand Down
5 changes: 2 additions & 3 deletions TIDALDL-PY/tidal_gui/view/mainView.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def __initLeftTab__(self):
layout.addWidget(self._searchBtn)
layout.addWidget(self._taskBtn)
layout.addStretch(1)
layout.addWidget(self._settingsBtn)
layout.addWidget(self._aboutBtn)
# layout.addWidget(self._settingsBtn)
# layout.addWidget(self._aboutBtn)

widget = QWidget()
widget.setLayout(layout)
Expand Down Expand Up @@ -119,6 +119,5 @@ def setSettingsView(self, view):
self.__setContentPage__(view, PageType.Settings)

def setAboutView(self, view: QWidget):
# self.__setContentPage__(view, PageType.About)
self._pages[PageType.About] = view
self._pages[PageType.About].hide()
14 changes: 12 additions & 2 deletions TIDALDL-PY/tidal_gui/view/searchView.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,15 @@ def getSelectedTableIndex(self, stype: Type):
return -1
return array[0].row()

def setTrackQualityItems(self, items: list):
def setTrackQualityItems(self, items: list, curItem = None):
self._trackQualityComboBox.setItems(items)
if curItem is not None:
self._trackQualityComboBox.setCurrentText(curItem)

def setVideoQualityItems(self, items: list):
def setVideoQualityItems(self, items: list, curItem=None):
self._videoQualityComboBox.setItems(items)
if curItem is not None:
self._videoQualityComboBox.setCurrentText(curItem)

def getTrackQualityText(self):
return self._trackQualityComboBox.currentText()
Expand All @@ -222,3 +226,9 @@ def connectButton(self, name: str, func):

def connectTab(self, func):
self._tabWidget.currentChanged.connect(func)

def connectQualityComboBox(self, name: str, func):
if name == 'track':
self._trackQualityComboBox.currentIndexChanged.connect(func)
else:
self._videoQualityComboBox.currentIndexChanged.connect(func)
19 changes: 11 additions & 8 deletions TIDALDL-PY/tidal_gui/view/taskView.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from tidal_gui.theme import getResourcePath


class TaskListType(Enum):
class TaskStatus(Enum):
Download = 0,
Complete = 1,
Error = 2,
Expand All @@ -33,28 +33,28 @@ def __init__(self):
self._listMap = {}
self._pageMap = {}

for item in map(lambda typeItem: typeItem.name, TaskListType):
for item in map(lambda typeItem: typeItem.name, TaskStatus):
self._listMap[item] = ScrollWidget()
self._pageMap[item] = QWidget()

self.__initView__()
self._listTab.setCurrentRow(0)
self._pageMap[TaskListType.Download.name].show()
self._pageMap[TaskStatus.Download.name].show()

def __initView__(self):
grid = QGridLayout(self)
grid.addLayout(self.__initLefTab__(), 0, 0, Qt.AlignLeft)
for item in map(lambda typeItem: typeItem.name, TaskListType):
for item in map(lambda typeItem: typeItem.name, TaskStatus):
grid.addWidget(self.__createContent__(item), 0, 1)

def __initLefTab__(self):
self._listTab = ListWidget(ListWidgetStyle.TaskTab)
self._listTab.setIconSize(QSize(20, 20))

iconPath = getResourcePath() + "/svg/taskTab/"
self._listTab.addIConTextItem(iconPath + 'download.svg', TaskListType.Download.name)
self._listTab.addIConTextItem(iconPath + 'complete.svg', TaskListType.Complete.name)
self._listTab.addIConTextItem(iconPath + 'error.svg', TaskListType.Error.name)
self._listTab.addIConTextItem(iconPath + 'download.svg', TaskStatus.Download.name)
self._listTab.addIConTextItem(iconPath + 'complete.svg', TaskStatus.Complete.name)
self._listTab.addIConTextItem(iconPath + 'error.svg', TaskStatus.Error.name)

self._listTab.itemClicked.connect(self.__tabItemChanged__)

Expand Down Expand Up @@ -83,5 +83,8 @@ def __tabItemChanged__(self, item: QListWidgetItem):
else:
self._pageMap[name].hide()

def addItemView(self, stype: TaskListType, view):
def addItemView(self, stype: TaskStatus, view):
self._listMap[stype.name].addWidgetItem(view)

def delItemView(self, stype: TaskStatus, view):
self._listMap[stype.name].delWidgetItem(view)
9 changes: 7 additions & 2 deletions TIDALDL-PY/tidal_gui/viewModel/downloadItemModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pickle import FALSE
from aigpy.downloadHelper import UserProgress
import aigpy.stringHelper
from PyQt5.QtCore import pyqtSignal

from tidal_dl.model import Track
from tidal_dl.util import downloadTrack, downloadVideo, getArtistsNames, setMetaData
Expand Down Expand Up @@ -60,6 +61,8 @@ def updateStream(self, stream):


class DownloadItemModel(ViewModel):
SIGNAL_END = pyqtSignal(DownloadStatus)

def __init__(self, index, data, basePath):
super(DownloadItemModel, self).__init__()
self.view = DownloadItemView()
Expand Down Expand Up @@ -94,11 +97,13 @@ def __setStatus__(self, status: DownloadStatus, desc: str = ''):
self.view.setAction(status.name)
else:
self.view.setAction(status.name + '-' + desc)
if status in _endStatus_:
self.SIGNAL_END.emit(status)


def __setErrStatus__(self, errmsg: str):
self.status = DownloadStatus.ERROR
self.view.setAction(self.status.name)
self.view.setErrmsg(errmsg)
self.__setStatus__(DownloadStatus.ERROR)

def __initTrack__(self, index):
title = self.data.title
Expand Down
2 changes: 1 addition & 1 deletion TIDALDL-PY/tidal_gui/viewModel/mainModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def __init__(self):
downloadImp.start()

def uninit(self):
self.taskModel.stopDownloadItem()
self.taskModel.uninit()
downloadImp.stop()

def show(self, relogin: bool = False):
Expand Down
14 changes: 11 additions & 3 deletions TIDALDL-PY/tidal_gui/viewModel/searchModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import tidal_dl
from tidal_dl import Type
from tidal_dl.util import API, getAudioQualityList, getVideoQualityList
from tidal_dl.util import API, getAudioQualityList, getCurAudioQuality, getCurVideoQuality, getVideoQualityList, setCurAudioQuality, setCurVideoQuality
from tidal_gui.view.searchView import SearchView
from tidal_gui.viewModel.viewModel import ViewModel

Expand All @@ -32,12 +32,14 @@ def __init__(self):

self.view = SearchView()
self.view.setPageIndex(1, 1)
self.view.setTrackQualityItems(getAudioQualityList())
self.view.setVideoQualityItems(getVideoQualityList())
self.view.setTrackQualityItems(getAudioQualityList(), getCurAudioQuality())
self.view.setVideoQualityItems(getVideoQualityList(), getCurVideoQuality())
self.view.connectButton('search', self.__search__)
self.view.connectButton('prePage', self.__searchPre__)
self.view.connectButton('nextPage', self.__searchNext__)
self.view.connectButton('download', self.__download__)
self.view.connectQualityComboBox('track', self.__changeAudioQuality__)
self.view.connectQualityComboBox('video', self.__changeVideoQuality__)
self.view.connectTab(lambda: self.__search__(0))
self.SIGNAL_REFRESH_VIEW.connect(self.__refresh__)

Expand Down Expand Up @@ -149,3 +151,9 @@ def __download__(self):
return

self.SIGNAL_ADD_TASKITEM.emit(items[index])

def __changeAudioQuality__(self):
setCurAudioQuality(self.view.getTrackQualityText())

def __changeVideoQuality__(self):
setCurVideoQuality(self.view.getVideoQualityText())
20 changes: 19 additions & 1 deletion TIDALDL-PY/tidal_gui/viewModel/taskItemModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
@Desc :
"""
import _thread
from asyncio import tasks
from enum import Enum
import os
import time

Expand All @@ -18,7 +20,8 @@
from tidal_dl.model import Album, Track, Video, Playlist
from tidal_dl.util import API, getArtistsNames, getBasePath, getDurationString
from tidal_gui.view.taskItemView import TaskItemView
from tidal_gui.viewModel.downloadItemModel import DownloadItemModel
from tidal_gui.view.taskView import TaskStatus
from tidal_gui.viewModel.downloadItemModel import DownloadItemModel, DownloadStatus
from tidal_gui.viewModel.viewModel import ViewModel


Expand Down Expand Up @@ -46,6 +49,21 @@ def __init__(self, data):

self.SIGNAL_REFRESH_VIEW.connect(self.__refresh__)

def getTaskStatus(self) -> TaskStatus:
if len(self.downloadModelList) <= 0:
return TaskStatus.Download

errorNum = 0
for item in self.downloadModelList:
if item.status in [DownloadStatus.WAIT, DownloadStatus.RUNNING, DownloadStatus.CANCEL]:
return TaskStatus.Download
elif item.status == DownloadStatus.ERROR:
errorNum += 1

if errorNum > 0:
return TaskStatus.Error
return TaskStatus.Complete

def __refresh__(self, stype: str, obj):
if stype == "setPic":
self.view.setPic(obj)
Expand Down
Loading

0 comments on commit 7627c2a

Please sign in to comment.