POSTBUCKET - where random posts in unrelated topics go

Any questions? Need some help?
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

Probably more like this:

Code: Select all

var command = ['C:\\absolute\\path\\to\\cmd.exe', '-c', 'C:\\absolute\\path\\to\\jdownloader-postprocess.cmd']
:idea: Using \\ instead of \ at all times, because \ is an escape character, and \\ is the literal \ character.
:idea: Please read the FAQ and How to Request Help.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 »

Thanks for replying

This is what I put in my script based on the info you gave and I have:

Code: Select all

var command = ['C:\\Windows\\System32\\cmd.exe', '-c', 'C:\\jdownloader-postprocess.cmd']
log(command)
log(callSync(command))
It didn't spit anything back in the JDownloader2 GUI

I found the log I think for it:

Code: Select all

------------------------Thread: 1792:ScriptEnvironment.log-----------------------
--ID:1792TS:1548138130189-1/22/19 1:22:10 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> [ "C:\\Windows\\System32\\cmd.exe", "-c", "C:\\jdownloader-postprocess.cmd" ]
--ID:1792TS:1548138132497-1/22/19 1:22:12 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> Microsoft Windows [Version 10.0.17763.253]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\Chris Chester\AppData\Local\JDownloader 2.0>
Not sure if it is working or not.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 »

Ok I think it is calling it but I am not sure because nothing else happens. This is the most recent log.

Code: Select all

C:\Users\Chris Chester\AppData\Local\JDownloader 2.0>
------------------------Thread: 2094:ScriptEnvironment.log-----------------------
--ID:2094TS:1548142207563-1/22/19 2:30:07 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> [ "C:\\Windows\\System32\\cmd.exe", "-c", "C:\\jdownloader-postprocess.cmd" ]
--ID:2094TS:1548142207651-1/22/19 2:30:07 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> Microsoft Windows [Version 10.0.17763.253]
(c) 2018 Microsoft Corporation. All rights reserved.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 »

Ok another update.

I changed what you gave me to this as my event script.

Code: Select all

@ECHO OFF

:: Input Parameters
set ARG_PATH=%1
set ARG_NAME=%2
set ARG_LABEL=%3

:: Configuration
set CONFIG_OUTPUT="C:/Torrent-Completed"

filebot -script fn:amc  "C:/Users/Chris Chester/Media" --output "C:/Torrent-Completed" --action duplicate --conflict skip -non-strict --log-file amc.log --def skipExtract=y unsorted=y music=y artwork=y excludeList=excludes.txt
Then I ran it in the JDownloader2 GUI and got not errors so I checked the log.

This is the log.

Code: Select all

------------------------Thread: 2152:ScriptEnvironment.log-----------------------
--ID:2152TS:1548143057335-1/22/19 2:44:17 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> C:\jdownloader-postprocess.cmd
--ID:2152TS:1548143061629-1/22/19 2:44:21 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> Locking C:\Users\Chris Chester\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Tue Jan 22 02:44:20 EST 2019]
Parameter: skipExtract = y
Parameter: unsorted = y
Parameter: music = y
Parameter: artwork = y
Parameter: excludeList = excludes.txt
Argument[0]: C:\Users\Chris Chester\Media
Use excludes: C:\Torrent-Completed\excludes.txt (28)
No files selected for processing
Done ?(?????)?
Does this mean it works? It seems so.
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

Yep, we now know that JD is calling our script, and that our script is calling FileBot successfully. Now it's time to go back, remove all your modifications, and then set it up with JD again with only the minimum amount of modifications, that ones which are required to make it work.


1.
Start from the beginning:
viewtopic.php?f=4&t=3478#p19358


2.
Modify the JD scripts to make them work on your Windows system.

i.e. change this:

Code: Select all

var script = JD_HOME + '/jdownloader-postprocess.sh'
to that:

Code: Select all

var script = ['C:\\Windows\\System32\\cmd.exe', '-c', 'C:\\jdownloader-postprocess.cmd']
:idea: Assuming that the cmd glue logic script is saved to C:\jdownloader-postprocess.cmd


3.
(Optional) Modify FileBot output folder if you're not happy with the default.

i.e. change this:

Code: Select all

set CONFIG_OUTPUT=%USERPROFILE%/Media
to that:

Code: Select all

set CONFIG_OUTPUT="X:/Media"
:idea: In this specific example, X:/Media must be an existing folder. You don't need to, nor should you, make any other changes to the CMD script (unless you spend time reading and understanding how it works, and want to customize it to your needs).
:idea: Please read the FAQ and How to Request Help.
Gruff10
Posts: 2
Joined: 21 Jan 2019, 21:41

Re: Plex Naming Schemes

Post by Gruff10 »

Thanks. That worked, though the ":"s in the episode titles are a pain as well. At least the Validate button clears them ;)
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Plex Naming Schemes

Post by rednoah »

Additional customizations like this will do the job:

Code: Select all

{n.colon(' - ')}

The {plex} format does take care of these corner cases already, and if you need all of those but if you want more control, then you can start with a format such as this, and then modify it to your needs:

Code: Select all

TV Shows/{n}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}
:idea: The .replaceAll(/[!?.]+$/) bit is responsible for removing trailing !?. so you could just cut that bit.
:idea: Please read the FAQ and How to Request Help.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 »

Thanks again for the reply.

Ok, I started over.

So I went to the website and copied what you had in the script window for Execute FileBot (PackageFinished) and the went into JDownloader2 and created the event script.

Am I supposed to download this instead of copying the code and if so where do I store it so JDownloader2 can find it?

I changed only var script = JD_HOME + '/jdownloader-postprocess.sh' to var script = ['C:\\Windows\\System32\\cmd.exe', '-c', 'C:\\jdownloader-postprocess.cmd']

I then went on to do the same with the other script I went to the website and copied what you had in the script window for Execute FileBot (ArchiveExtracted) and the went into JDownloader2 and created the event script.

Am I supposed to download this instead of copying the code and if so where do I store it so JDownloader2 can find it?

I changed only var script = JD_HOME + '/jdownloader-postprocess.sh' to var script = ['C:\\Windows\\System32\\cmd.exe', '-c', 'C:\\jdownloader-postprocess.cmd']

I then downloaded the jdownloader-postprocess.cmd from the website.

In that file I only changed set CONFIG_OUTPUT=%USERPROFILE%/Media to set CONFIG_OUTPUT="F:\Media"

**** Question : Is this supposed to point to where my files I want processed are or where I want them to goto? ********

So after all of that I ran a Test Run in the Scripter in JDownloader2 and it came back with errors still.

The first picture is what I did in JDownloader2 including what my script looks like. I noticed it highlights somethings are they errors?

Image

https://drive.google.com/file/d/1P98dvB ... sp=sharing

The next picture is what JDownloader gives me as my error and it seems like it is the same as before.

Image

https://drive.google.com/file/d/1BFGiEP ... sp=sharing

I do want to get more advance with this later and I have been reading up on Filebot and AMC but I just want the basic for now.

Anymore thoughts, and again this is my first time trying this and using java to do it so I really do apologize for my ignorance.
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

1.
I think you need to copy & paste them into the UI. JD will store them in some file somewhere, but we don't need to care about that.


2.
Yes, the output option refers to the destination folder where files will end up. The input folder / file / name / label is passed in via command-line arguments 1, 2 and 3 so that's something JD will pass along to our cmd script via the JD event scripts. You don't need to worry about that.


3.
Didn't you already confirm that JD can make that call? Did you check where cmd.exe is actually located? Or did it work by just calling the *.bat file directly?


4.
Note that everything we're doing here has nothing to do with Java or FileBot specifically. We're just trying to get JD to call a command, could be any command. :lol:
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

