Explorar o código

Added --organize command.

The --organize command will create a folder for each user whose livestream(s) you have downloaded. The names of the folders will be their usernames. It will then move the video(s) of each user into their associated folder.
BassThatHertz %!s(int64=6) %!d(string=hai) anos
pai
achega
24910a6257
Modificáronse 1 ficheiros con 9 adicións e 2 borrados
  1. 9 2
      pyinstalive/startup.py

+ 9 - 2
pyinstalive/startup.py

@@ -26,12 +26,15 @@ except ImportError:
     from . import dlfuncs
     from . import dlfuncs
     from .constants import Constants
     from .constants import Constants
 
 
-
 def validate_inputs(config, args, unknown_args):
 def validate_inputs(config, args, unknown_args):
     error_arr = []
     error_arr = []
     try:
     try:
         config.read(pil.config_path)
         config.read(pil.config_path)
 
 
+        if args.organize:
+            assembler.organize_videos()
+            return False
+
         if args.download:
         if args.download:
             pil.dl_user = args.download
             pil.dl_user = args.download
             if args.downloadfollowing or args.batchfile:
             if args.downloadfollowing or args.batchfile:
@@ -272,6 +275,9 @@ def run():
     parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help="PyInstaLive will output JSON "
     parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help="PyInstaLive will output JSON "
                                                                                      "responses and some misc "
                                                                                      "responses and some misc "
                                                                                      "variables.")
                                                                                      "variables.")
+
+    parser.add_argument('-o', '--organize', action='store_true', help="Create a folder for each user whose livestream(s) you have downloaded. The names of the folders will be their usernames. Then move the video(s) of each user into their associated folder.")
+
     # Workaround to 'disable' argument abbreviations
     # Workaround to 'disable' argument abbreviations
     parser.add_argument('--usernamx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('--usernamx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('--passworx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('--passworx', help=argparse.SUPPRESS, metavar='IGNORE')
@@ -281,6 +287,7 @@ def run():
     parser.add_argument('--downloadfollowinx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('--downloadfollowinx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('--configpatx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('--configpatx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('--confix', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('--confix', help=argparse.SUPPRESS, metavar='IGNORE')
+    parser.add_argument('--organizx', help=argparse.SUPPRESS, metavar='IGNORE')
 
 
     parser.add_argument('-cx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('-cx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('-nx', help=argparse.SUPPRESS, metavar='IGNORE')
     parser.add_argument('-nx', help=argparse.SUPPRESS, metavar='IGNORE')
@@ -311,4 +318,4 @@ def run():
                     logger.error("PyInstaLive must be properly installed when using the -b argument.")
                     logger.error("PyInstaLive must be properly installed when using the -b argument.")
                     logger.separator()
                     logger.separator()
                 else:
                 else:
-                    dlfuncs.iterate_users(pil.dl_batchusers)
+                    dlfuncs.iterate_users(pil.dl_batchusers)