JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 20.03.2025, 12:35
Mark5564 Mark5564 is offline
Baby Loader
 
Join Date: May 2023
Posts: 7
Default Run script for the Tinymediamanager

Hello

I have created a batch file which ensures that the Tinymediamanager automatically reregisters the sources and then scrapes them.

The content of the batch file is as follows:

start C\Users\marku\AppData\Local\Programs\tinyMediaManagerV5\tinyMediaManagercmd.exe -update -scrapeUnscraped -rename

but unfortunately I have no idea how to set this up in Jdownloader2 so that the batch is triggered at the end of the download or rather after unpacking.

urgently need help with this

Last edited by Mark5564; 20.03.2025 at 12:51.
Reply With Quote
  #2  
Old 21.03.2025, 10:18
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,269
Default

@Mark5564 You can make use of Eventscripter, see https://support.jdownloader.org/de/k...event-scripter
search board for callasync method and you'll find many examples
for example https://board.jdownloader.org/showth...ight=callasync
I suggest to trigger script on download finish and extraction finish

But I would recommend to use multiple scripts
1.) move finished downloads/extracted files to somewhere else
2.) then call your command
because it *renames* the files and by that breaking JDownloader entry -> file on disk connection.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 23.03.2025, 13:39
Mark5564 Mark5564 is offline
Baby Loader
 
Join Date: May 2023
Posts: 7
Default

after reading a lot, but having no idea about it, i did this with my limited knowledge.

// Führt eine Batch-Datei aus, nachdem das Entpacken abgeschlossen ist
var filePath = "C:\Users\marku\AppData\Local\Programs\tinyMediaManagerV5\new_file_scan.bat"; // Hier den korrekten Pfad zur Batch-Datei eingeben
if (isDownloadControllerStopping() == false) {callSync(filePath);}

but unfortunately it doesn't work as intended
Reply With Quote
  #4  
Old 24.03.2025, 10:06
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,269
Default

@Mark5564: Are you german?
Does your new_file_scan.bat script run at fixed directory or does it use the current working directory? if cwd, then you have to change that part as well.

isDownloadControllerStopping -> I don't think that's the method you want to use, see
"Check if Download Controller is in STOPPING State (Still running, but stop has been pressed)"
You want the trigger download finished, not when all downloads have stopped, don't you?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 24.03.2025, 11:00
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,689
Default

Escape the file path.

Code:
var filePath = "C:\\Users\\marku\\AppData\\Local\\Programs\\tinyMediaManagerV5\\new_file_scan.bat";

callSync(filePath);

Assuming it only processes media files, create two scripts with same code. One with "package finished" another with "archive extraction finished" trigger.
Reply With Quote
  #6  
Old 24.03.2025, 20:49
Mark5564 Mark5564 is offline
Baby Loader
 
Join Date: May 2023
Posts: 7
Default

Quote:
Originally Posted by Jiaz View Post
@Mark5564: Are you german?
Does your new_file_scan.bat script run at fixed directory or does it use the current working directory? if cwd, then you have to change that part as well.

isDownloadControllerStopping -> I don't think that's the method you want to use, see
"Check if Download Controller is in STOPPING State (Still running, but stop has been pressed)"
You want the trigger download finished, not when all downloads have stopped, don't you?
Ja, ich bin Deutscher.
Reply With Quote
  #7  
Old 24.03.2025, 23:58
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 82,269
Default

@Mark5564: Danke der Rückmeldung! Hängst noch immer bei der Umsetzung?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #8  
Old 25.03.2025, 16:02
Mark5564 Mark5564 is offline
Baby Loader
 
Join Date: May 2023
Posts: 7
Default

Quote:
Originally Posted by Jiaz View Post
@Mark5564: Danke der Rückmeldung! Hängst noch immer bei der Umsetzung?
Ja, leider. Komme nicht so richtig weiter.
Reply With Quote
  #9  
