45
45
46
46
LOGGER = getLogger (__name__ )
47
47
48
- aria2 = ariaAPI (ariaClient (host = "http://localhost" , port = 6800 , secret = "" ))
49
-
50
48
load_dotenv ("config.env" , override = True )
51
49
52
50
Intervals = {"status" : {}, "qb" : "" , "jd" : "" }
139
137
else :
140
138
config_dict = {}
141
139
140
+ if not ospath .exists (".netrc" ):
141
+ with open (".netrc" , "w" ):
142
+ pass
143
+ run (
144
+ "chmod 600 .netrc && cp .netrc /root/.netrc && chmod +x aria-nox.sh && ./aria-nox.sh" ,
145
+ shell = True ,
146
+ )
147
+
142
148
OWNER_ID = environ .get ("OWNER_ID" , "" )
143
149
if len (OWNER_ID ) == 0 :
144
150
log_error ("OWNER_ID variable is missing! Exiting now" )
436
442
shell = True ,
437
443
)
438
444
439
- run (["qbittorrent-nox" , "-d" , f"--profile={ getcwd ()} " ])
440
- if not ospath .exists (".netrc" ):
441
- with open (".netrc" , "w" ):
442
- pass
443
- run (
444
- "chmod 600 .netrc && cp .netrc /root/.netrc && chmod +x aria.sh && ./aria.sh" ,
445
- shell = True ,
446
- )
447
445
if ospath .exists ("accounts.zip" ):
448
446
if ospath .exists ("accounts" ):
449
447
run (["rm" , "-rf" , "accounts" ])
454
452
config_dict ["USE_SERVICE_ACCOUNTS" ] = False
455
453
456
454
457
- def get_client ():
455
+ def get_qb_client ():
458
456
return qbClient (
459
457
host = "localhost" ,
460
458
port = 8090 ,
@@ -479,20 +477,6 @@ def get_client():
479
477
"server-stat-of" ,
480
478
]
481
479
482
- qb_client = get_client ()
483
- if not qbit_options :
484
- qbit_options = dict (qb_client .app_preferences ())
485
- del qbit_options ["listen_port" ]
486
- for k in list (qbit_options .keys ()):
487
- if k .startswith ("rss" ):
488
- del qbit_options [k ]
489
- else :
490
- qb_opt = {** qbit_options }
491
- for k , v in list (qb_opt .items ()):
492
- if v in ["" , "*" ]:
493
- del qb_opt [k ]
494
- qb_client .app_set_preferences (qb_opt )
495
-
496
480
log_info ("Creating client from BOT_TOKEN" )
497
481
bot = tgClient (
498
482
"bot" ,
@@ -507,6 +491,20 @@ def get_client():
507
491
508
492
scheduler = AsyncIOScheduler (timezone = str (get_localzone ()), event_loop = bot_loop )
509
493
494
+ if not qbit_options :
495
+ qbit_options = dict (get_qb_client ().app_preferences ())
496
+ del qbit_options ["listen_port" ]
497
+ for k in list (qbit_options .keys ()):
498
+ if k .startswith ("rss" ):
499
+ del qbit_options [k ]
500
+ else :
501
+ qb_opt = {** qbit_options }
502
+ for k , v in list (qb_opt .items ()):
503
+ if v in ["" , "*" ]:
504
+ del qb_opt [k ]
505
+ get_qb_client ().app_set_preferences (qb_opt )
506
+
507
+ aria2 = ariaAPI (ariaClient (host = "http://localhost" , port = 6800 , secret = "" ))
510
508
if not aria2_options :
511
509
aria2_options = aria2 .client .get_global_option ()
512
510
else :
0 commit comments