I see an issue with the script, because it doesn't work if var script is suddenly an array of command and arguments, instead of just the executable path.


Remove this line:

Code: Select all

var script = JD_HOME + '/jdownloader-postprocess.sh'
Change this line:

Code: Select all

var command = [script, path, name, label, 'PACKAGE_FINISHED']
to this:

Code: Select all

var command = ['C:\\Windows\\System32\\cmd.exe', '-c', 'C:\\jdownloader-postprocess.cmd', path, name, label, 'PACKAGE_FINISHED']

:idea: Because before, var script was suddenly an array, instead of a file path, and so that didn't work at all.
:idea: Please read the FAQ and How to Request Help.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 »

Ok, so I made the changes and it didn't give me any errors in the JDownloader2 GUI scripter but nothing seemed to happen.

Currently this is what it looks like:

Code: Select all

var path = package.getDownloadFolder()
var name = package.getName()
var label = package.getComment() ? package.getComment() : 'N/A'
var links = package.getDownloadLinks() ? package.getDownloadLinks() : []

function isReallyFinished() {
    for (var i = 0; i < links.length; i++) {
        if (links[i].getArchive() != null && links[i].getExtractionStatus() != "SUCCESSFUL" || !package.isFinished()) {
            return false
        }
    }
    return true
}

if (isReallyFinished()) {
    var command = ['C:\\Windows\\System32\\cmd.exe', '-c', 'C:\\jdownloader-postprocess.cmd', path, name, label, 'PACKAGE_FINISHED']
    log(command)
    log(callSync(command))
}
This is what the log says which still makes me feel it is calling it and working. Correct me if I am wrong.

Code: Select all

------------------------Thread: 3968:ScriptEnvironment.log-----------------------
--ID:3968TS:1548172736591-1/22/19 10:58:56 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> [ "C:\\Windows\\System32\\cmd.exe", "-c", "C:\\jdownloader-postprocess.cmd", "C:\\Users\\Chris Chester\\AppData\\Local\\JDownloader 2.0", "Example FilePackage Name", "N/A", "PACKAGE_FINISHED" ]
--ID:3968TS:1548172739263-1/22/19 10:58:59 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> Microsoft Windows [Version 10.0.17763.253]
(c) 2018 Microsoft Corporation. All rights reserved.
As far as everything else

1) Ok thats what I was thinking.

2) Ok that clears that up and what I was thinking in how it worked.

3) I thought I did confirm that JD makes the call but I could be wrong cmd.exe is located in C:\Windows\System32 which is where you are pointing it. As far as the jdownloader-postprocess.cmd file yes I did run it on its own from the command line to check to see if it ran correctly and it did before but not now. I get the following when I run it on its own:

Code: Select all

C:\>jdownloader-postprocess.cmd
Locking C:\Users\Chris Chester\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Tue Jan 22 10:59:38 EST 2019]
Parameter: skipExtract = y
Parameter: unsorted = y
Parameter: music = y
Parameter: artwork = y
Parameter: excludeList = excludes.txt
Parameter: ut_dir =
Parameter: ut_kind = multi
Parameter: ut_title =
Parameter: ut_label =
Illegal usage: no input
Failure (°_°)
4. Ok thanks for pointing that out because I was sure.
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

Is this all? Is there no next line that shows FileBot running and saying things?

Code: Select all

------------------------Thread: 3968:ScriptEnvironment.log-----------------------
--ID:3968TS:1548172736591-1/22/19 10:58:56 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> [ "C:\\Windows\\System32\\cmd.exe", "-c", "C:\\jdownloader-postprocess.cmd", "C:\\Users\\Chris Chester\\AppData\\Local\\JDownloader 2.0", "Example FilePackage Name", "N/A", "PACKAGE_FINISHED" ]
--ID:3968TS:1548172739263-1/22/19 10:58:59 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> Microsoft Windows [Version 10.0.17763.253]
(c) 2018 Microsoft Corporation. All rights reserved.
In a previous log, you already showed that JD is calling FileBot, and that we can see FileBot console output from JD:

