♻️ Removed unnecessary threading and refactored values to constants.
This commit is contained in:
+24
-18
@@ -5,33 +5,39 @@ REQUESTS_TIMEOUT_SEC = 45
|
|||||||
|
|
||||||
|
|
||||||
class QualityVideo(Enum):
|
class QualityVideo(Enum):
|
||||||
P360 = 360
|
P360: int = 360
|
||||||
P480 = 480
|
P480: int = 480
|
||||||
P720 = 720
|
P720: int = 720
|
||||||
P1080 = 1080
|
P1080: int = 1080
|
||||||
|
|
||||||
|
|
||||||
class MediaType(Enum):
|
class MediaType(Enum):
|
||||||
Track = "track"
|
Track: str = "track"
|
||||||
Video = "video"
|
Video: str = "video"
|
||||||
Playlist = "playlist"
|
Playlist: str = "playlist"
|
||||||
Album = "album"
|
Album: str = "album"
|
||||||
Mix = "mix"
|
Mix: str = "mix"
|
||||||
|
|
||||||
|
|
||||||
class SkipExisting(Enum):
|
class SkipExisting(Enum):
|
||||||
Disabled = False
|
Disabled: bool = False
|
||||||
Filename = "exact"
|
Filename: str = "exact"
|
||||||
ExtensionIgnore = "extension_ignore"
|
ExtensionIgnore: str = "extension_ignore"
|
||||||
|
|
||||||
|
|
||||||
class StreamManifestMimeType(Enum):
|
class StreamManifestMimeType(Enum):
|
||||||
MPD = "application/dash+xml"
|
MPD: str = "application/dash+xml"
|
||||||
BTS = "application/vnd.tidal.bts"
|
BTS: str = "application/vnd.tidal.bts"
|
||||||
VIDEO = "video/mp2t"
|
VIDEO: str = "video/mp2t"
|
||||||
|
|
||||||
|
|
||||||
class CoverDimensions(Enum):
|
class CoverDimensions(Enum):
|
||||||
Px320 = "320x320"
|
Px320: str = "320x320"
|
||||||
Px640 = "640x640"
|
Px640: str = "640x640"
|
||||||
Px1280 = "1280x1280"
|
Px1280: str = "1280x1280"
|
||||||
|
|
||||||
|
|
||||||
|
class TidalLists(Enum):
|
||||||
|
PLAYLISTS = "Playlists"
|
||||||
|
FAVORITES = "Favorites"
|
||||||
|
MIXES = "Mixes"
|
||||||
|
|||||||
+9
-6
@@ -18,7 +18,7 @@ from tidalapi import Album, Mix, Playlist, Quality, Track, UserPlaylist, Video
|
|||||||
from tidalapi.session import SearchTypes
|
from tidalapi.session import SearchTypes
|
||||||
|
|
||||||
from tidal_dl_ng.config import Settings, Tidal
|
from tidal_dl_ng.config import Settings, Tidal
|
||||||
from tidal_dl_ng.constants import QualityVideo
|
from tidal_dl_ng.constants import QualityVideo, TidalLists
|
||||||
from tidal_dl_ng.download import Download
|
from tidal_dl_ng.download import Download
|
||||||
from tidal_dl_ng.logger import XStream, logger_gui
|
from tidal_dl_ng.logger import XStream, logger_gui
|
||||||
from tidal_dl_ng.model.gui_data import ProgressBars, ResultSearch
|
from tidal_dl_ng.model.gui_data import ProgressBars, ResultSearch
|
||||||
@@ -96,7 +96,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
if result:
|
if result:
|
||||||
self.dl = Download(self.tidal.session, self.tidal.settings.data.skip_existing)
|
self.dl = Download(self.tidal.session, self.tidal.settings.data.skip_existing)
|
||||||
|
|
||||||
self.thread_it(self.populate_tree_lists, self.tidal)
|
self.populate_tree_lists(self.tidal)
|
||||||
|
|
||||||
def _init_progressbar(self):
|
def _init_progressbar(self):
|
||||||
self.pb_list = QtWidgets.QProgressBar()
|
self.pb_list = QtWidgets.QProgressBar()
|
||||||
@@ -142,12 +142,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.spinner_start.emit(self.tr_lists_user)
|
self.spinner_start.emit(self.tr_lists_user)
|
||||||
self.tr_results.clear()
|
self.tr_results.clear()
|
||||||
|
|
||||||
# TODO: Refactor list item names to constants.
|
|
||||||
twi_playlists: QtWidgets.QTableWidgetItem = self.tr_lists_user.findItems(
|
twi_playlists: QtWidgets.QTableWidgetItem = self.tr_lists_user.findItems(
|
||||||
"Playlists", QtCore.Qt.MatchExactly, 0
|
TidalLists.PLAYLISTS.value, QtCore.Qt.MatchExactly, 0
|
||||||
|
)[0]
|
||||||
|
twi_mixes: QtWidgets.QTableWidgetItem = self.tr_lists_user.findItems(
|
||||||
|
TidalLists.FAVORITES.value, QtCore.Qt.MatchExactly, 0
|
||||||
|
)[0]
|
||||||
|
twi_favorites: QtWidgets.QTableWidgetItem = self.tr_lists_user.findItems(
|
||||||
|
TidalLists.MIXES.value, QtCore.Qt.MatchExactly, 0
|
||||||
)[0]
|
)[0]
|
||||||
twi_mixes: QtWidgets.QTableWidgetItem = self.tr_lists_user.findItems("Favorites", QtCore.Qt.MatchExactly, 0)[0]
|
|
||||||
twi_favorites: QtWidgets.QTableWidgetItem = self.tr_lists_user.findItems("Mixes", QtCore.Qt.MatchExactly, 0)[0]
|
|
||||||
|
|
||||||
user_playlists: [Playlist | UserPlaylist] = tidal.session.user.playlist_and_favorite_playlists()
|
user_playlists: [Playlist | UserPlaylist] = tidal.session.user.playlist_and_favorite_playlists()
|
||||||
user_mixes: [Mix] = tidal.session.mixes().categories[0].items
|
user_mixes: [Mix] = tidal.session.mixes().categories[0].items
|
||||||
|
|||||||
Reference in New Issue
Block a user