#301
|
|||
|
|||
![]()
Hi, I am running a Pi2 with Ubuntu Mate 16.04 and JDownloader headless. How can I go about making the following work using event scripter:
Event: when download controller starts Code:
*if files exist in folder /home/myuser/myfolder* then "killall transmission-gtk" #This is a Linux command normally run in terminal *end* Code:
"killall transmission-gtk" Code:
call home/myuser/myscript.sh "transmission-gtk %U -m" #must only run after myscript.sh has finished Code:
#!/bin/bash for i in /home/myuser/myfolder/*.mp4 do /usr/local/bin/gdrive upload --delete "$i" #uploads file to google drive and then deletes it from disk done |
#302
|
|||
|
|||
![]()
Something like this should work. Jiaz should be able to confirm.
Event: when download controller starts Code:
var myFolder = "/home/myuser/myfolder"; var fileExists = getPath(myFolder).getChildren().length; if (fileExists) callAsync(null, "killall", "transmission-gtk"); Event: when download starts Code:
callAsync(null, "killall", "transmission-gtk"); Event: when download controller stops Code:
var myScript = "home/myuser/myscript.sh"; callSync(myScipt); callAsync(null, "transmission-gtk", "%U", "-m");
|
#303
|
|||
|
|||
![]() Quote:
Quick question, is there any difference in running the "transmission-gtk" commands Synchronous or Asynchronous ? And all the event scripts should be set as Synchronous ? EDIT: Also is it possible to update and restart Jdownloader at a certain time of the day if and only if updates are available ? I noticed that you set a "start time" on page 1 and used the interval trigger. Last edited by RPH; 11.02.2018 at 12:53. |
#304
|
|||
|
|||
![]()
thank you very much works like a charm =)
|
#305
|
|||
|
|||
![]()
Based on my earlier question about updating & restarting JDownloader at a specific time of the day if an update is available, I wrote this script:
Code:
var t = [03, 45]; //Set Starting Time if (isDownloadControllerIdle() && isUpdateAvailable()) { interval = 1000; restartAndUpdate(); } else { var timeDiff = (new Date().setHours(t[0], t[1])) - (new Date()); if (timeDiff <= 0) { interval = (86400000) - Math.abs(timeDiff); } else { interval = timeDiff; } } //Functions function isUpdateAvailable() { return callAPI("update", "isUpdateAvailable"); } function restartAndUpdate() { callAPI("update", "restartAndUpdate"); } I didn't want to have the interval running every second or every minute until the starting time.... EDIT: I changed the code to not use the modulus and it seems to be working fine now. But how can I check if another script is running ??? I don't want the update to run if my "Event: when download controller stops" script is running. Last edited by RPH; 12.02.2018 at 16:32. Reason: Corrected script. |
#306
|
|||
|
|||
![]()
First of all, thanks a lot for the script. Simple, yet 100% effective.
![]() Quote:
@Jiaz: Can we have a new API method to set the link comment from a script? @mgpai: As for the script itself, I want to make one small improvement if possible - how can I add a check to see whether the file exists or not before it is read, and display a simple warning dialog and abort execution if it doesn't exist? |
#307
|
|||
|
|||
![]() Quote:
Enable the "Synchronous Execution" in a script, to wait for the current instance of the script to end, before executing subsequent instance(s) of the same script, if/when triggered. |
#308
|
|||
|
|||
![]() Quote:
Code:
github.com/mgpai/resources/blob/master/jdownloader/eventscripter/scripts/netgearjd.js Last edited by mgpai; 13.02.2018 at 06:41. Reason: Made link to the script visible |
#309
|
|||
|
|||
![]()
Use setProperty() to set a global property in your "Event: when download controller stops" script to indicate that it is running and use getProperty() in your update script to access/check that property before restarting to update.
|
#310
|
|||
|
|||
![]() Quote:
|
#311
|
||||
|
||||
![]()
@mgpai: Thanks for providing great support here !
@RPH: mgpai will be great eventscript teacher for you ![]() ![]()
__________________
JD-Dev & Server-Admin |
#312
|
|||
|
|||
![]()
Hi guys, I got a big problem. While testing my scripts, I set the "updateAndRestart" command to run if JDownloader is idle with the interval as 1000ms. Now as soon as JDownloader starts, it restarts and I cannot use it.
How can I disable this ? Thanks |
#313
|
|||
|
|||
![]()
@RPH: You can disable the script by editing "org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json" which can be found in 'cfg' folder.
|
#314
|
||||
|
||||
![]()
In your cfg folder you will find org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json
either remove it or edit and search enabled and set to false
__________________
JD-Dev & Server-Admin |
#315
|
|||
|
|||
![]() Quote:
Once I have given it permission it will not ask for it again, correct ? Even if JDownloader shuts down and turns on again with say a power outage ? Because I am sure I have given it permissions before but it still asks. Last edited by RPH; 16.02.2018 at 13:31. |
#316
|
||||
|
||||
![]()
Ah, its about permission. This one is saved in JDownloader. Yes, the permission is saved and not asked again. Permissions are on per method basis
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 16.02.2018 at 13:46. |
#317
|
|||
|
|||
![]() Quote:
Code:
if (isDownloadControllerIdle() && isUpdateAvailable()) { interval = 1000; restartAndUpdate(); } Last edited by RPH; 16.02.2018 at 14:24. |
#318
|
||||
|
||||
![]()
@RPH: I just checked, permissions are stored for that script. when you change it, permissions are lost
__________________
JD-Dev & Server-Admin |
#319
|
|||
|
|||
![]() Quote:
How would I go about allowing permissions for my "update check" then, because it is set to run in the early hours of the morning and only when an update is available ? It's thus not possible for me to sit and wait for the permission dialog box to appear on myJDownloader. |
#320
|
||||
|
||||
![]()
I will add easy method to disable permission checks
__________________
JD-Dev & Server-Admin |
![]() |
Thread Tools | |
Display Modes | |
|
|