diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rwxr-xr-x | jamos | 39 |
2 files changed, 21 insertions, 22 deletions
@@ -4,4 +4,6 @@ music/* cookies.txt # VSCode settings -.vscode/*
\ No newline at end of file +.vscode/* + +venv/* @@ -19,26 +19,6 @@ def cleanup_metadata_files(music_directory): os.remove(file) -def create_downloader(music_directory, cookies): - audio_options = { - 'format': 'mp3/bestaudio/best', - 'cookiefile': cookies, - 'outtmpl': music_directory + '%(title)s.%(ext)s', - 'postprocessors': [ - { - 'key': 'FFmpegExtractAudio', - 'preferredcodec': 'mp3', - 'preferredquality': '192', - }, - {'key': 'FFmpegMetadata'}, - ], - 'writeinfojson': True, - 'quiet': not DEBUG - } - - return youtube_dl.YoutubeDL(audio_options) - - def format_youtube_date(date): default = "Unknown Year" try: @@ -146,6 +126,23 @@ def get_song_metadata_from_json(json, counter): return metadata +def create_downloader(music_directory, cookies): + audio_options = { + 'format': 'mp3/bestaudio/best', + 'cookiefile': cookies, + 'outtmpl': os.path.join(music_directory, '%(title)s.%(ext)s'), + 'postprocessors': [ + { + 'key': 'FFmpegExtractAudio', + 'preferredcodec': 'mp3', + 'preferredquality': '192', + }, + {'key': 'FFmpegMetadata'}, + ], + 'writeinfojson': True, + 'quiet': not DEBUG + } + def get_video_urls_in_playlist(playlist_url, ytdl): videos = ytdl.extract_info(playlist_url, download=False) @@ -293,7 +290,7 @@ if __name__ == "__main__": print("Done".format(f)) print("Moving file...", end="") move_file(f, metadata, music_directory) - print("Done", end="") + print("Done") counter += 1 except Exception as e: # just gonna print this and move on to the next file. |