amc script processing jDownloader folder

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
j3124249
Posts: 13
Joined: 26 Jan 2016, 11:25

amc script processing jDownloader folder

Post by j3124249 »

Hi!
I've copied the codes from the .js files into to the jDownloader Event Scripter (is there a way to import them btw?) and changed the first line to

Code: Select all

var script = '/opt/jDownloader/jd2/jdownloader-postprocess.sh'
since this is where jDownloader is located and I just put the .sh in there. But if I do a test run (or if the event is triggered), filebot processes the folder /opt/jDownloader/jd2/ and not in the download folder of the file(s). Where is my mistake?

Also, if the input folder is called "new" and the output folder is called "newSeries", I get an error that the output folder must not be in the input folder - but that issue is fixable by renaming "newSeries".
User avatar
rednoah
The Source
Posts: 23061
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: amc script processing jDownloader folder

Post by rednoah »

Please post the sh script you're executing and any logs that are produced by that script.
:idea: Please read the FAQ and How to Request Help.
j3124249
Posts: 13
Joined: 26 Jan 2016, 11:25

Re: amc script processing jDownloader folder

Post by j3124249 »

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

Re: amc script processing jDownloader folder

Post by rednoah »

1.
What does amc.log say? If you don't tell us what the process output says, how would anyone ever be able find out what's going on? :lol:


2.
What is the value of $HOME in the environment in which this script is called?
:idea: Please read the FAQ and How to Request Help.
j3124249
Posts: 13
Joined: 26 Jan 2016, 11:25

Re: amc script processing jDownloader folder

Post by j3124249 »

rednoah wrote:1.
What does amc.log say? If you don't tell us what the process output says, how would anyone ever be able find out what's going on? :lol:

Code: Select all

Run script [fn:amc] at [Fri Sep 23 12:08:17 CEST 2016]
Parameter: skipExtract = y
Parameter: unsorted = y
Parameter: music = y
Parameter: artwork = y
Parameter: excludeList = amc.txt 
Parameter: ut_dir = /opt/jDownloader/jd2
Parameter: ut_kind = multi
Parameter: ut_title = Example FilePackage Name
Parameter: ut_label = N/A
Parameter: movieFormat = {n} ({y}) ({vf} - {af})
Parameter: seriesFormat = {n} - {sxe} - {t} ({af})
Creating excludes: /home/XXX/Videos/1copy/amc.txt 
Ignore hidden folder: /opt/jDownloader/jd2/.install4j
Ignore hidden folder: /opt/jDownloader/jd2/jre/bin
Ignore hidden folder: /opt/jDownloader/jd2/jre/lib
Ignore hidden folder: /opt/jDownloader/jd2/tmp
Input: /opt/jDownloader/jd2/themes/standard/org/jdownloader/sounds/captcha.wav
Exclude: /opt/jDownloader/jd2/licenses/CreativeCommonsAttributionShareAlikeUnported3.txt
Exclude: /opt/jDownloader/jd2/licenses/LGPL.txt
Exclude: /opt/jDownloader/jd2/licenses/svnkit.jar.info
...
Exclude: /opt/jDownloader/jd2/error.log
Exclude: /opt/jDownloader/jd2/JD2.lock
Group: [music:sounds] => [captcha.wav]
Rename music using ID3
Invalid media file: /opt/jDownloader/jd2/themes/standard/org/jdownloader/sounds/captcha.wav
Failed to process music file: /opt/jDownloader/jd2/themes/standard/org/jdownloader/sounds/captcha.wav
Failed to identify or process any files
Processing 1 unsorted files
[DUPLICATE] Rename [/opt/jDownloader/jd2/themes/standard/org/jdownloader/sounds/captcha.wav] to [/home/XXX/Videos/1copy/Unsorted/sounds/captcha.wav]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
I replaced my username with XXX and replaced the Exclude: lines with ... since it is just subfolders of /opt/jDownloader/jd2/ and the post was too long ;)
2.
What is the value of $HOME in the environment in which this script is called?

Code: Select all

echo $HOME
gives me /home/XXX
User avatar
rednoah
The Source
Posts: 23061
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: amc script processing jDownloader folder

Post by rednoah »

The amc is given that folder as input, so it's just doing what it's told to do:

Code: Select all

Parameter: ut_dir = /opt/jDownloader/jd2
So the issue is in the JD2 script:

Code: Select all

var path = package.getDownloadFolder()
...
var command = [script, path, name, label, 'PACKAGE_FINISHED']
package.getDownloadFolder() is /opt/jDownloader/jd2 for some reason. I don't know if that's correct or a bug. There's nothing I can do if JD2 passes the wrong download path. Please ask the JD2 developer for help.


PS: So you have set JD2 to download files into your /opt/jDownloader/jd2 folder?
:idea: Please read the FAQ and How to Request Help.
j3124249
Posts: 13
Joined: 26 Jan 2016, 11:25

Re: amc script processing jDownloader folder

Post by j3124249 »

rednoah wrote:T
PS: So you have set JD2 to download files into your /opt/jDownloader/jd2 folder?
No, the download folder ist $HOME/Videos/new. I initially wanted to move the processed files to $HOME/Videos/newSeries. But somehow the script told me that the output folder is inside the input folder, that's why I renamed it to $HOME/Videos/1copy.

Thanks for your help, I'll play around a bit and ask the JD devs if the problem does not get resolved.
User avatar
rednoah
The Source
Posts: 23061
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: amc script processing jDownloader folder

Post by rednoah »

Code: Select all

package.getDownloadFolder()
JD2 seems to think your download folder is the JD2 program files folder... That might be a bug. Please report back if you find a solution to this problem. ;)
:idea: Please read the FAQ and How to Request Help.
j3124249
Posts: 13
Joined: 26 Jan 2016, 11:25

Re: amc script processing jDownloader folder

Post by j3124249 »

Little update: I figured it little fix out. I have a rule in the packagizer which puts every download in a package with today's date. If I deactivate this, it works...
But now, the script is downloading covers and all that stuff too... Guess I have to fix this too.

I will contact the devs today about the issue with the packagizer.
j3124249
Posts: 13
Joined: 26 Jan 2016, 11:25

Re: amc script processing jDownloader folder

Post by j3124249 »

Before contacting the devs I wanted to play around a bit and strangely it worked all the time. Then I thought, I'll reproduce what happened when I started the post and to my surprise now it works too. The only thing I changed was the package name... and then reverted those changes. Mysterious!

If something unexpected happens in the future I'll let you know, but for now it works as it should. Thanks for your help!

Ps: sorry for double posting.
Post Reply