## POSTBUCKET - where random posts in unrelated topics go

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

1.
Did you just "Save as..." a web page and then run it as CMD script?

Here's what a CMD script looks like:
https://raw.githubusercontent.com/fileb ... rocess.cmd

Here's what a HTML web page looks like:
https://raw.githubusercontent.com/fileb ... index.html

2.
Now, the first step is to actually have a working cmd script, but then it'll still probably not work right away, because Windows, and then we're back to where we started.

I'm not sure if this tutorial is for you. Looks like you're gonna struggle hard every step of the way.

3.
Here's some general debugging tips. (a) You can't execute a folder. (b) Read the error message. Doesn't this look strange? No \ here? That's because in "..." the \ character almost always has special meaning, meaning that you can't use it literally. (not your fault, Windows engineers made really really bad decisions back in the 80ies, and their mistakes are still coming back to haunt us all)

Code: Select all

Cannot run program "C:Windows System32"
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

LOL, apparently that is what I did, now that I look at both of them. I assumed what was there was what i needed so yeah I copied it. Oh well. Sorry for the frustration on my user error.

I saved the file that you just posted.

I will test things but running the cmd on it's own to see if it work then move back to the scripter.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Ok, well I tried what you suggested and I get the following when running the command file you created from the command line on it's own.

Locking C:\Users\Chris Chester\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Mon Jan 21 10:50:59 EST 2019]
Parameter: skipExtract = y
Illegal usage: no input
Failure (°_°)

I also tried the script again just to see if would at least launch it even if it failed but I get nothing. I can't seem to find the correct log either.

log(command)
log(callSync(command))

I will keep trying and thanks for all the help. Sorry about the mistakes.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

Ok, well I tried what you suggested and I get the following when running the command file you created from the command line on it's own.

Code: Select all

C:\>jdownloader-postprocess.cmd
Locking C:\Users\Chris Chester\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Mon Jan 21 10:50:59 EST 2019]
Parameter: skipExtract = y
Illegal usage: no input
Failure (°_°)
I also tried the script again just to see if would at least launch it even if it failed but I get nothing. I can't seem to find the correct log either.

Code: Select all

var command = ['/jdownloader-postprocess.cmd']
log(command)
log(callSync(command))
I will keep trying and thanks for all the help. Sorry about the mistakes.
Gruff10
Posts: 2
Joined: 21 Jan 2019, 21:41

Hi,

NOOB here

Using

Code: Select all

{plex.derive{" [$vf.$vc.$ac]"}} I find that the TV series 24 (Twenty Four) fails because the fullstops in its episode titles are being replaced (see output below). https://ibb.co/87vTcrF How can I get around this? Thanks. rednoah The Source Posts: 19366 Joined: 16 Nov 2011, 08:59 Location: Taipei Contact: ### Re: Plex Naming Schemes Yes, the {plex} format does indeed strip trailing "." characters from the Plex path. In your case, that's unnecessary, but the {plex} binding can't know that. e.g. Code: Select all $ filebot -list --q 24 --format {plex} --filter "s == 1 && e <= 3"
TV Shows/24/Season 01/24 - S01E01 - 12.00 A.M. - 1.00 A.M
TV Shows/24/Season 01/24 - S01E02 - 1.00 A.M. - 2.00 A.M
TV Shows/24/Season 01/24 - S01E03 - 2.00 A.M. - 3.00 A.M

If want to preserve the trailing "." then you can use a full custom format such as this:

Code: Select all

TV Shows/{n}/Season {s.pad 2}/{n} - {s00e00} - {t} [{vf}.{vc}.{ac}]
rednoah
The Source
Posts: 19366
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Probably more like this:

Code: Select all

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

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))

I found the log I think for it:

Code: Select all

------------------------Thread: 1792:ScriptEnvironment.log-----------------------

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

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>
(c) 2018 Microsoft Corporation. All rights reserved.
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

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-----------------------
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.
rednoah
The Source
Posts: 19366
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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']


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"
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).
Gruff10
Posts: 2
Joined: 21 Jan 2019, 21:41

### Re: Plex Naming Schemes

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

### Re: Plex Naming Schemes

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}
The .replaceAll(/[!?.]+$/) bit is responsible for removing trailing !?. so you could just cut that bit. 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 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? 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. 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. rednoah The Source Posts: 19366 Joined: 16 Nov 2011, 08:59 Location: Taipei Contact: ### Re: [JDownloader] Setup for Windows, Linux and Mac OS X 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. Please read the FAQ and How to Request Help. rednoah The Source Posts: 19366 Joined: 16 Nov 2011, 08:59 Location: Taipei Contact: ### Re: [JDownloader] Setup for Windows, Linux and Mac OS X 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'] Because before, var script was suddenly an array, instead of a file path, and so that didn't work at all. 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 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. rednoah The Source Posts: 19366 Joined: 16 Nov 2011, 08:59 Location: Taipei Contact: ### Re: [JDownloader] Setup for Windows, Linux and Mac OS X 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? 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. 3. If you call the cmd script with no arguments, i.e. no input, then this is the expected console output. 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 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? rednoah The Source Posts: 19366 Joined: 16 Nov 2011, 08:59 Location: Taipei Contact: ### Re: [JDownloader] Setup for Windows, Linux and Mac OS X 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)) 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 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)
rednoah
The Source
Posts: 19366
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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 name = package.getName()
var label = package.getComment() ? package.getComment() : 'N/A'

function isReallyFinished() {
for (var i = 0; i < links.length; i++) {
return false
}
}
return true
}

if (isReallyFinished()) {
var command = [script, path, name, label, 'PACKAGE_FINISHED']
log(command)
log(callSync(command))
}
chest069
Posts: 24
Joined: 01 Jan 2014, 11:09

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

Code: Select all

------------------------Thread: 4454:ScriptEnvironment.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_kind = multi
Parameter: ut_title = Example FilePackage Name
Parameter: ut_label = N/A`
Does this mean it is working somewhat?
rednoah
The Source
Posts: 19366
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact: