Procházet zdrojové kódy

Also override login when using -df

Cammy před 5 roky
rodič
revize
270e79c45d
3 změnil soubory, kde provedl 9 přidání a 3 odebrání
  1. 3 0
      pyinstalive/auth.py
  2. 3 2
      pyinstalive/dlfuncs.py
  3. 3 1
      pyinstalive/pil.py

+ 3 - 0
pyinstalive/auth.py

@@ -49,6 +49,9 @@ def authenticate(username, password, force_use_login_args=False):
     ig_api = None
     try:
         if force_use_login_args:
+            pil.ig_user = username
+            pil.ig_pass = password
+            pil.config_login_overridden = True
             logger.binfo("Overriding configuration file login with -u and -p arguments.")
             logger.separator()
         cookie_file = "{}.json".format(username)

+ 3 - 2
pyinstalive/dlfuncs.py

@@ -412,13 +412,14 @@ def iterate_users(user_list):
                     "If this is not the case, manually delete the file '{:s}' and try again.".format(user + '.lock'))
             else:
                 logger.info("Launching daemon process for '{:s}'.".format(user))
-                start_result = helpers.run_command("pyinstalive -d {:s} -cp '{:s}' -dp '{:s}' {:s} {:s} {:s}".format(
+                start_result = helpers.run_command("pyinstalive -d {:s} -cp '{:s}' -dp '{:s}' {:s} {:s} {:s} {:s}".format(
                     user,
                     pil.config_path,
                     pil.dl_path,
                     '--no-lives' if not pil.dl_lives else '',
                     '--no-replays' if not pil.dl_replays else '',
-                    '--no-heartbeat' if not pil.do_heartbeat else ''))
+                    '--no-heartbeat' if not pil.do_heartbeat else '',
+                    '--username {:s} --password {:s}'.format(pil.ig_user, pil.ig_pass) if pil.config_login_overridden else None))
                 if start_result:
                     logger.warn("Could not start process: {:s}".format(str(start_result)))
                 else:

+ 3 - 1
pyinstalive/pil.py

@@ -45,6 +45,7 @@ def initialize():
     global do_heartbeat
     global proxy
     global verbose
+    global config_login_overridden
     ig_api = None
     ig_user = ""
     ig_pass = ""
@@ -77,4 +78,5 @@ def initialize():
     has_guest = None
     do_heartbeat = False
     proxy = None
-    verbose = False
+    verbose = False
+    config_login_overridden = False