JDownloader Community - Appwork GmbH
 

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 10.03.2016, 15:50
hachel hachel is offline
Vacuum Cleaner
 
Join Date: Jan 2016
Posts: 19
Default eventscripter multiple trigger

hi there,

I'm currently calling a script with the package's folder when jdownload finished extracting a package like so:
Code:
[ {
  "eventTrigger" : "ON_ARCHIVE_EXTRACTED",
  "enabled" : true,
  "name" : "myscript",
  "script" : "callAsync(\n    function(exitCode, stdOut, errOut) {}, "script.py", archive.getFolder()\n);",
  "eventTriggerSettings" : {
  }
} ]
what I would like is for jdownloader to call the script also in case the package doesn't need extracting. If I just trigger on package finished it might call the script before extracting has finished. Is there a way to this?

thanks
  #2  
Old 10.03.2016, 16:59
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,516
Default

Why not add it to event Download finished and check file extension for known archive. so you can decide rar -> do nothing and let other script take over. mp4 -> execute script now
__________________
JD-Dev & Server-Admin
  #3  
Old 10.03.2016, 18:36
hachel hachel is offline
Vacuum Cleaner
 
Join Date: Jan 2016
Posts: 19
Default

thanks, I suppose I could do something like this (for package finished):
Code:
var packages = package.getArchives();

if ( packages.length == 0 ) {
   // package does not contain archives
  ..start my script
}
And I could have a second script that triggers on archive extracted like the one I had before.
Don't know how to combine them since I'd have to check (and keep checking) whether the package is still being extracted before calling my script
  #4  
Old 10.03.2016, 18:39
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,516
Default

Yes, something like that should work. Or you simply check the filename/extension.
If you want I can also add more advanced check if archive/archive status stuff
__________________
JD-Dev & Server-Admin
  #5  
Old 10.03.2016, 19:29
hachel hachel is offline
Vacuum Cleaner
 
Join Date: Jan 2016
Posts: 19
Default

thanks a lot, I've set it up like this now:
Code:
[ {
  "eventTrigger" : "ON_ARCHIVE_EXTRACTED",
  "enabled" : true,
  "name" : "script_on_archive",
  "script" : "callAsync(function(exitCode, stdOut, errOut) {}, \"script.py\", archive.getFolder());",
  "eventTriggerSettings" : {}
}, {
  "eventTrigger" : "ON_PACKAGE_FINISHED",
  "enabled" : true,
  "name" : "script_on_package",
  "script" : "if (package.getArchives().length == 0) {callAsync(function(exitCode, stdOut, errOut) {}, \"script.py\", package.getDownloadFolder());}",
  "eventTriggerSettings" : {}
} ]
I can't think of any way that's more lean or less code
  #6  
Old 10.03.2016, 19:39
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,516
Default

So it works okay for you ?
__________________
JD-Dev & Server-Admin
  #7  
Old 10.03.2016, 19:50
hachel hachel is offline
Vacuum Cleaner
 
Join Date: Jan 2016
Posts: 19
Default

yes it does, thank you very much
as usual great support
  #8  
Old 10.03.2016, 19:52
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,516
Default

thanks for the feedback
__________________
JD-Dev & Server-Admin
Closed Thread

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 08:27.
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 - 2024, Jelsoft Enterprises Ltd.