2222 MYJDDeviceNotFoundException
2323)
2424
25- 2625BS = 16
2726
2827
@@ -370,8 +369,18 @@ def set_priority(self, priority, link_ids, package_ids):
370369 resp = self .device .action (self .url + "/setPriority" , params )
371370 return resp
372371
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 ]
375384 resp = self .device .action (self .url + "/setEnabled" , params )
376385 return resp
377386
@@ -422,7 +431,7 @@ def is_collecting(self):
422431 """
423432 Boolean status query about the collecting process
424433 """
425- resp = self .device .action (self .url + "/isCollecting" )
434+ resp = self .device .action (self .url + "/isCollecting" )
426435 return resp
427436
428437 def get_childrenchanged (self ):
@@ -432,7 +441,7 @@ def get_childrenchanged(self):
432441 """
433442 pass
434443
435- def remove_links (self , link_ids = [], package_ids = []):
444+ def remove_links (self , link_ids = [], package_ids = []):
436445 """
437446 Remove packages and/or links of the linkgrabber list.
438447 Requires at least a link_ids or package_ids list, or both.
@@ -475,6 +484,11 @@ def move_links(self):
475484 """
476485 pass
477486
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+ 478492 def set_variant (self ):
479493 """
480494 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):
483497 pass
484498
485499 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
491502
492503 def rename_package (self , package_id , new_name ):
493504 """
@@ -497,24 +508,23 @@ def rename_package(self, package_id, new_name):
497508 resp = self .device .action (self .url + "/renamePackage" , params )
498509 return resp
499510
500- 501511 def query_packages (self ,
502512 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
518528 }]):
519529 resp = self .device .action (self .url + "/queryPackages" , params )
520530 return resp
@@ -650,8 +660,18 @@ def cleanup(self,
650660 resp = self .device .action (self .url + "/cleanup" , params )
651661 return resp
652662
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 ]
655675 resp = self .device .action (self .url + "/setEnabled" , params )
656676 return resp
657677
@@ -664,8 +684,8 @@ def set_dl_location(self, directory, package_ids=[]):
664684 params = [directory , package_ids ]
665685 resp = self .device .action (self .url + "/setDownloadDirectory" , params )
666686 return resp
667-
668- def remove_links (self , link_ids = [], package_ids = []):
687+ 688+ def remove_links (self , link_ids = [], package_ids = []):
669689 """
670690 Remove packages and/or links of the downloads list.
671691 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 = []):
680700 resp = self .device .action (self .url + "/removeLinks" , params )
681701 return resp
682702
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+ 683713
684714class Captcha :
685715 """
@@ -693,20 +723,23 @@ def __init__(self, device):
693723 """
694724 Get the waiting captchas
695725 """
726+ 696727 def list (self ):
697728 resp = self .device .action (self .url + "/list" , [])
698729 return resp
699730
700731 """
701732 Get the base64 captcha image
702733 """
734+ 703735 def get (self , captcha_id ):
704736 resp = self .device .action (self .url + "/get" , (captcha_id ,))
705737 return resp
706738
707739 """
708740 Solve a captcha
709741 """
742+ 710743 def solve (self , captcha_id , solution ):
711744 resp = self .device .action (self .url + "/solve" , (captcha_id , solution ))
712745 return resp
@@ -1148,7 +1181,6 @@ def request_api(self,
11481181 except requests .exceptions .RequestException as e :
11491182 return None
11501183 if encrypted_response .status_code != 200 :
1151- 11521184 try :
11531185 error_msg = json .loads (encrypted_response .text )
11541186 except json .JSONDecodeError :
0 commit comments