Code: Select all

--ID:2152TS:1548143061629-1/22/19 2:44:21 AM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> Locking C:\Users\Chris Chester\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Tue Jan 22 02:44:20 EST 2019]
:?: That's what we wanna see. How did you get there before? :lol:


Maybe this is bad?

Code: Select all

var command = ['C:\\Windows\\System32\\cmd.exe', '-c', 'C:\\jdownloader-postprocess.cmd', path, name, label, 'PACKAGE_FINISHED']
And this is good?

Code: Select all

var command = ['C:\\jdownloader-postprocess.cmd', path, name, label, 'PACKAGE_FINISHED']
IDK. Maybe. There's a reason I don't use Windows. :lol:


3.
If you call the cmd script with no arguments, i.e. no input, then this is the expected console output.
:idea: Please read the FAQ and How to Request Help.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 »

For the first part of your question. Yes that was all it gave me. (Is there a better way to do the logs to see what is going on)

In the previous log that showed that it was working it might have been when I ran the post processing command file on its own. I don't remember at this point. I was tring test test everything to see what worked to narrow down where the issue started.

I don't understand the issue and why it is not working.

If I bring up a run dialog in windows and type "cmd" and hit enter the command window opens but no matter which way I try it with the script it wont launch it like it did with "notepad".

Since the "postprocessing cmd file" was running correctly is there not another way to tell the script to just launch that file instead of trying to go through the command program?
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

Well, this line should just call the *.cmd file, which might work?

Code: Select all

    var command = ['C:\\jdownloader-postprocess.cmd', path, name, label, 'PACKAGE_FINISHED']
    log(command)
    log(callSync(command))
:idea: Please read the FAQ and How to Request Help.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 »

Ok, I deleted everything in the script and added what you said.

On test run it came back with the error:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: ReferenceError: "path" is not defined. (#1)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3629)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3613)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3683)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.name(ScriptRuntime.java:1690)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1622)
at script(:1)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411)
at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory.doTopCall(JSHtmlUnitPermissionRestricter.java:119)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3057)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1212)
at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:254)
at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:148)
at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:128)
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

Well, that was only a snippet. It won't work with the path / name / label variables are not defined...


Anyway, let's try this:

Code: Select all

var script = 'C:\\jdownloader-postprocess.cmd'

var path = package.getDownloadFolder()
var name = package.getName()
var label = package.getComment() ? package.getComment() : 'N/A'
var links = package.getDownloadLinks() ? package.getDownloadLinks() : []

function isReallyFinished() {
	for (var i = 0; i < links.length; i++) {
		if (links[i].getArchive() != null && links[i].getExtractionStatus() != "SUCCESSFUL" || !package.isFinished()) {
			return false
		}
	}
	return true
}

if (isReallyFinished()) {
	var command = [script, path, name, label, 'PACKAGE_FINISHED']
	log(command)
	log(callSync(command))
}
:idea: Please read the FAQ and How to Request Help.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by chest069 »

Ok I put in what you said the log file says this:

Code: Select all

------------------------Thread: 4454:ScriptEnvironment.log-----------------------
--ID:4454TS:1548178299692-1/22/19 12:31:39 PM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> [ "C:\\jdownloader-postprocess.cmd", "C:\\Users\\Chris Chester\\AppData\\Local\\JDownloader 2.0", "Example FilePackage Name", "N/A", "PACKAGE_FINISHED" ]
--ID:4454TS:1548178310151-1/22/19 12:31:50 PM -  [org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment(log)] -> Locking C:\Users\Chris Chester\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Tue Jan 22 12:31:45 EST 2019]
Parameter: skipExtract = y
Parameter: unsorted = y
Parameter: music = y
Parameter: artwork = y
Parameter: excludeList = excludes.txt
Parameter: ut_dir = C:\Users\Chris Chester\AppData\Local\JDownloader 2.0
Parameter: ut_kind = multi
Parameter: ut_title = Example FilePackage Name
Parameter: ut_label = N/A
Does this mean it is working somewhat?
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

