summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rwxr-xr-xjamos39
2 files changed, 21 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 731010f..437de7b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,6 @@ music/*
cookies.txt
# VSCode settings
-.vscode/* \ No newline at end of file
+.vscode/*
+
+venv/*
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.