Old 25.03.2025, 16:37
pspzockerscene's Avatar
pspzockerscene pspzockerscene is online now
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 74,677
Default

@Mark5564
Klappt denn das Ausführen einer beliebigen Batch Datei über den EventScripter prinzipiell bei dir?

Hier meine Tipps:
Erstelle dir eine simple batch Datei, die nichts weiter tut als einen Windows Dialog anzuzeigen.
Beispiel:
Code:
@echo off
for /f "tokens=*" %%a in ('mshta "javascript:var r=prompt('Gib etwas ein:','');close();r;"') do set "eingabe=%%a"
echo Du hast eingegeben: %eingabe%
pause
Wenn die geht, erstelle ein Script, das diese ausführt und triggere/teste es.

Verwende erst deine gewollte batch Datei, wenn du sicher bisht, dass die Ausführung geht und teste die Batch natürlich vorher außerhalb vom EventScripter.
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #10  
Old 25.03.2025, 20:07
Mark5564 Mark5564 is offline
Baby Loader
 
Join Date: May 2023
Posts: 7
Default

@pspzockerscene
Vielen Dank fur Deine Hilfe.

Wenn ich die Datei am PC selber ausführe, funktioniert diese einwandfrei, die Test datei wie von Dir vorgegeben auch.

// Führt eine Batch-Datei aus, nachdem das Entpacken abgeschlossen ist
var filePath = "W:\Dokumente\@echo off.bat"; // Hier den korrekten Pfad zur Batch-Datei eingeben
if (isDownloadControllerStopping() == false) {callSync(filePath);}

Im Skript Editor kommt diese Fehlermeldung:

Wrapped org.jdownloader.extensions.eventscripter.EnvironmentException: Line 3
java.io.IOException: Cannot run program "W:Dokumente@echo off.bat": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:87)
at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:70)
at org.appwork.utils.processes.ProcessBuilderFactory.runCommand(ProcessBuilderFactory.java:65)
at org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callSync(ScriptEnvironment .java:350)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:153)
at net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod.call(NativeJavaMethod.java:213)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1536)
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(JSHtmlUnitP ermissionRestricter.java:134)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3286)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1361)
at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:346)
at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:194)
at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:174)
Caused by: java.io.IOException: CreateProcess error=2, Das System kann die angegebene Datei nicht finden
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:453)
at java.lang.ProcessImpl.start(ProcessImpl.java:139)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 21 more
Reply With Quote
  #11  
Old 25.03.2025, 23:17
FBD's Avatar
FBD FBD is offline
Fibre Channel User
 
Join Date: Nov 2018
Location: https://web.libera.chat/#jDownloader
Posts: 117
Default

Quote:
Originally Posted by Mark5564 View Post
java.io.IOException: Cannot run program "W:Dokumente@echo off.bat": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
Da gibt es diese Datei einfach nicht, checke den Dateinamen den du da angegeben hast. Der sollte doch sicher kein @ Zeichen im Dateinamen haben und nicht wirklich "@echo off.bat" heissen, oder?

Und wie mgpai oben schon gepostet hat, musst du bei Windows die umgekehrten Schrägstriche (Backslashes) escapen, also verdoppeln:
Code:
also aus "W:\Dokumente" wird "W:\\Dokumente"
Übrigens, der callSync Befehl ist keine Kommandozeile! Du kannst nicht einfach den Programm-Namen und Programm-Parameter in einem String übergeben, sie müssen als separate Parameter angegeben werden, also z.B. so:
Code:
callSync("W:\\Dokumente\\BatchDatei.cmd","-update","-scrapeUnscraped","-rename")
Wäre gut wenn du dein gesamtes Script mal hier postest, ab besten mit dem "CODE" tags damit es nicht vom Forum umformatiert wird.
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader
Reply With Quote
Reply

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 11:39.
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 - 2025, Jelsoft Enterprises Ltd.