Yep, that means it's working. :lol:
:idea: Please read the FAQ and How to Request Help.
JStrach
Posts: 5
Joined: 22 Jan 2019, 20:39

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by JStrach »

Hi, I created the events as well as the cmd file (running on Windows 10), but am having issues getting filebot to run. I've looked at the logs, and from what I can gather, the event script for running after the package finishes is actually set up to work fine. If I test run it from the edit dialog, it actually calls the cmd file, and filebot runs according to the filebot log. The issue seems to be that the event is never actually called once a package is finished. Does anyone know why this would be?
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

JStrach wrote: 22 Jan 2019, 20:43 Hi, I created the events as well as the cmd file (running on Windows 10), but am having issues getting filebot to run. I've looked at the logs, and from what I can gather, the event script for running after the package finishes is actually set up to work fine. If I test run it from the edit dialog, it actually calls the cmd file, and filebot runs according to the filebot log. The issue seems to be that the event is never actually called once a package is finished. Does anyone know why this would be?
Presumably, the event script is called, but the isReallyFinished() returns false for some reason. Maybe at lots of logging for all the variables & conditions will help you figure out why:
https://github.com/filebot/plugins/blob ... inished.js
:idea: Please read the FAQ and How to Request Help.
JStrach
Posts: 5
Joined: 22 Jan 2019, 20:39

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by JStrach »

rednoah wrote: 22 Jan 2019, 22:06 Presumably, the event script is called, but the isReallyFinished() returns false for some reason. Maybe at lots of logging for all the variables & conditions will help you figure out why:
https://github.com/filebot/plugins/blob ... inished.js
If that were the case, wouldn't there be a record of the event being called in the event scripter log? I don't see any instances of it being called after a package finishes, only when I perform a test run. Also, there are no logs for the archive extraction event, from test runs or real-world runs. Does it need to run first for the package finish run to be called properly? Should it be showing up in the event log?
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

You can log to the JD log in your event script like this:

Code: Select all

log("Hello World")
The JD forums might help with details on how to debug JD issues.
:idea: Please read the FAQ and How to Request Help.
JStrach
Posts: 5
Joined: 22 Jan 2019, 20:39

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by JStrach »

I'm not sure what the problem was, but going into the WebUI and replacing all the code with the JSON script for package finished caused it to run smoothly. It seems like that might be all that's needed to run properly?
JStrach
Posts: 5
Joined: 22 Jan 2019, 20:39

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by JStrach »

After implementing just the JSON script, I see that you were right, the problem was that it was running prior to being truly finished, as I discovered when Filebot couldn't move the file since it was still being used by JDownloader. I hadn't realized that the only way the logs would register the event scripter running was if isReallyFinished returned true (I figured the system would have some kind of logs any time a script is kicked off, that doesn't seem to be the case). I think this would be fixed by taking if(isReallyFinished()) and turning it into while(!isReallyFinished()), then taking the code that was previously inside the if statement out, and moving it to after the now-empty while loop. Am I correct in that thinking? And would that make the ArchiveExtracted.js event unnecessary?
User avatar
rednoah
The Source
Posts: 22898
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [JDownloader] Setup for Windows, Linux and Mac OS X

Post by rednoah »

Ideally, calling a tool on download complete should be straight forward. Unfortunately, JD and event script don't make it easy. The script may be called many times, before or after download complete, before or after extract.

The only thing these two event scripts are trying to do, is to just call filebot, either after download complete, or after extract complete, whichever makes sense, but not two times, and not zero times either.

If it's not working as expected, you'll just have to sprinkle in lots of log() statements, then check the log, and then figure out what's happening, and why it's doing or not doing things.
:idea: Please read the FAQ and How to Request Help.
Post Reply