JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03.11.2021, 20:07
smokiemamour smokiemamour is offline
JD Beta
 
Join Date: Sep 2019
Posts: 55
Default SyntaxError: Unterminated object literal (#17)

good evening, I have an error message:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: SyntaxError: Unterminated object literal (#17)
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.NativeJSON.parse(NativeJSON.java:125)
at net.sourceforge.htmlunit.corejs.javascript.NativeJSON.execIdCall(NativeJSON.java:97)
at net.sourceforge.htmlunit.corejs.javascript.IdFunctionObject.call(IdFunctionObject.java:89)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1531)
at script(:17)
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: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:320)
at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:180)
at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:155)


here is the Convert AAC / M4A / OGG files to MP3 script :
// Convert aac/m4a/ogg files to mp3.
// Trigger required: "A Download Stopped".
// Requires ffmpeg/ffprobe. Uses JD ffmpeg/ffprobe settings if available.
// Overwrites destination file (mp3) if it already exists.

if (link.isFinished()) {
var fileName = link.name.replace(/(.+)(\..+$)/, "$1");
var fileType = link.name.replace(/(.+)(\..+$)/, "$2");
var sourceFile = link.getDownloadPath();
var audioFile = /\.(aac|m4a|ogg)$/.test(sourceFile);

if (audioFile) {
var downloadFolder = package.getDownloadFolder();
var destFile = downloadFolder + "/" + fileName + ".mp3";
var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath");
var ffprobe = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypathprobe");
var data = JSON.parse(callSync(ffprobe, "-v", "quiet", "-print_format", "json", "-show_streams", "-show_format", sourceFile));
var streamsBitrate = data.streams[0].bit_rate ? data.streams[0].bit_rate : 0;
var formatBitrate = data.format.bit_rate ? data.format.bit_rate : 0;
var bitrate = Math.max(streamsBitrate, formatBitrate) / 1000;
var deleteSourceFile = false; // Set this to true to delete source file after conversion.

if (bitrate > 0) {
callSync(ffmpeg, "-y", "-i", sourceFile, "-b:a", bitrate + "k", destFile);
if (deleteSourceFile && getPath(destFile).exists()) deleteFile(sourceFile, false);
}
}
}

Can you help me ?
Reply With Quote
  #2  
Old 04.11.2021, 11:52
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Try the alternate version from THIS post.
Reply With Quote
  #3  
Old 04.11.2021, 13:52
smokiemamour smokiemamour is offline
JD Beta
 
Join Date: Sep 2019
Posts: 55
Default

Hello, thank you, I am testing this and coming back to my post to say if it is resolved or not.
If that doesn't bother of course.
Thank you for your reply.
Reply With Quote
  #4  
Old 04.11.2021, 14:00
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by smokiemamour View Post
If that doesn't bother of course.
Not a bother. Report back as many time necessary till it is solved.
Reply With Quote
  #5  
Old 04.11.2021, 14:15
smokiemamour smokiemamour is offline
JD Beta
 
Join Date: Sep 2019
Posts: 55
Default

:thumbup:
Reply With Quote
  #6  
Old 04.11.2021, 16:44
smokiemamour smokiemamour is offline
JD Beta
 
Join Date: Sep 2019
Posts: 55
Default

Hello, it is settled that to work, can you tell me what was wrong with the script which I had to recover in the message of MGPAI?
Thank you so much
the subject is solved
I do not know how the subject goes in resolved?
Reply With Quote
  #7  
Old 04.11.2021, 16:56
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by smokiemamour View Post
.... can you tell me what was wrong with the script ...
Most likely some files did not return the expected JSON object. The new script uses a different method to determine the bitrate.
Reply With Quote
  #8  
Old 04.11.2021, 17:07
smokiemamour smokiemamour is offline
JD Beta
 
Join Date: Sep 2019
Posts: 55
Default

It's okay it worked, can you explain to me what went wrong with the first script?
I saw the drbits message: Optimize your internet connection
what should I do as manipulation with Windows 10
please
Thank you for your time on my topic
Reply With Quote
  #9  
Old 04.11.2021, 20:50
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,343
Default

Quote:
Originally Posted by smokiemamour View Post
It's okay it worked, can you explain to me what went wrong with the first script?
the response from the ffmpeg tool was different/unexpected and then the parsing of the response failed
__________________
JD-Dev & Server-Admin
Reply With Quote
  #10  
Old 04.11.2021, 20:51
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,343
Default

Quote:
Originally Posted by smokiemamour View Post
I saw the drbits message: Optimize your internet connection
what should I do as manipulation with Windows 10
There is no need for any optimization.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #11  
Old 04.11.2021, 21:35
smokiemamour smokiemamour is offline
JD Beta
 
Join Date: Sep 2019
Posts: 55
Default

thanks
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 13:14.
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 - 2024, Jelsoft Enterprises Ltd.