Skip to content

Commit

Permalink
Merge pull request casualsnek#76 from dhjw/dhjw-patch-1
Browse files Browse the repository at this point in the history
Fix for podcast and episode enqueuing
  • Loading branch information
casualsnek authored Jul 17, 2023
2 parents 94c6cc5 + e34b154 commit f65ba18
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions src/onthespot/worker/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def run(self):
logger.debug(f'Got data to parse: {str(item)}')
try:
session = session_pool[selected_uuid]
enqueue_part_cfg = {
'extra_paths': item['data'].get('dl_path', ''),
'extra_path_as_root': item['data'].get('dl_path_is_root', False),
'force_album_after_extra_path_as_root': item['data'].get('force_album_after_extra_path_as_root', False)
}
if item['media_type'] == 'album':
artist, album_release_date, album_name, total_tracks = get_album_name(session, item['media_id'])
item_name = item['data'].get('media_title', album_name)
Expand All @@ -105,11 +110,6 @@ def run(self):
)
tracks = get_album_tracks(session, item['media_id'])
logger.info("Passing control to track downloader.py for album tracks downloading !!")
enqueue_part_cfg = {
'extra_paths': item['data'].get('dl_path', ''),
'extra_path_as_root': item['data'].get('dl_path_is_root', False),
'force_album_after_extra_path_as_root': item['data'].get('force_album_after_extra_path_as_root', False)
}
self.enqueue_tracks(tracks, enqueue_part_cfg=enqueue_part_cfg,
log_id=f'{album_name}:{item["media_id"]}',
item_type=f"Album [{album_release_date}][{album_name}]")
Expand All @@ -129,11 +129,6 @@ def run(self):
item_name = artist
tracks = get_album_tracks(session, album_id)
logger.info("Passing control to track downloader.py for album artist downloading !!")
enqueue_part_cfg = {
'extra_paths': item['data'].get('dl_path', ''),
'extra_path_as_root': item['data'].get('dl_path_is_root', False),
'force_album_after_extra_path_as_root': item['data'].get('force_album_after_extra_path_as_root', False)
}
self.enqueue_tracks(tracks, enqueue_part_cfg=enqueue_part_cfg,
log_id=f'{artist}:{item["media_id"]}', item_type=f"Artist [{item_name}]")
if not item['data'].get('hide_dialogs', False):
Expand Down Expand Up @@ -198,13 +193,11 @@ def run(self):
)
playlist_songs = get_tracks_from_playlist(session,
item['media_id'])
enqueue_part_cfg = {'extra_paths': item['data'].get('dl_path', ''),
'extra_path_as_root': item['data'].get('dl_path_is_root', False),
'force_album_after_extra_path_as_root': item['data'].get('force_album_after_extra_path_as_root', False),
'playlist_name': name,
'playlist_owner': owner,
'playlist_desc': description
}
enqueue_part_cfg.update({
'playlist_name': name,
'playlist_owner': owner,
'playlist_desc': description
})
if enable_m3u:
playlist_m3u_queue[item['media_id']] = {
'filename': os.path.abspath(
Expand All @@ -228,11 +221,6 @@ def run(self):
name = song_info['name']
if not item['data'].get('hide_dialogs', False):
self.progress.emit(f"Adding track '{name}' to download queue !")
enqueue_part_cfg = {
'extra_paths': item['data'].get('dl_path', ''),
'extra_path_as_root': item['data'].get('dl_path_is_root', False),
'force_album_after_extra_path_as_root': item['data'].get('force_album_after_extra_path_as_root', False)
}
track_obj = {
'id': item['media_id'],
'name': song_info['name'],
Expand Down

0 comments on commit f65ba18

Please sign in to comment.