summaryrefslogtreecommitdiff
path: root/jamos
diff options
context:
space:
mode:
Diffstat (limited to 'jamos')
-rwxr-xr-xjamos39
1 files changed, 18 insertions, 21 deletions
diff --git a/jamos b/jamos
index 81d47ff..cbe8fdd 100755
--- a/jamos
+++ b/jamos
@@ -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.