summaryrefslogtreecommitdiff
path: root/jamos
diff options
context:
space:
mode:
Diffstat (limited to 'jamos')
-rwxr-xr-xjamos15
1 files changed, 14 insertions, 1 deletions
diff --git a/jamos b/jamos
index 9e6c850..a6cec06 100755
--- a/jamos
+++ b/jamos
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
+import argparse
import datetime
import glob
import json
@@ -62,6 +63,15 @@ def get_all_files(directory):
return files
+def get_command_line_options():
+ parser = argparse.ArgumentParser(description="Download songs from YouTube Music")
+ parser.add_argument("url", metavar="string", type=str, help="Playlist or Song URL to download")
+ parser.add_argument("-c", "--cookies", metavar="string", type=str, help="Cookie file to use.")
+ parser.add_argument("-o", "--output", metavar="string", type=str, help="Output directory to use")
+
+ return parser.parse_args()
+
+
# TODO: switch command line args to argparse
def get_playlist_url():
return sys.argv[1]
@@ -151,8 +161,10 @@ def write_metadata_to_song_file(file, metadata):
if __name__ == "__main__":
+ args = get_command_line_options()
+
# Get the playlist url from the command line
- playlist_url = get_playlist_url()
+ playlist_url = args.url
# TODO: Save urls to file so we can start in the
# middle of the playlist if needed
@@ -173,3 +185,4 @@ if __name__ == "__main__":
json_data = json.load(json_file)
write_metadata_to_song_file(f, json_data)
move_file(f, json_data)
+