diff options
Diffstat (limited to 'jamos')
-rwxr-xr-x | jamos | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -146,16 +146,30 @@ def move_file(file, metadata): os.path.join(final_directory, artist + '_' + title + '.mp3')) +def get_video_urls_in_playlist(playlist_url): + videos = ytdl.extract_info(playlist_url, download=False) + + urls = [] + for vid in videos['entries']: + if 'webpage_url' in vid.keys() and vid['webpage_url'] is not None: + urls.append(vid['webpage_url']) + + return urls + + if __name__ == "__main__": # Get the playlist url from the command line playlist_url = get_playlist_url() - try: - # TODO: make this continue downloading if a song fails - download_song(playlist_url) - except Exception as ex: - # TODO: Handle this a different way - print(ex) + urls = get_video_urls_in_playlist(playlist_url) + + for url in urls: + try: + # TODO: make this continue downloading if a song fails + download_song(url) + except Exception as ex: + # TODO: Handle this a different way + print(ex) files = get_all_files(MUSIC_DIRECTORY) |