From 43affae259cd8ac811dbc5bf66bc01f500d07e17 Mon Sep 17 00:00:00 2001 From: "Casu Al Snek ( Sabin )" Date: Mon, 3 Oct 2022 14:11:14 +0545 Subject: [PATCH] Fix logging and crashes for new users Fix logging and crashes for new users. Add .spec file and build.sh to generate binaries ! --- build.sh | 9 ++++++ config.py | 1 - onthespot.py | 80 +++++++++++++++++++++++------------------------- requirements.txt | 25 ++++++++++++--- runtimedata.py | 6 ++-- spotutils.py | 20 ++++++------ utils.py | 32 +++++++++---------- 7 files changed, 96 insertions(+), 77 deletions(-) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..132fa19 --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash +rm -rf ./dist +rm -rf ./build +python3 -m venv venv +source ./venv/bin/activate +pip install pyinstaller +pip install -r requirements.txt +pyinstaller build.spec +chmod +x ./dist/onthespot \ No newline at end of file diff --git a/config.py b/config.py index 5e24ebc..1d7e034 100644 --- a/config.py +++ b/config.py @@ -34,7 +34,6 @@ def __init__(self, cfg_path=None): with open(self.__cfg_path, "w") as cf: cf.write(json.dumps(self.__template_data)) self.__config = self.__template_data - os.makedirs(os.path.dirname(self.get("dlid_cache")), exist_ok=True) os.makedirs(self.get("download_root"), exist_ok=True) os.makedirs(os.path.dirname(self.get("log_file")), exist_ok=True) diff --git a/onthespot.py b/onthespot.py index e409d08..6d800be 100644 --- a/onthespot.py +++ b/onthespot.py @@ -12,19 +12,18 @@ logger = get_logger("onethespot") - class LoadSessions(QObject): finished = pyqtSignal() progress = pyqtSignal(str) def run(self): - logger.debug("Session loader has started !") + logger.info("Session loader has started !") accounts = config.get("accounts") t = len(accounts) c = 0 for account in accounts: c = c + 1 - logger.debug(f"Trying to create session for {account[0][:4]}") + logger.info(f"Trying to create session for {account[0][:4]}") self.progress.emit("Attempting to create session for:\n"+account[0]+" [ {c}/{t} ]".format( c=c, t=t @@ -58,7 +57,7 @@ class ParsingQueueProcessor(QObject): enqueue = pyqtSignal(list) def run(self): - logger.debug("Parsing queue processor is active !") + logger.info("Parsing queue processor is active !") while not self.stop: entry = self.queue.get() # a="album", b=album, c=itemname, d=Silent @@ -72,7 +71,7 @@ def run(self): artist, album_release_date, album_name, total_tracks = get_album_name(session_pool[config.get("parsing_acc_sn")-1], entry[1]["id"]) tracks = get_album_tracks(session_pool[config.get("parsing_acc_sn")-1], entry[1]["id"]) for track in tracks: - logger.debug(f"PQP parsing album : {album_name}:{entry[1]['id']}, track item: {track['name']}:{track['id']}") + logger.info(f"PQP parsing album : {album_name}:{entry[1]['id']}, track item: {track['name']}:{track['id']}") exp = "" if track["explicit"]: exp = "[ 18+ ]" @@ -90,7 +89,7 @@ def run(self): artist, album_release_date, album_name, total_tracks = get_album_name(session_pool[config.get("parsing_acc_sn")-1], album_id) tracks = get_album_tracks(session_pool[config.get("parsing_acc_sn")-1], album_id) for track in tracks: - logger.debug(f"PQP parsing artist : {artist}:{entry[1]['id']}, album item: {album_name}:{album_id} ,track item: {track['name']}:{track['id']}") + logger.info(f"PQP parsing artist : {artist}:{entry[1]['id']}, album item: {album_name}:{album_id} ,track item: {track['name']}:{track['id']}") exp = "" if track["explicit"]: exp = "[ 18+ ]" @@ -103,14 +102,14 @@ def run(self): self.progress.emit("Episodes are being parsed and will be added to download queue shortly !") for episode_id in get_show_episodes(session_pool[config.get("parsing_acc_sn")-1], entry[1]["id"]): podcast_name, episode_name = get_episode_info(session_pool[config.get("parsing_acc_sn")-1], episode_id) - logger.debug(f"PQP parsing podcast : {podcast_name}:{entry[1]['id']}, epiode item: {episode_name}:{episode_id}") + logger.info(f"PQP parsing podcast : {podcast_name}:{entry[1]['id']}, epiode item: {episode_name}:{episode_id}") showname = podcast_name self.enqueue.emit([[name, name, f"Podcast [{podcast_name}]"], "episode", episode_id, ""]) if not entry[3]: self.progress.emit(f"Added show '{showname}' to download queue!") elif entry[0] == "episode": podcast_name, episode_name = get_episode_info(session_pool[config.get("parsing_acc_sn")-1], entry[1]["id"]) - logger.debug(f"PQP parsing podcast episode : {episode_name}:{entry[1]['id']}") + logger.info(f"PQP parsing podcast episode : {episode_name}:{entry[1]['id']}") if not entry[3]: self.progress.emit(f"Adding episode '{episode_name}' of '{podcast_name}' to download queue !") self.enqueue.emit([[name, name, f"Podcast [{podcast_name}]"], "episode", entry[1]["id"], ""]) @@ -124,7 +123,7 @@ def run(self): playlist_songs = get_tracks_from_playlist(session_pool[config.get("parsing_acc_sn")-1], entry[1]['id']) for song in playlist_songs: if song['track']['id'] is not None: - logger.debug(f"PQP parsing playlist : {entry[1]['id']}, track item: {song['track']['name']}:{song['track']['id']}") + logger.info(f"PQP parsing playlist : {entry[1]['id']}, track item: {song['track']['name']}:{song['track']['id']}") exp = "" if song['track']["explicit"]: exp = "[ 18+ ]" @@ -139,7 +138,7 @@ def run(self): self.progress.emit("Adding track '{itemname}' to download queue !".format( itemname=entry[2].strip() )) - logger.debug(f"PQP parsinf track : {entry[2].strip()}:{entry[1]['id']}") + logger.info(f"PQP parsinf track : {entry[2].strip()}:{entry[1]['id']}") self.enqueue.emit([[entry[2].strip(), f"{','.join([artist['name'] for artist in entry[1]['artists']])}", "Track"], "track", entry[1]["id"], "", config.get("playlist_track_force_album_dir")]) if not entry[3]: self.progress.emit("Added track '{itemname}' to download queue !".format( @@ -157,7 +156,7 @@ def __init__(self): super(MainWindow, self).__init__() self.path = os.path.dirname(os.path.realpath(__file__)) uic.loadUi(os.path.join(self.path, "ui", "main.ui"), self) - logger.debug("Initialising main window") + logger.info("Initialising main window") self.btn_save_config.clicked.connect(self.__update_config) self.btn_save_adv_config.clicked.connect(self.__update_config) self.btn_login_add.clicked.connect(self.__add_account) @@ -177,15 +176,15 @@ def __init__(self): self.__downloads_status = {} self.__last_search_data = None - logger.debug("Loading configurations..") + logger.info("Loading configurations..") # Fill the value from configs self.__fill_configs() self.__advanced_visible = False self.tabview.setTabVisible(1, self.__advanced_visible) - self.__splash_dialog = MiniDialog(self) + self.__splash_dialog = _dialog - logger.debug("Preparing session loader") + logger.info("Preparing session loader") # Try logging in to sessions self.__session_builder_thread = QThread() self.__session_builder_worker = LoadSessions() @@ -199,7 +198,7 @@ def __init__(self): self.__session_builder_worker.progress.connect(self.__show_popup_dialog) self.__session_builder_thread.start() - logger.debug("Preparing parsing queue processor") + logger.info("Preparing parsing queue processor") # Create media queue processor self.__media_parser_thread = QThread() self.__media_parser_worker = ParsingQueueProcessor() @@ -214,7 +213,7 @@ def __init__(self): self.__media_parser_worker.enqueue.connect(self.__add_item_to_downloads) self.__media_parser_thread.start() - logger.debug("Setting table item properties") + logger.info("Setting table item properties") tbl_sessions_header = self.tbl_sessions.horizontalHeader() tbl_sessions_header.setSectionResizeMode(0, QHeaderView.Stretch) tbl_sessions_header.setSectionResizeMode(1, QHeaderView.Stretch) @@ -232,7 +231,7 @@ def __init__(self): tbl_dl_progress_header.setSectionResizeMode(1, QHeaderView.ResizeToContents) tbl_dl_progress_header.setSectionResizeMode(3, QHeaderView.ResizeToContents) tbl_dl_progress_header.setSectionResizeMode(5, QHeaderView.ResizeToContents) - logger.debug("Main window init completed !") + logger.info("Main window init completed !") def __select_dir(self): dir_path = QFileDialog.getExistingDirectory(None, 'Select a folder:', os.path.expanduser("~")) @@ -249,11 +248,11 @@ def __dl_progress(self, data): try: if status is not None: self.__downloads_status[media_id]["status_label"].setText(status) - logger.info(f"Updating status text for download item '{media_id}' to '{status}'") + logger.debug(f"Updating status text for download item '{media_id}' to '{status}'") if progress is not None: percent = int((progress[0]/progress[1])*100) self.__downloads_status[media_id]["progress_bar"].setValue(percent) - logger.info(f"Updating progresbar for download item '{media_id}' to '{percent}'%") + logger.debug(f"Updating progresbar for download item '{media_id}' to '{percent}'%") except KeyError: logger.error(f"Why TF we get here ?, Got progressbar update for media_id '{media_id}' which does not seem to exist !!! -> Valid Status items: {str( [_media_id for _media_id in self.__downloads_status] )} ") except Exception: @@ -266,7 +265,7 @@ def __add_item_to_downloads(self, item): pbar.setMinimumHeight(30) status = QLabel(self.tbl_dl_progress) status.setText("Waiting") - logger.debug(f"Adding item to download queue -> media_type:{item[1]}, media_id: {item[2]}, extra_path:{item[3]}, prefix: 1, Prefixvalue: '' ") + logger.info(f"Adding item to download queue -> media_type:{item[1]}, media_id: {item[2]}, extra_path:{item[3]}, prefix: 1, Prefixvalue: '' ") # Submit to download queue # [ media_type, Media_id, extra_path, Prefix, Prefixvalue ] try: @@ -304,7 +303,7 @@ def __user_table_remove_click(self): index = self.tbl_sessions.indexAt(button.pos()) logger.debug("Clicked account remove button !") if index.isValid(): - logger.debug("Removed cicked for valid item ->"+self.tbl_sessions.item(index.row(), 0).text()) + logger.info("Removed cicked for valid item ->"+self.tbl_sessions.item(index.row(), 0).text()) username = self.tbl_sessions.item(index.row(), 0).text() removed = remove_user(username, os.path.join(os.path.expanduser("~"), ".cache", "casualOnTheSpot", "sessions"), config) if removed: @@ -330,16 +329,16 @@ def __generate_users_table(self, userdata): self.tbl_sessions.setItem(rows, 1, QTableWidgetItem(user[1])) self.tbl_sessions.setItem(rows, 2, QTableWidgetItem(user[2])) self.tbl_sessions.setCellWidget(rows, 3, btn) - logger.debug("Accounts table was populated !") + logger.info("Accounts table was populated !") def __rebuild_threads(self): # Wait for all threads to close then rebuild threads - logger.debug("Building downloader threads") + logger.info("Building downloader threads") if len(session_pool) > 0: - logger.debug("Session pool not empty ! Reset not implemented") + logger.warning("Session pool not empty ! Reset not implemented") if len(thread_pool) == 0: # Build threads now - logger.debug(f"Spwaning {config.get('max_threads')} downloaders !") + logger.info(f"Spwaning {config.get('max_threads')} downloaders !") for i in range(0, config.get("max_threads")): session_index = None t_index = i @@ -349,7 +348,7 @@ def __rebuild_threads(self): else: session_index = t_index item = [DownloadWorker(), QThread()] - logger.debug(f"Spwaning DL WORKER {str(i+1)} using session_index: {t_index}") + logger.info(f"Spwaning DL WORKER {str(i+1)} using session_index: {t_index}") item[0].setup(thname="DL WORKER "+str(i+1), session=session_pool[t_index], queue_tracks=download_queue) item[0].moveToThread(item[1]) item[1].started.connect(item[0].run) @@ -396,7 +395,7 @@ def __fill_configs(self): self.inp_force_track_dir.setChecked(True) else: self.inp_force_track_dir.setChecked(False) - logger.debug("Config filled to UI") + logger.info("Config filled to UI") def __update_config(self): if config.get("max_threads") != self.inp_max_threads.value(): @@ -432,13 +431,13 @@ def __update_config(self): config.set_("force_premium", False) config.update() - logger.debug("Config updated !") + logger.info("Config updated !") def __add_account(self): - logger.debug("Add account clicked ") + logger.info("Add account clicked ") if self.inp_login_username.text().strip() in [ user[0] for user in config.get('accounts')]: self.__splash_dialog.run("The account '{}' is already added !".format(self.inp_login_username.text().strip())) - logger.debug("Account already exists "+self.inp_login_username.text().strip()) + logger.warning("Account already exists "+self.inp_login_username.text().strip()) if self.inp_login_username.text().strip() != "" and self.inp_login_password.text() != "": logger.debug("Credentials are not empty ! ") login = login_user(self.inp_login_username.text().strip(), self.inp_login_password.text(), os.path.join(os.path.expanduser("~"), ".cache", "casualOnTheSpot", "sessions")) @@ -455,19 +454,19 @@ def __add_account(self): config.update() session_pool.append(login[1]) self.__splash_dialog.run("Loggedin successfully ! \n You need to restart application to be able to use this account. ") - logger.debug(f"Account {self.inp_login_username.text().strip()} added successfully") + logger.info(f"Account {self.inp_login_username.text().strip()} added successfully") self.__users.append([ self.inp_login_username.text().strip(), "Premuim" if login[3] else "Free", "OK"]) self.__generate_users_table(self.__users) else: logger.error(f"Accouunt add failed for : {self.inp_login_username.text().strip()}") self.__splash_dialog.run("Login failed ! Probably invalid username or passowrd.") else: - logger.debug("Credentials are empty >-< ") + logger.info("Credentials are empty >-< ") self.__splash_dialog.run("Please enter username/password to log in !") def __get_search_results(self): search_term = self.inp_search_term.text().strip() - logger.debug(f"Search clicked with value {search_term}") + logger.info(f"Search clicked with value {search_term}") if len(session_pool) <= 0: self.__splash_dialog.run("You need to login to at least one account to use this feature !") return None @@ -483,13 +482,13 @@ def __get_search_results(self): def __download_by_url(self): url = self.inp_dl_url.text().strip() - logger.debug(f"URL download clicked with value {url}") + logger.info(f"URL download clicked with value {url}") media_type, media_id = get_url_data(url) if media_type is None: self.__splash_dialog.run("Unable to determine the type of URL !") return False if len(session_pool) <= 0: - logger.debug(f"LMAO user needs to login before downloading or making search query") + logger.info(f"LMAO user needs to login before downloading or making search query") self.__splash_dialog.run("You need to login to at least one account to use this feature !") return False data = { @@ -580,7 +579,7 @@ def __populate_search_results(self, data): def __mass_action_dl(self, result_type): data = self.__last_search_data downloaded_types = [] - logger.debug(f"Mass download for {result_type} was clicked.. Here hangs up the applicationn") + logger.info(f"Mass download for {result_type} was clicked.. Here hangs up the applicationn") if data is None: self.__splash_dialog.run("No search results to download !") else: @@ -611,10 +610,6 @@ def __init__(self, parent=None): self.path = os.path.dirname(os.path.realpath(__file__)) uic.loadUi(os.path.join(self.path, "ui", "notice.ui"), self) self.btn_close.clicked.connect(self.hide) - self.setWindowFlags( - Qt.Popup | - Qt.WindowStaysOnTopHint - ) logger.debug("Dialog item is ready..") def run(self, content): @@ -623,8 +618,9 @@ def run(self, content): self.lb_main.setText(str(content)) if __name__ == "__main__": - logger.debug("Starting application in 3...2....1") + logger.info("Starting application in 3...2....1") app = QApplication(sys.argv) + _dialog = MiniDialog() window = MainWindow() app.exec_() - logger.debug("Goodbyee..") + logger.info("Goodbyee..") diff --git a/requirements.txt b/requirements.txt index c2dabb7..ca86a21 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,20 @@ -pyqt5 -librespot -requests -pydub -music_tag +async-timeout==4.0.2 +certifi==2022.9.24 +charset-normalizer==2.1.1 +defusedxml==0.7.1 +idna==3.4 +ifaddr==0.2.0 +librespot==0.0.6 +music-tag==0.4.3 +mutagen==1.45.1 +protobuf==3.20.1 +pycryptodomex==3.15.0 +pydub==0.25.1 +PyOgg==0.6.14a1 +PyQt5==5.15.7 +PyQt5-Qt5==5.15.2 +PyQt5-sip==12.11.0 +requests==2.28.1 +urllib3==1.26.12 +websocket-client==1.4.0 +zeroconf==0.39.0 diff --git a/runtimedata.py b/runtimedata.py index 988fabd..a6af761 100644 --- a/runtimedata.py +++ b/runtimedata.py @@ -2,7 +2,7 @@ import logging from config import config import logging -import sys +import sys, os import logging from logging.handlers import RotatingFileHandler @@ -15,12 +15,12 @@ download_queue = Queue() thread_pool = [] session_pool = [] - +loglevel = int(os.environ.get("LOGLEVEL", 20)) def get_logger(name): logger = logging.getLogger(name) logger.addHandler(log_handler) logger.addHandler(stdout_handler) - logger.setLevel(logging.DEBUG) + logger.setLevel(loglevel) return logger def handle_exception(exc_type, exc_value, exc_traceback): diff --git a/spotutils.py b/spotutils.py index 720dc87..708bb59 100644 --- a/spotutils.py +++ b/spotutils.py @@ -148,7 +148,7 @@ def search_by_term(session, search_term, max_results=20)->dict: "artists": resp.json()["artists"]["items"], } if len(results["tracks"]) + len(results["albums"]) + len(results["artists"]) + len(results["playlists"]) == 0: - logger.debug(f"No results for term '{search_term}', max items '{max_results}'") + logger.warning(f"No results for term '{search_term}', max items '{max_results}'") raise EmptySearchResultException("No result found for search term '{}' ".format(search_term)) else: return results @@ -254,7 +254,7 @@ def download_track(self, session, track_id_str, extra_paths="", prefix=False, pr else: if os.path.isfile(filename) and os.path.getsize(filename) and SKIP_EXISTING_FILES: self.progress.emit([track_id_str, "Already exists", [100, 100]]) - logger.debug(f"File already exists, Skipping download for track by id '{track_id_str}'") + logger.info(f"File already exists, Skipping download for track by id '{track_id_str}'") return False else: if track_id_str != scraped_song_id: @@ -271,7 +271,7 @@ def download_track(self, session, track_id_str, extra_paths="", prefix=False, pr with open(filename, 'wb') as file: while downloaded < total_size: data = stream.input_stream.stream().read(_CHUNK_SIZE) - logger.info(f"Reading chunk of {_CHUNK_SIZE} bytes for track by id '{track_id_str}'") + logger.debug(f"Reading chunk of {_CHUNK_SIZE} bytes for track by id '{track_id_str}'") downloaded += len(data) if len(data) != 0: file.write(data) @@ -292,7 +292,7 @@ def download_track(self, session, track_id_str, extra_paths="", prefix=False, pr return None self.progress.emit([track_id_str, None, [downloaded, total_size]]) if not config.get("force_raw"): - logger.debug(f"Force raw is disabled for track by id '{track_id_str}', media converting and tagging will be done !") + logger.warning(f"Force raw is disabled for track by id '{track_id_str}', media converting and tagging will be done !") self.progress.emit([track_id_str, "Converting", None]) convert_audio_format(filename, quality) self.progress.emit([track_id_str, "Writing metadata", None]) @@ -328,7 +328,7 @@ def download_track(self, session, track_id_str, extra_paths="", prefix=False, pr return False def download_episode(self, episode_id_str, extra_paths=""): - logger.debug(f"Downloading episode by id '{episode_id_str}'") + logger.info(f"Downloading episode by id '{episode_id_str}'") ROOT_PODCAST_PATH = os.path.join(config.get("download_root"), "Podcasts") quality = AudioQuality.HIGH podcast_name, episode_name = get_episode_info(episode_id_str) @@ -369,22 +369,22 @@ def download_episode(self, episode_id_str, extra_paths=""): self.progress.emit([episode_id_str, "Downloaded", [100, 100]]) return True else: - logger.debug(f"Downloading failed for episode by id '{episode_id_str}', partial download failed !") + logger.error(f"Downloading failed for episode by id '{episode_id_str}', partial download failed !") self.progress.emit([episode_id_str, "Failed", [0, 100]]) return False except: - logger.debug(f"Downloading failed for episode by id '{episode_id_str}', Unexpected Exception: {traceback.format_exc()}") + logger.error(f"Downloading failed for episode by id '{episode_id_str}', Unexpected Exception: {traceback.format_exc()}") self.progress.emit([episode_id_str, "Failed", [0, 100]]) return False def run(self): - logger.debug(f"Download worker {self.name} is running ") + logger.info(f"Download worker {self.name} is running ") while not self.__stop: item = self.__queue.get() attempt = 0 if item[0] == "track": while attempt < config.get("max_retries"): - logger.debug(f"Processing download for track by id '{item[1]}', Attempt: {attempt}") + logger.info(f"Processing download for track by id '{item[1]}', Attempt: {attempt}") attempt = attempt + 1 self.progress.emit([item[1], "Downloading", None]) status = self.download_track( @@ -403,7 +403,7 @@ def run(self): elif item[0] == "episode": while attempt < config.get("max_retries"): - logger.debug(f"Processing download for episode by id '{item[1]}', Attempt: {attempt}") + logger.info(f"Processing download for episode by id '{item[1]}', Attempt: {attempt}") attempt = attempt + 1 self.progress.emit([item[1], "Downloading", None]) status = self.download_episode( diff --git a/utils.py b/utils.py index 4dc1cfa..6b23940 100644 --- a/utils.py +++ b/utils.py @@ -10,14 +10,14 @@ def login_user(username: str, password: str, login_data_dir: str)->list: - logger.debug(f"logging in user '{username[:4]}****@****.***'") + logger.info(f"logging in user '{username[:4]}****@****.***'") # Check the username and if pickled sessionfile exists load the session and append # Returns: [Success: Bool, Session: Session, PicklePath: str, premium: Bool] sessobj_pikpath = os.path.join(login_data_dir, username+"_GUZpotifylogin.json") os.makedirs(os.path.dirname(sessobj_pikpath), exist_ok=True) if os.path.isfile(sessobj_pikpath): - logger.debug(f"Session file exists for user, attempting to use it '{username[:4]}****@****.***'") - logger.info("Restoring user session") + logger.info(f"Session file exists for user, attempting to use it '{username[:4]}****@****.***'") + logger.debug("Restoring user session") # Session exists try loading it try: config = Session.Configuration.Builder().set_stored_credential_file(sessobj_pikpath).build() @@ -27,7 +27,7 @@ def login_user(username: str, password: str, login_data_dir: str)->list: session = Session.Builder(conf=config).stored_file(sessobj_pikpath).create() logger.debug("Session created") premium = True if session.get_user_attribute("type") == "premium" else False - logger.debug(f"Login successful for user '{username[:4]}****@****.***'") + logger.info(f"Login successful for user '{username[:4]}****@****.***'") return [True, session, sessobj_pikpath, premium] except (RuntimeError, Session.SpotifyAuthenticationException): logger.error(f"Failed logging in user '{username[:4]}****@****.***', invalid credentials") @@ -36,14 +36,14 @@ def login_user(username: str, password: str, login_data_dir: str)->list: logger.error(f"Failed to login user '{username[:4]}****@****.***' due to unexpected error: {traceback.format_exc()}") return [False, None, "", False] else: - logger.debug(f"Session file does not exist user '{username[:4]}****@****.***', attempting login with uname/pass") + logger.info(f"Session file does not exist user '{username[:4]}****@****.***', attempting login with uname/pass") try: - logger.debug(f"logging in user '{username[:4]}****@****.***'") + logger.info(f"logging in user '{username[:4]}****@****.***'") config = Session.Configuration.Builder().set_stored_credential_file(sessobj_pikpath).build() print("logging in !") session = Session.Builder(conf=config).user_pass(username, password).create() premium = True if session.get_user_attribute("type") == "premium" else False - logger.debug(f"Login successful for user '{username[:4]}****@****.***'") + logger.info(f"Login successful for user '{username[:4]}****@****.***'") return [True, session, sessobj_pikpath, premium] except (RuntimeError, Session.SpotifyAuthenticationException): logger.error(f"Failed logging in user '{username[:4]}****@****.***', invalid credentials") @@ -54,7 +54,7 @@ def login_user(username: str, password: str, login_data_dir: str)->list: return [False, None, "", False] def remove_user(username: str, login_data_dir: str, config)->bool: - logger.debug(f"Removing user '{username[:4]}****@****.***' from saved entries") + logger.info(f"Removing user '{username[:4]}****@****.***' from saved entries") sessobj_pikpath = os.path.join(login_data_dir, username+"_GUZpotifylogin.json") if os.path.isfile(sessobj_pikpath): os.remove(sessobj_pikpath) @@ -69,14 +69,14 @@ def remove_user(username: str, login_data_dir: str, config)->bool: removed = True break if removed: - logger.debug(f"Saved Account user '{username[:4]}****@****.***' found and removed") + logger.info(f"Saved Account user '{username[:4]}****@****.***' found and removed") config.set_("accounts", accounts_copy) config.update() return removed def regex_input_for_urls(search_input): - logger.debug(f"Parsing url '{search_input}'") + logger.info(f"Parsing url '{search_input}'") track_uri_search = re.search( r"^spotify:track:(?P[0-9a-zA-Z]{22})$", search_input) track_url_search = re.search( @@ -165,22 +165,22 @@ def regex_input_for_urls(search_input): def get_url_data(url): track_id_str, album_id_str, playlist_id_str, episode_id_str, show_id_str, artist_id_str = regex_input_for_urls(url) if track_id_str is not None: - logger.debug(f"Parse result for url '{url}'-> track, {track_id_str}") + logger.info(f"Parse result for url '{url}'-> track, {track_id_str}") return "track", track_id_str elif album_id_str is not None: - logger.debug(f"Parse result for url '{url}'-> album, {album_id_str}") + logger.info(f"Parse result for url '{url}'-> album, {album_id_str}") return "album", album_id_str elif playlist_id_str is not None: - logger.debug(f"Parse result for url '{url}'-> playlist, {playlist_id_str}") + logger.info(f"Parse result for url '{url}'-> playlist, {playlist_id_str}") return "playlist", playlist_id_str elif episode_id_str is not None: - logger.debug(f"Parse result for url '{url}'-> episode, {episode_id_str}") + logger.info(f"Parse result for url '{url}'-> episode, {episode_id_str}") return "episode", episode_id_str elif show_id_str is not None: - logger.debug(f"Parse result for url '{url}'-> podcast, {show_id_str}") + logger.info(f"Parse result for url '{url}'-> podcast, {show_id_str}") return "podcast", show_id_str elif artist_id_str is not None: - logger.debug(f"Parse result for url '{url}'-> artist, {artist_id_str}") + logger.info(f"Parse result for url '{url}'-> artist, {artist_id_str}") return "artist", artist_id_str else: logger.error(f"Parse result for url '{url}' failed, invalid spotify url !")