JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #321  
Old 16.02.2018, 16:15
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by RPH View Post
... It's thus not possible for me to sit and wait for the permission dialog box to appear on myJDownloader.
Temporary workaround? : Change system time to Trigger Script > Set Permission > Restore System Time.

Last edited by mgpai; 16.02.2018 at 16:16. Reason: Typo
Reply With Quote
  #322  
Old 16.02.2018, 16:16
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,044
Default

After next Update you'll have new commands
disablePermissionChecks();
enablePermissionChecks();
Update will be available in next 5 mins
__________________
JD-Dev & Server-Admin
Reply With Quote
  #323  
Old 16.02.2018, 16:18
RPH
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Jiaz View Post
I will add easy method to disable permission checks
Thank-you very much ! This will be useful for future scripts as well.

A new update just became available so using myJDownloader I set my "update check" event's interval to 1000ms, disabled and re-enabled the script, and then the permission box appeared. Hopefully now it will not ask for the permissions again since I did not modify the script since accepting the permissions.

Quote:
Originally Posted by Jiaz View Post
After next Update you'll have new commands
disablePermissionChecks();
enablePermissionChecks();
Update will be available in next 5 mins
Thanks ! I just put the command in the beginning of script ?

Last edited by RPH; 16.02.2018 at 16:21.
Reply With Quote
  #324  
Old 16.02.2018, 16:21
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,044
Default

just add
disablePermissionChecks();
in beginning of your script to disable checks
__________________
JD-Dev & Server-Admin
Reply With Quote
  #325  
Old 16.02.2018, 16:24
RPH
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Jiaz View Post
just add
disablePermissionChecks();
in beginning of your script to disable checks
Superb !
Reply With Quote
  #326  
Old 16.02.2018, 19:41
netgearjd netgearjd is offline
Giga Loader
 
Join Date: Aug 2014
Posts: 92
Default

Quote:
Originally Posted by mgpai View Post
Script Updated:
Code:
github.com/mgpai/resources/blob/master/jdownloader/eventscripter/scripts/netgearjd.js
Superb, thanks once again!

Quote:
Originally Posted by Jiaz View Post
After next Update you'll have new commands
disablePermissionChecks();
enablePermissionChecks();
Update will be available in next 5 mins
Jiaz, how about the new API I requested above?

Edit: @mgpai, I wonder if you'd be so kind as to help me with a related script. This time I want to disable all links in a given package in the Downloads/LinkGrabber list whose file names match file names in the related download folder.

So for example if I have a package named "Jan Reports" and it's to be saved to Drive:\PackageName, then the script should match all file names in that package with file names in "Drive:\Jan Reports" and disable all matches. Basically it's the same script as before, except this time the comparison is to actual file names on disk instead of file names in a text file. Is this possible?

Last edited by netgearjd; 16.02.2018 at 19:54.
Reply With Quote
  #327  
Old 16.02.2018, 19:50
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,044
Default

@netgearjd: will be available with next update in 5 mins
__________________
JD-Dev & Server-Admin
Reply With Quote
  #328  
Old 16.02.2018, 22:01
netgearjd netgearjd is offline
Giga Loader
 
Join Date: Aug 2014
Posts: 92
Default

@Jiaz: What function name should I use?
Reply With Quote
  #329  
Old 17.02.2018, 09:18
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by netgearjd View Post
... I want to disable all links in a given package in the Downloads/LinkGrabber list whose file names match file names in the related download folder...
Script Created:
Code:
github.com/mgpai/resources/blob/master/jdownloader/eventscripter/scripts/netgearjd_2.js

Quote:
Originally Posted by netgearjd View Post
@Jiaz: What function name should I use?
Script updated:
Code:
github.com/mgpai/resources/blob/master/jdownloader/eventscripter/scripts/netgearjd.js
Reply With Quote
  #330  
Old 17.02.2018, 12:39
RPH
Guest
 
Posts: n/a
Question

Hi guys, sorry another quick question. With the code below, is it possible to wait for the runUpdateCheck() to finish before checking if an update is available on the next line of code ? Or maybe there is an all in one API that runs the update check and then updates/restarts if there is one ? Also, where can I find a list of JDownlaoder's APIs ?

Or is it possible to runUpdateCheck() using crontab instead ?

EDIT: I guess I could just add a sleep() command after calling runUpdateCheck().

Thanks

Code:
runUpdateCheck();
if (isDownloadControllerIdle() && isUpdateAvailable()) {
    interval = 1000;
    restartAndUpdate();
}

//Functions

function runUpdateCheck() {
    callAPI("update", "runUpdateCheck");
}

