View Single Post
  #1648  
Old 18.01.2021, 20:35
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,553
Default

Quote:
Originally Posted by tarkett View Post
It is possible, that this script doesn't work on a headless system? On a desktop system it works fine.
The old version of this script works also on the headless system.
Seems quite possible.

This script uses MYJD API call to check the download controller state, while the other one uses the eventscripter method. This script uses "IDLE" status to check the sate. I just checked the source code and it seems there is also a "STOPPED_STATE" which the script does not take into account, and likely fails as a result. But not sure why it works in desktop and not in headless.

To avoid any confusion, I have replaced the MYJD API call in the script with the eventscripter method. Hopefully it should work fine in both.

Code:
/*
    Update when JD is Idle
    Trigger Required: "Interval" (Recommended: 600000 (10 mins.) or more)
*/

if (
    callAPI("update", "isUpdateAvailable") &&
    !callAPI("linkcrawler", "isCrawling") &&
    !callAPI("linkgrabberv2", "isCollecting") &&
    !callAPI("extraction", "getQueue").length &&
    isDownloadControllerIdle()
) {
    callAPI("update", "restartAndUpdate");
}

Thanks for the report.
Reply With Quote