22
22
MYJDDeviceNotFoundException
23
23
)
24
24
25
-
26
25
BS = 16
27
26
28
27
@@ -370,8 +369,18 @@ def set_priority(self, priority, link_ids, package_ids):
370
369
resp = self .device .action (self .url + "/setPriority" , params )
371
370
return resp
372
371
373
- def set_enabled (self , enabled , link_ids = [], package_ids = []):
374
- params = [enabled , link_ids , package_ids ]
372
+ def set_enabled (self , enable , link_ids , package_ids ):
373
+ """
374
+ Enable or disable packages.
375
+
376
+ :param enable: Enable or disable package.
377
+ :type: boolean
378
+ :param link_ids: Links UUID.
379
+ :type: list of strings
380
+ :param package_ids: Packages UUID.
381
+ :type: list of strings.
382
+ """
383
+ params = [enable , link_ids , package_ids ]
375
384
resp = self .device .action (self .url + "/setEnabled" , params )
376
385
return resp
377
386
@@ -422,7 +431,7 @@ def is_collecting(self):
422
431
"""
423
432
Boolean status query about the collecting process
424
433
"""
425
- resp = self .device .action (self .url + "/isCollecting" )
434
+ resp = self .device .action (self .url + "/isCollecting" )
426
435
return resp
427
436
428
437
def get_childrenchanged (self ):
@@ -432,7 +441,7 @@ def get_childrenchanged(self):
432
441
"""
433
442
pass
434
443
435
- def remove_links (self , link_ids = [], package_ids = []):
444
+ def remove_links (self , link_ids = [], package_ids = []):
436
445
"""
437
446
Remove packages and/or links of the linkgrabber list.
438
447
Requires at least a link_ids or package_ids list, or both.
@@ -475,6 +484,11 @@ def move_links(self):
475
484
"""
476
485
pass
477
486
487
+ def move_to_new_package (self , link_ids , package_ids , new_pkg_name , download_path ):
488
+ params = link_ids , package_ids , new_pkg_name , download_path
489
+ resp = self .device .action (self .url + "/movetoNewPackage" , params )
490
+ return resp
491
+
478
492
def set_variant (self ):
479
493
"""
480
494
No idea what parameters i have to pass and/or i don't know what it does.
@@ -483,11 +497,8 @@ def set_variant(self):
483
497
pass
484
498
485
499
def get_package_count (self ):
486
- """
487
- No idea what parameters i have to pass and/or i don't know what it does.
488
- If i find out i will implement it :P
489
- """
490
- pass
500
+ resp = self .device .action ("/linkgrabberv2/getPackageCount" )
501
+ return resp
491
502
492
503
def rename_package (self , package_id , new_name ):
493
504
"""
@@ -497,24 +508,23 @@ def rename_package(self, package_id, new_name):
497
508
resp = self .device .action (self .url + "/renamePackage" , params )
498
509
return resp
499
510
500
-
501
511
def query_packages (self ,
502
512
params = [{
503
- "availableOfflineCount" :True ,
504
- "availableOnlineCount" :True ,
505
- "availableTempUnknownCount" :True ,
506
- "availableUnknownCount" :True ,
507
- "bytesTotal" :True ,
508
- "childCount" :True ,
509
- "comment" :True ,
510
- "enabled" :True ,
511
- "hosts" :True ,
512
- "maxResults" :- 1 ,
513
- "packageUUIDs" :[],
514
- "priority" :True ,
515
- "saveTo" :True ,
516
- "startAt" :0 ,
517
- "status" :True
513
+ "availableOfflineCount" : True ,
514
+ "availableOnlineCount" : True ,
515
+ "availableTempUnknownCount" : True ,
516
+ "availableUnknownCount" : True ,
517
+ "bytesTotal" : True ,
518
+ "childCount" : True ,
519
+ "comment" : True ,
520
+ "enabled" : True ,
521
+ "hosts" : True ,
522
+ "maxResults" : - 1 ,
523
+ "packageUUIDs" : [],
524
+ "priority" : True ,
525
+ "saveTo" : True ,
526
+ "startAt" : 0 ,
527
+ "status" : True
518
528
}]):
519
529
resp = self .device .action (self .url + "/queryPackages" , params )
520
530
return resp
@@ -650,8 +660,18 @@ def cleanup(self,
650
660
resp = self .device .action (self .url + "/cleanup" , params )
651
661
return resp
652
662
653
- def set_enabled (self , enabled , link_ids = [], package_ids = []):
654
- params = [enabled , link_ids , package_ids ]
663
+ def set_enabled (self , enable , link_ids , package_ids ):
664
+ """
665
+ Enable or disable packages.
666
+
667
+ :param enable: Enable or disable package.
668
+ :type: boolean
669
+ :param link_ids: Links UUID.
670
+ :type: list of strings
671
+ :param package_ids: Packages UUID.
672
+ :type: list of strings.
673
+ """
674
+ params = [enable , link_ids , package_ids ]
655
675
resp = self .device .action (self .url + "/setEnabled" , params )
656
676
return resp
657
677
@@ -664,8 +684,8 @@ def set_dl_location(self, directory, package_ids=[]):
664
684
params = [directory , package_ids ]
665
685
resp = self .device .action (self .url + "/setDownloadDirectory" , params )
666
686
return resp
667
-
668
- def remove_links (self , link_ids = [], package_ids = []):
687
+
688
+ def remove_links (self , link_ids = [], package_ids = []):
669
689
"""
670
690
Remove packages and/or links of the downloads list.
671
691
NOTE: For more specific removal, like deleting the files etc, use the /cleanup api.
@@ -680,6 +700,16 @@ def remove_links(self, link_ids = [], package_ids = []):
680
700
resp = self .device .action (self .url + "/removeLinks" , params )
681
701
return resp
682
702
703
+ def reset_links (self , link_ids , package_ids ):
704
+ params = [link_ids , package_ids ]
705
+ resp = self .device .action (self .url + "/resetLinks" , params )
706
+ return resp
707
+
708
+ def move_to_new_package (self , link_ids , package_ids , new_pkg_name , download_path ):
709
+ params = link_ids , package_ids , new_pkg_name , download_path
710
+ resp = self .device .action (self .url + "/movetoNewPackage" , params )
711
+ return resp
712
+
683
713
684
714
class Captcha :
685
715
"""
@@ -693,20 +723,23 @@ def __init__(self, device):
693
723
"""
694
724
Get the waiting captchas
695
725
"""
726
+
696
727
def list (self ):
697
728
resp = self .device .action (self .url + "/list" , [])
698
729
return resp
699
730
700
731
"""
701
732
Get the base64 captcha image
702
733
"""
734
+
703
735
def get (self , captcha_id ):
704
736
resp = self .device .action (self .url + "/get" , (captcha_id ,))
705
737
return resp
706
738
707
739
"""
708
740
Solve a captcha
709
741
"""
742
+
710
743
def solve (self , captcha_id , solution ):
711
744
resp = self .device .action (self .url + "/solve" , (captcha_id , solution ))
712
745
return resp
@@ -1148,7 +1181,6 @@ def request_api(self,
1148
1181
except requests .exceptions .RequestException as e :
1149
1182
return None
1150
1183
if encrypted_response .status_code != 200 :
1151
-
1152
1184
try :
1153
1185
error_msg = json .loads (encrypted_response .text )
1154
1186
except json .JSONDecodeError :
0 commit comments