diff --git a/src/onthespot/api/spotify.py b/src/onthespot/api/spotify.py index eabb432..3cf4cbe 100644 --- a/src/onthespot/api/spotify.py +++ b/src/onthespot/api/spotify.py @@ -399,7 +399,8 @@ def spotify_get_search_results(session, search_term, content_types): }, headers={"Authorization": "Bearer %s" % token}, ).json() - + print(",".join(c_type for c_type in content_types)) + print(data) search_results = [] # Iterate over the keys in the response @@ -425,15 +426,15 @@ def spotify_get_search_results(session, search_term, content_types): item_name = item['name'] + f" | GENERES: {'/'.join(item['genres'])}" item_by = f"{item['name']}" item_thumbnail_url = item['images'][-1]["url"] if len(item['images']) > 0 else "" - elif item_type == "shows": + elif item_type == "show": item_name = f"{config.get('explicit_label') if item['explicit'] else ''} {item['name']}" item_by = f"{item['publisher']}" item_thumbnail_url = item['images'][-1]["url"] if len(item['images']) > 0 else "" - elif item_type == "episodes": + elif item_type == "episode": item_name = f"{config.get('explicit_label') if item['explicit'] else ''} {item['name']}" item_by = "" item_thumbnail_url = item['images'][-1]["url"] if len(item['images']) > 0 else "" - elif item_type == "audiobooks": + elif item_type == "audiobook": item_name = f"{config.get('explicit_label') if item['explicit'] else ''} {item['name']}" item_by = f"{item['publisher']}" item_thumbnail_url = item['images'][-1]["url"] if len(item['images']) > 0 else "" diff --git a/src/onthespot/gui/mainui.py b/src/onthespot/gui/mainui.py index c0f4887..ecc64cb 100644 --- a/src/onthespot/gui/mainui.py +++ b/src/onthespot/gui/mainui.py @@ -412,9 +412,9 @@ def set_table_props(self): window_width = self.width() logger.info(f"Setting table item properties {window_width}") # Sessions table + self.tbl_sessions.setSortingEnabled(True) self.tbl_sessions.horizontalHeader().setSectionsMovable(True) self.tbl_sessions.horizontalHeader().setSectionsClickable(True) - self.tbl_sessions.horizontalHeader().setSortIndicatorShown(True) self.tbl_sessions.horizontalHeader().resizeSection(0, 16) self.tbl_sessions.horizontalHeader().setSectionResizeMode(1, QHeaderView.ResizeMode.Stretch) self.tbl_sessions.horizontalHeader().setSectionResizeMode(2, QHeaderView.ResizeMode.Stretch) @@ -423,18 +423,18 @@ def set_table_props(self): self.tbl_sessions.horizontalHeader().setSectionResizeMode(5, QHeaderView.ResizeMode.Stretch) self.tbl_sessions.horizontalHeader().setSectionResizeMode(6, QHeaderView.ResizeMode.Stretch) # Search results table + self.tbl_search_results.setSortingEnabled(True) self.tbl_search_results.horizontalHeader().setSectionsMovable(True) self.tbl_search_results.horizontalHeader().setSectionsClickable(True) - self.tbl_search_results.horizontalHeader().setSortIndicatorShown(True) self.tbl_search_results.horizontalHeader().setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch) self.tbl_search_results.horizontalHeader().setSectionResizeMode(1, QHeaderView.ResizeMode.Stretch) self.tbl_search_results.horizontalHeader().setSectionResizeMode(2, QHeaderView.ResizeMode.Stretch) self.tbl_search_results.horizontalHeader().setSectionResizeMode(3, QHeaderView.ResizeMode.Stretch) self.tbl_search_results.horizontalHeader().setSectionResizeMode(4, QHeaderView.ResizeMode.Stretch) # Download progress table + self.tbl_dl_progress.setSortingEnabled(True) self.tbl_dl_progress.horizontalHeader().setSectionsMovable(True) self.tbl_dl_progress.horizontalHeader().setSectionsClickable(True) - self.tbl_dl_progress.horizontalHeader().setSortIndicatorShown(True) if config.get("debug_mode"): self.tbl_dl_progress.horizontalHeader().setSectionResizeMode(0, QHeaderView.ResizeMode.Interactive) else: @@ -604,12 +604,12 @@ def fill_search_table(self): self.tbl_search_results.removeRow(0) search_term = self.inp_search_term.text().strip() content_types = [] + if self.inp_enable_search_tracks.isChecked(): + content_types.append('track') if self.inp_enable_search_playlists.isChecked(): content_types.append('playlist') if self.inp_enable_search_albums.isChecked(): content_types.append('album') - if self.inp_enable_search_tracks.isChecked(): - content_types.append('track') if self.inp_enable_search_artists.isChecked(): content_types.append('artist') if self.inp_enable_search_shows.isChecked(): diff --git a/src/onthespot/gui/qtui/main.ui b/src/onthespot/gui/qtui/main.ui index 3cdae1a..48445a8 100644 --- a/src/onthespot/gui/qtui/main.ui +++ b/src/onthespot/gui/qtui/main.ui @@ -40,7 +40,7 @@ - 2 + 0 @@ -231,7 +231,7 @@ Episodes - false + true @@ -241,7 +241,7 @@ Podcasts - false + true @@ -251,7 +251,7 @@ Audiobooks - false + true @@ -569,7 +569,7 @@ 0 - -1370 + 0 631 3181 diff --git a/src/onthespot/otsconfig.py b/src/onthespot/otsconfig.py index 1077621..2be394e 100755 --- a/src/onthespot/otsconfig.py +++ b/src/onthespot/otsconfig.py @@ -46,7 +46,7 @@ def __init__(self, cfg_path=None): "language": "en_US", # Language "language_index": 0, # Language Index "max_threads": 1, # Maximum number of thread we can spawn - "parsing_acc_sn": 1, # Serial number of account that will be used for parsing links + "parsing_acc_sn": 0, # Serial number of account that will be used for parsing links "rotate_acc_sn": False, # Rotate active account for parsing and downloading tracks "download_root": os.path.join(os.path.expanduser("~"), "Music", "OnTheSpot"), # Root dir for downloads "download_delay": 3, # Seconds to wait before next download attempt diff --git a/src/onthespot/parse_item.py b/src/onthespot/parse_item.py index 226dc6c..d84d5d0 100755 --- a/src/onthespot/parse_item.py +++ b/src/onthespot/parse_item.py @@ -16,7 +16,7 @@ def parse_url(url): accounts = config.get('accounts') - account_service = accounts[config.get('parsing_acc_sn') - 1]['service'] + account_service = accounts[config.get('parsing_acc_sn')]['service'] if account_service == 'soundcloud' and re.match(SOUNDCLOUD_URL_REGEX, url): item_type, item_id = soundcloud_parse_url(url) item_service = "soundcloud" diff --git a/src/onthespot/search.py b/src/onthespot/search.py index 98d7b2c..0936cf3 100644 --- a/src/onthespot/search.py +++ b/src/onthespot/search.py @@ -30,5 +30,5 @@ def get_search_results(search_term, content_types=None): logger.info(f"Search clicked with value term {search_term}") if search_term != "": token = get_account_token() - account_type = config.get('accounts')[config.get('parsing_acc_sn') - 1]['service'] + account_type = config.get('accounts')[config.get('parsing_acc_sn')]['service'] return globals()[f"{account_type}_get_search_results"](token, search_term, content_types) \ No newline at end of file