aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-03-09 22:50:22 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-03-09 22:50:22 +0530
commit29df89f0d46e897ab8e4dcab2db4012a276a279b (patch)
tree6477c51fc8917c608dca6a8f9f89702b5a2a207e
parentb3fb1f3d6c34c860ae6498f514ebb9c2aabf9726 (diff)
Added argparse support
-rw-r--r--main.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/main.py b/main.py
index 7b84260..9f050da 100644
--- a/main.py
+++ b/main.py
@@ -8,9 +8,31 @@ from logzero import setup_logger
import re
import urllib.request
import urllib.parse
-
+import argparse
import time
+version = 1.0
+style = False
+
+text = 'This program takes YouTube URL or title of a song and converts it into vaporwave'
+
+parser = argparse.ArgumentParser(description = text)
+parser.add_argument("-M", "--music", help="generate v a p o r w a v e music", action="store_true")
+parser.add_argument("-V", "--version", help="show program version", action="store_true")
+parser.add_argument("-i", "--input", help="input url")
+
+args = parser.parse_args()
+
+if args.version:
+ print("vaporwave generator 旺育栄", version)
+ exit
+if args.music:
+ music = True
+if args.input:
+ query = args.url
+else:
+ query = input("Enter target song's name or YouTube URL: ")
+
MAX_DURATION = 600 # In-case the program finds a compilation
youtube_urls = ('youtube.com', 'https://www.youtube.com/', 'http://www.youtube.com/', 'http://youtu.be/', 'https://youtu.be/', 'youtu.be')
@@ -116,12 +138,14 @@ def gen_vapor(filePath, title):
os.system("rm -r beats/")
-
+"""
## Makes this a command line tool: disable when we get the webserver going
sys.argv.pop(0)
query = ""
for s in sys.argv:
query = query + s
+"""
-name, title = download_file(query)
-gen_vapor(name, title)
+if music:
+ name, title = download_file(query)
+ gen_vapor(name, title)