function isUpdateAvailable() {
    return callAPI("update", "isUpdateAvailable");
}

function restartAndUpdate() {
    callAPI("update", "restartAndUpdate");
}

Last edited by RPH; 17.02.2018 at 15:06.
Reply With Quote
  #331  
Old 19.02.2018, 11:11
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,044
Default

@netgearjd
getComment and setComment
@RPH: once an update is available, isUpdateAvailable will return true. So I would not think about async check just schedule the script for example all 15 mins. (default is 5 and 60 mins on headless)
__________________
JD-Dev & Server-Admin
Reply With Quote
  #332  
Old 19.02.2018, 14:18
RPH
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Jiaz View Post
@RPH: once an update is available, isUpdateAvailable will return true. So I would not think about async check just schedule the script for example all 15 mins. (default is 5 and 60 mins on headless)
Hi, I have auto-update turned off. I only wanted to check for updates once a day at a specific time and if there are updates available then install them before my downloads are scheduled to start.

For example:

03:45 AM - Check for updates / download updates
- If updates available, install updates

04:00 AM - Start downloads

Problem is that runUpdateCheck() doesn't have a return value so the script doesn't wait for the update check to finish before checking if there are updates to install (so they don't get installed). I think I solved this temporarily by adding a sleep(300000) command after runUpdateCheck().
Reply With Quote
  #333  
Old 19.02.2018, 14:31
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,044
Default

Adding sleep will help yes. You could also enable auto update and JDownloader will check for pending updates itself. Without restart core updates are not installed. Don't see any reason not to enable auto update
__________________
JD-Dev & Server-Admin
Reply With Quote
  #334  
Old 19.02.2018, 15:02
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,484
Default

Quote:
Originally Posted by RPH View Post
... where can I find a list of JDownlaoder's APIs ?
Other than the ones listed in the editor?

Code:
docs.google.com/document/d/1IGeAwg8bQyaCTeTl_WyjLyBPh4NBOayO0_MAmvP5Mu4
Reply With Quote
  #335  
Old 19.02.2018, 16:21
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,044
Default

@RPH:
@mgpai: Better api list
https://my.jdownloader.org/developers/
__________________
JD-Dev & Server-Admin
Reply With Quote
  #336  
Old 19.02.2018, 19:28
RPH
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Jiaz View Post
Adding sleep will help yes. You could also enable auto update and JDownloader will check for pending updates itself. Without restart core updates are not installed. Don't see any reason not to enable auto update
I didn't want to have JDownloader unnecessarily checking for updates throughout the day (I saw the default value is every 10 minutes). And I want the latest updates available to be installed right before my downloads start to ensure that there will be no problems with plugins during downloading.

If there are only non-core updates available, will JDownloader still restart when running the "UpdateAndRestart()" command ?
Reply With Quote
  #337  
Old 20.02.2018, 10:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,044
Default

@RPH: Plugin updates can be installed in background without restart. Also headless is minimum timeout 1hour and not what's defined in advanced settings. Only pending core updates require a restart.
restartAndUpdate -> triggers a restart and enforces update check on startup.
Headless version always checks for updates on startup
__________________
JD-Dev & Server-Admin
Reply With Quote
  #338  
Old 20.02.2018, 11:14
RPH
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Jiaz View Post
@RPH: Plugin updates can be installed in background without restart. Also headless is minimum timeout 1hour and not what's defined in advanced settings. Only pending core updates require a restart.
restartAndUpdate -> triggers a restart and enforces update check on startup.
Headless version always checks for updates on startup
Ok so with my code below, if runUpdateCheck() finds only plugin updates (non-core), will it still force an unnecessary restart with restartAndUpdate() ? Then maybe I should re-enable auto-update checking so that the system doesn't restart just to install some plugin updates. Thanks.

Code:
runUpdateCheck();
sleep(300000);
if (isDownloadControllerIdle() && isUpdateAvailable()) {
    interval = 1000;
    restartAndUpdate();
}
Reply With Quote
  #339  
Old 20.02.2018, 11:22
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,044
Default

restartAndUpdate will always restart and force an update check, yes
but only when isUpdateAvailable() is true, which is only the case for pending core updates as runUpdateCheck will install plugin updates in background if possible
__________________
JD-Dev & Server-Admin
Reply With Quote
  #340  
Old 20.02.2018, 12:03
RPH
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Jiaz View Post
restartAndUpdate will always restart and force an update check, yes
but only when isUpdateAvailable() is true, which is only the case for pending core updates as runUpdateCheck will install plugin updates in background if possible
Ahh, that makes sense, thanks
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 14:17.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.