Skip to content

Commit

Permalink
♻️ Minor renamings.
Browse files Browse the repository at this point in the history
  • Loading branch information
exislow committed Jan 18, 2024
1 parent 1236298 commit 5be6908
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
5 changes: 3 additions & 2 deletions tidal_dl_ng/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ class Tidal(BaseConfig, metaclass=SingletonMeta):
settings: Settings = None

def __init__(self, settings: Settings = None):
self.session = tidalapi.Session()
tidal_config: tidalapi.Config = tidalapi.Config(item_limit=10000)
self.session = tidalapi.Session(tidal_config)
# self.session.config.client_id = "km8T1xS355y7dd3H"
# self.session.config.client_secret = "vcmeGW1OuZ0fWYMCSZ6vNvSLJlT3XEpW0ambgYt5ZuI="
self.session.video_quality = tidalapi.VideoQuality.high
self.file_path = path_file_token()
self.token_from_storage = self.read(self.file_path)
self.login_token()
Expand All @@ -102,6 +102,7 @@ def settings_apply(self, settings: Settings = None) -> bool:
self.settings = settings

self.session.audio_quality = self.settings.data.quality_audio
self.session.video_quality = tidalapi.VideoQuality.high

return True

Expand Down
1 change: 0 additions & 1 deletion tidal_dl_ng/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ def items(
# Iterate through list items
while not progress.finished:
for media in items:
# TODO: Handle return value of `track` method.
# Download the item.
status_download, result_path_file = self.item(
path_base=path_base,
Expand Down
25 changes: 13 additions & 12 deletions tidal_dl_ng/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _init_progressbar(self):
# self.pb_progress.setVisible()
self.statusbar.addPermanentWidget(pb)

def progress_reset(self):
def on_progress_reset(self):
self.pb_list.setValue(0)
self.pb_item.setValue(0)

Expand Down Expand Up @@ -204,6 +204,7 @@ def apply_settings(self, settings: Settings):

for item in l_cb:
idx = item["element"].findText(item["setting"])

if idx > -1:
item["element"].setCurrentIndex(idx)
else:
Expand Down Expand Up @@ -342,37 +343,37 @@ def _init_signals(self):
self.b_search.clicked.connect(
lambda: self.search_populate_results(self.l_search.text(), self.cb_search_type.currentData())
)
self.cb_quality_audio.currentIndexChanged.connect(self.quality_set_audio)
self.cb_quality_video.currentIndexChanged.connect(self.quality_set_video)
self.cb_quality_audio.currentIndexChanged.connect(self.on_quality_set_audio)
self.cb_quality_video.currentIndexChanged.connect(self.on_quality_set_video)
self.tr_lists_user.itemClicked.connect(self.on_list_items_show)
self.spinner_start[QtWidgets.QWidget].connect(self.on_spinner_start)
self.spinner_stop.connect(self.on_spinner_stop)
self.s_item_advance.connect(self.progress_item)
self.s_item_name.connect(self.progress_item_name)
self.s_list_advance.connect(self.progress_list)
self.s_pb_reset.connect(self.progress_reset)
self.s_item_advance.connect(self.on_progress_item)
self.s_item_name.connect(self.on_progress_item_name)
self.s_list_advance.connect(self.on_progress_list)
self.s_pb_reset.connect(self.on_progress_reset)
self.s_populate_tree_lists.connect(self.on_populate_tree_lists)

def progress_list(self, value: float):
def on_progress_list(self, value: float):
self.pb_list.setValue(int(math.ceil(value)))

def progress_item(self, value: float):
def on_progress_item(self, value: float):
self.pb_item.setValue(int(math.ceil(value)))

def progress_item_name(self, value: str):
def on_progress_item_name(self, value: str):
self.pb_item.setFormat(f"%p% {value}")

def progress_list_name(self, value: str):
self.pb_list.setFormat(f"%p% {value}")

def quality_set_audio(self, index):
def on_quality_set_audio(self, index):
self.settings.data.quality_audio = Quality(self.cb_quality_audio.itemData(index).value)
self.settings.save()

if self.tidal:
self.tidal.settings_apply()

def quality_set_video(self, index):
def on_quality_set_video(self, index):
self.settings.data.quality_video = QualityVideo(self.cb_quality_video.itemData(index).value)
self.settings.save()

Expand Down

0 comments on commit 5be6908

Please sign in to comment.