The script is
Code: Select all
#!/bin/sh
# org.jdownloader.extensions.eventscripter.EventScripterExtension.scripts.json
# [{"eventTrigger":"ON_PACKAGE_FINISHED","enabled":true,"name":"Execute FileBot (PackageFinished)","script":"var script = JD_HOME + '/jdownloader-postprocess.sh'\n\nvar path = package.getDownloadFolder()\nvar name = package.getName()\nvar label = package.getComment() ? package.getComment() : 'N/A'\n\nvar command = [script, path, name, label, 'PACKAGE_FINISHED']\n\nlog(command)\nlog(callSync(command))\n","eventTriggerSettings":{}} ]
# Input Parameters
ARG_PATH="$1"
ARG_NAME="$2"
ARG_LABEL="$3"
# Configuration
CONFIG_OUTPUT="$HOME/Videos/1copy"
filebot -script fn:amc --output "$CONFIG_OUTPUT" --action duplicate --conflict skip -non-strict --log-file amc.log --def skipExtract=y unsorted=y music=y artwork=y excludeList=".excludes" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" --format "{n} - {sxe} - {t} ({af})" #--def @/opt/jDownloader/jd2/args.txt
printenv > "$HOME/Videos/log"
and the
"Package Finished" Event is copied from the original with the first line, i.e., the path, modified.
Code: Select all
var script = '/opt/jDownloader/jd2/jdownloader-postprocess.sh'
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))
}
Note that I tried it out in the script without the
args.txt, which did nothing at all. Removing the
Code: Select all
--format "{n} - {sxe} - {t} ({af})"
and inserting
Code: Select all
--def @/opt/jDownloader/jd2/args.txt
gave me the result that
opt/jDownloader/jd2 gets processed.