JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #3041  
Old 11.09.2024, 15:19
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

I have never seen such happen here. What settings does it?

Spoiler:


So after a reconnect is executed and the router / modem does not get an Internet connection JD automatically reconnects after a special time?
__________________
Aktuelles Windows

Last edited by pspzockerscene; 29.10.2024 at 13:49. Reason: SPOILER Tag hinzugefügt
Reply With Quote
  #3042  
Old 11.09.2024, 15:31
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

I don't know but afik:
- It definitely tries multiple times
- If you got the same IP after a reconnect, a retry will also be triggered

If you want to discuss this topic in a deeper way, please open a new thread and describe your current problem.
As script really shouldn't be needed in this case.
__________________
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
  #3043  
Old 11.09.2024, 15:37
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

Quote:
- It definitely tries multiple times
Not here, I would say.

Quote:
If you want to discuss this topic in a deeper way, please open a new thread and describe your current problem.
Okay, mache ich nachher.
__________________
Aktuelles Windows
Reply With Quote
  #3044  
Old 14.09.2024, 12:01
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by StefanM View Post
format hh:mm:ss.xxx
Code:
/*
    generate "video_duration_formatted" property from "video_duration" property
    trigger: packagizer hook
    Enable "synchronous execution of script" checkbox in top panel
*/

if (linkcheckDone && state == "BEFORE") {
    var duration = link.getProperty("video_duration");

    if (duration != null) {
        var fmt = function(n) {
            return ("0" + parseInt(n)).slice(-2);
        }
        var [seconds, milliseconds] = ("" + duration).split(".");
        var hours = fmt(seconds / 3600);
        seconds %= 3600;
        var minutes = fmt(seconds / 60);
        seconds = fmt(seconds % 60);
        milliseconds = ((milliseconds || "000") + "000").slice(0, 3);
        duration = ([hours, minutes, seconds].join(":") + "," + milliseconds)
        link.setProperty("video_duration_formatted", duration);
    }
}

Last edited by mgpai; 03.10.2024 at 08:10.
Reply With Quote
  #3045  
Old 19.09.2024, 03:12
Fierro3612 Fierro3612 is offline
Baby Loader
 
Join Date: Jul 2024
Posts: 7
Smile [EventScripter] Downloadlist cleanup / Aufräumen der Downloadliste

[EventScripter] Downloadlist cleanup / Aufräumen

Eine Möglichkeit zum Aufräumen der Downloadliste wäre toll.
Ich meine Einträge für die es keine Files mehr im Downloadordner mehr gibt zu löschen.


Hat vielleicht schon so ein Script gesehen?

****

A way to clean up the download list would be great.
I mean deleting entries for which there are no more files in the download folder.


Has anyone seen a script like this?

Last edited by Fierro3612; 19.09.2024 at 23:00.
Reply With Quote
  #3046  
Old 20.09.2024, 14:24
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by jDX007 View Post
...
That script is to add the metadata to the descriptions text file. Which field from the media metadata appears as in the OS file properties dialog?
Reply With Quote
  #3047  
Old 20.09.2024, 14:35
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by John19234 View Post
but av doesnt scan the files instantly, I wanted a feature like fdm where it scans it instantly. I deal with files that might not be safe so I scan them before unpacking. Just want to automate it.

Also periodic av scans take time and might scan files that have already been scanned. I want a selective scan of one file.
Code:
/*
    run external command on dowloaded file
    trigger : download finished
*/


if (link.finished) {
    var program = ["/path/to/myexternalprogram.exe"];
    var parameters = ["paremeter1", "parameter2", "paremeter..."].join(",");
    var file = getPath(link.downloadPath);

    callSync(program, parameters, file);
}

Last edited by mgpai; 20.09.2024 at 20:23.
Reply With Quote
  #3048  
Old 20.09.2024, 14:45
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by Fierro3612 View Post
[EventScripter] Downloadlist cleanup / Aufräumen

Eine Möglichkeit zum Aufräumen der Downloadliste wäre toll.
Ich meine Einträge für die es keine Files mehr im Downloadordner mehr gibt zu löschen.


Hat vielleicht schon so ein Script gesehen?

****

A way to clean up the download list would be great.
I mean deleting entries for which there are no more files in the download folder.


Has anyone seen a script like this?
Code:
/*
    remove orphaned links
    trigger : jdownloader started
*/

getAllDownloadLinks().forEach(function(link) {
    link.finished && !getPath(link.downloadPath).exists() && link.remove();
})
Reply With Quote
  #3049  
Old 22.09.2024, 01:25
Fierro3612 Fierro3612 is offline
Baby Loader
 
Join Date: Jul 2024
Posts: 7
Default

Thank You very much
Reply With Quote
  #3050  
Old 28.09.2024, 11:03
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default

Quote:
Originally Posted by mgpai View Post
Code:
/*
    generate "video_duration_formatted" property from "video_duration" property
    trigger: packagizer hook
...
Sorry about my late reply!
I was away for some time and must have overlooked this.
Now, thank you very, very much for your help.

Will test the script probably this weekend and then let you know about the result.

Best regards,
Stefan
Reply With Quote
  #3051  
Old 01.10.2024, 13:51
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default

Quote:
Originally Posted by mgpai View Post
Code:
/*
    generate "video_duration_formatted" property from "video_duration" property
    trigger: packagizer hook
    Enable "synchronous execution of script" checkbox in top panel
*/

if (linkcheckDone && state == "BEFORE") {
    var duration = link.getProperty("video_duration");

    if (duration != null) {
        var fmt = function(n) {
            return ("0" + n).slice(0, 2);
        }
        var [seconds, milliseconds] = ("" + duration).split(".");
        var hours = fmt(seconds / 3600);
        seconds %= 3600;
        var minutes = fmt(seconds / 60);
        seconds = fmt(seconds % 60);
        duration = ([hours, minutes, seconds].join(":") + "," + milliseconds)
        link.setProperty("video_duration_formatted", duration);
    }
}
Tested it thoroughly. Unfortunately in some 50 % of all tested cases it produces incorrect results, e.g.

for 895,019 sec
it returns
00:01:05,019 (incorrect)

the correct result would be
00:14:55,019 (correct)

Sent you an example link in a PM

Thanks again for any efforts taken.

BR
Stefan
Reply With Quote
  #3052  
Old 01.10.2024, 15:00
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by StefanM View Post
the correct result would be
00:14:55,019 (correct)
Fixed?
Reply With Quote
  #3053  
Old 01.10.2024, 16:22
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default

Quote:
Originally Posted by mgpai View Post
Code:
/*
    generate "video_duration_formatted" property from "video_duration" property
    trigger: packagizer hook
    Enable "synchronous execution of script" checkbox in top panel
*/

if (linkcheckDone && state == "BEFORE") {
    var duration = link.getProperty("video_duration");

    if (duration != null) {
        var fmt = function(n) {
            alert(parseInt(n));
            return ("0" + parseInt(n)).slice(-2);
        }
        var [seconds, milliseconds] = ("" + duration).split(".");
        var hours = fmt(seconds / 3600);
        seconds %= 3600;
        var minutes = fmt(seconds / 60);
        seconds = fmt(seconds % 60);
        duration = ([hours, minutes, seconds].join(":") + "," + milliseconds)
        link.setProperty("video_duration_formatted", duration);
    }
}
Calculation/conversion is correct now!

Three minor issues:
1. I'm getting a popup message "Alert message from MyScript@Packagizer Hook" for each digit group.
Probably a leftover from your own tests?
EDIT: Removed it myself...

2. Trailing zeroes are not shown:
e.g. the script shows 00:03:25,6 instead of 00:03:25,600 (which I would prefer, if possible)

3. When there are no digits after the decimal separator
e.g. 00:03:25,000, the script shows 00:03:25,undefined I would prefer ",000" if possible

Last edited by StefanM; 01.10.2024 at 16:31.
Reply With Quote
  #3054  
Old 01.10.2024, 17:49
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by StefanM View Post
...
Example links?
Reply With Quote
  #3055  
Old 02.10.2024, 20:54
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default

Quote:
Originally Posted by mgpai View Post
Example links?
Sent as PM

Thanks once again!
Reply With Quote
  #3056  
Old 03.10.2024, 08:11
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by StefanM View Post
...
updated
Reply With Quote
  #3057  
Old 03.10.2024, 12:02
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default

Quote:
Originally Posted by mgpai View Post
**External links are only visible to Support Staff**...
Working like a charm.

Thanks once again for the great work!
I admire your skills. It was probably not that simple to write this script.

Reply With Quote
  #3058  
Old 03.10.2024, 18:48
Fetterbr Fetterbr is offline
Modem User
 
Join Date: Aug 2024
Posts: 3
Default Download Check in Kodi like folder setup

Hi.
I need some help with a little script what will check if i have the movie already before download.
I have a base folder with 5-6000 movie folders.
The movies are all starting with the DVD ID-Title-Year

The movie folder has the same name as the movie.

I need the script to check the section before the "-" Dash and after the "-" Dash before the "space". This way it docen't matter how many letters there is in the DVD-ID.

example AARM-018 Best Of Thigh Job Threesomes (2021)

Does this sound plausibel, than please let me know, i would really appreciate it.
I am not sure if the script was already made but i could not find any thing like this.
Thanks
Reply With Quote
  #3059  
Old 04.10.2024, 11:37
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by Fetterbr View Post
I need the script to check the section before the "-" Dash and after the "-" Dash before the "space".
Check against what? file/folder name in download list?
Reply With Quote
  #3060  
Old 04.10.2024, 12:42
Fetterbr Fetterbr is offline
Modem User
 
Join Date: Aug 2024
Posts: 3
Default

Quote:
Originally Posted by mgpai View Post
Check against what? file/folder name in download list?
It needs to check in download folder and any subfolders for any files with mp4 or mkv extension.
Reply With Quote
  #3061  
Old 11.10.2024, 18:28
Fetterbr Fetterbr is offline
Modem User
 
Join Date: Aug 2024
Posts: 3
Default

Quote:
Originally Posted by mgpai View Post
Check against what? file/folder name in download list?
Can you make it ?
Reply With Quote
  #3062  
Old 24.10.2024, 14:38
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

@mgpai
Where is the most recent version of the convert2mp3 script?
I had a user in a ticket who seemed to have been using an older version.
The bitrate calculation of that one caused it to fail.
Seemingly old version:
pastebin.com/raw/4wvQ3Hqz
If that version is old: Where can I find your latest version?

I've created a newer version compared to that one:
- Do not overwrite mp3 target file if it already exists
- Display human readable error messages
- Added comments in English (I admit that I used chatGPT for this part, I was lazy).
Newer version by me:
pastebin.com/raw/PPb4G5DV
__________________
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
  #3063  
Old 24.10.2024, 15:50
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by pspzockerscene View Post
@mgpai
Where is the most recent version of the convert2mp3 script?
The second script (alternate version) in the first post of this thread, which includes error handling. I am not aware of any issues, but if there are please let me know.
Reply With Quote
  #3064  
Old 24.10.2024, 16:03
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

Thanks.

I'am not aware of any issues either.
I just have a user in a ticket who claims that it sometimes randomly fails and then of course it gets disabled in JD.

Most of my changes were done to auto add comments (for said user) and also I did not like the amount of indentation levels so I've refactored it to the "early return" principle.
__________________
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
  #3065  
Old 24.10.2024, 16:19
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by pspzockerscene View Post
Thanks.

I'am not aware of any issues either.
I just have a user in a ticket who claims that it sometimes randomly fails and then of course it gets disabled in JD.

Most of my changes were done to auto add comments (for said user) and also I did not like the amount of indentation levels so I've refactored it to the "early return" principle.
Most likely the user had the original (first version) script, which does not contain any error handling

Thanks for jumping in.
Reply With Quote
  #3066  
Old 24.10.2024, 16:53
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

I've made him a german version with special error handling.
Again I don't think any of this is needed but I was in the mood to do this so I'll post it here too in case it's helpful for others:
pastebin.com/raw/stqgZtm8

Please don't judge me for using ChatGPT - I've mainly used it for auto comment generation.
The script is tested and working.
__________________
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
  #3067  
Old 25.10.2024, 11:26
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by pspzockerscene View Post
Please don't judge me for using ChatGPT - I've mainly used it for auto comment generation.
I believe in taking help wherever we can get it.

ChatGPT can be quite useful. But those not familiar with JD API may find it confusing, since it tends to create scripts with non-existent APIs.
Reply With Quote
  #3068  
Old 25.10.2024, 14:57
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

Quote:
Originally Posted by mgpai View Post
I believe in taking help wherever we can get it.
:)

Quote:
Originally Posted by mgpai View Post
But those not familiar with JD API may find it confusing, since it tends to create scripts with non-existent APIs.
Yap I've already seen that.
For refactoring or adding comments though I need to say it works pretty well though I'd never trust it 100% and always perform tests.
__________________
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
  #3069  
Old 29.10.2024, 10:09
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

@mgpai
Is there a simple script which downloads the comment of an item as same file name but with .txt extension?
If so, where can I find that?

If none exists, I will create one since I know that the demand is there.
__________________
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?

Last edited by pspzockerscene; 29.10.2024 at 10:14.
Reply With Quote
  #3070  
Old 29.10.2024, 11:32
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by pspzockerscene View Post
@mgpai
Is there a simple script which downloads the comment of an item as same file name but with .txt extension?
If so, where can I find that?

If none exists, I will create one since I know that the demand is there.
Remeber creating one, but could not find it. Let me know if I can be of any help with the script.
Reply With Quote
  #3071  
Old 29.10.2024, 11:41
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

Here is roughly what I want slahs what I would try to create (so far I didn't start).
A script that has the following features:
  • Save package comment or item-comment into .txt file
  • The ability to define allowed file types in an array/regex or some variable to easily control, for which items the description should be saved*
  • The ability to define allowed host(s) for which the script should work
* Specifically this will be tested/used for soundcloud items and in that case, there can be audio files and image files (covers) but the description should only be saved once [per package slash per audio item]
I have yet to update the soundcloud crawler to set said description as comment. EDIT that was already implemented.

I want the code of this script to be in the script inside an extra function so we can easily do a "return early" thing to keep the structure flat so, similar to how the structure of the other script I posted is but without exceptions.

It shouldn't be too complicated.
__________________
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?

Last edited by pspzockerscene; 29.10.2024 at 14:14. Reason: EDIT
Reply With Quote
  #3072  
Old 29.10.2024, 13:02
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by pspzockerscene View Post
Here is roughly what I want ...
Code:
/*
    save comment to text file
    trigger : download finished
*/

var myHosts = ["soundcloud.com","audiocloud.com"];
var myExts = ["mp3", "jpg"];
var saveComment = function(link) {
    var finished = link.finished;

    if (!finished) {
        throw new Error("download not finished");
    }

    var host = link.downloadHost;

    if (myHosts.indexOf(host) == -1) {
        throw new Error("host is excluded");
    }

    var ext = getPath(link.downloadPath).extension;

    if (myExts.indexOf(ext) == -1) {
        throw new Error("extension is excluded");
    }

    var comment = link.comment;

    if (!comment) {
        throw new Error("comment not found");
    }

    var file = getPath(link.downloadPath.replace(/(.+)\..+/, "$1.txt"));

    if (file.exists()) {
        throw new Error("file already exists");
    }

    try {
        writeFile(file, comment, false);
    } catch (e) {};
}

saveComment(link);

Let me know if anything is amiss.
Reply With Quote
  #3073  
Old 29.10.2024, 13:26
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

At the exact same time, I made my attempt lol
I'll just post it here for comparison:
Spoiler:

Code:
// Writes link comment to text file
// Trigger: "A download has stopped"
// Has some settings, just search for "settings" in this code

// Main function that runs the script based on the early return principle
function run() {
    // Early return if the download is not finished
    if (!link.isFinished()) {
        // console.log("Link is not yet downloaded");
        return;
    }

    var comment = link.getComment(); // Retrieve the comment from the link

    // Early return if the comment is empty
    if (!comment) {
        return;
    }

    // Retrieve the link's file name and download folder path
    var fileName = link.name;
    var sourcePath = package.getDownloadFolder();
    
    // "Settings", see vars down below
    // Define allowed file types (set to null or undefined to allow all types)
    var allowedFileTypes = null; // Example: set to null to allow all file types
    // var allowedFileTypes = [".mp3"];
    // Option to overwrite existing files
    var overwriteExisting = false; // Set to true to overwrite existing files

    // Check if the file type is allowed (skip check if allowedFileTypes is null or undefined)
    if (allowedFileTypes && !allowedFileTypes.some(function(extension) { return fileName.endsWith(extension); })) {
        return;
    }

    // Change the file name to add ".txt" as the new extension
    var outputPath = sourcePath + "/" + fileName + ".txt";

    // Early return if the file exists and overwriting is disabled
    if (!overwriteExisting && getPath(outputPath).exists()) {
        return;
    }
    
    // Write the comment to the file
    writeFile(outputPath, comment, true);
}

// Execute the run function
run();

Pastebin:
pastebin.com/raw/DcpjqF2f

Before you ask:
The reason I put all the code into a function is to be able to do "return;" instead of an exception since otherwise it won't compile in our framework.

I guess your "inline function" would also allow a "return;".
I'm not in the position to judge which one is "better"; I guess we'll make a merged one that contains all 'features'.
EDIT
Here is a merged version:
Spoiler:

Code:
// Writes link comment to text file
// Trigger: "A download has stopped"
// Has some settings, just search for "settings" in this code

// Main function that runs the script based on the early return principle
function run() {
    // "Settings", see vars down below
    // Define allowed file types (set to null or undefined to allow all types)
    var allowedFileTypes = null; // Example: set to null to allow all file types
    // var allowedFileTypes = [".mp3"];
    
    // Option to overwrite existing files
    var overwriteExisting = false; // Set to true to overwrite existing files
    
    // Allowed hosts (only these hosts will proceed; set to null to allow all hosts)
    var myHosts = ["soundcloud.com", "audiocloud.com", "ping.online.net"];

    // Early return if the download is not finished
    if (!link.isFinished()) {
        // console.log("Link is not yet downloaded");
        return;
    }

    var comment = link.getComment(); // Retrieve the comment from the link

    // Early return if the comment is empty
    if (!comment) {
        return;
    }

    // Retrieve the link's file name, download folder path, and host
    var fileName = link.name;
    var sourcePath = package.getDownloadFolder();
    var host = link.downloadHost;

    // Skip host check if myHosts is null or undefined
    if (myHosts && myHosts.indexOf(host) === -1) {
        return;
    }

    // Skip file type check if allowedFileTypes is null or undefined
    var fileExtension = fileName.split('.').pop();
    if (allowedFileTypes && allowedFileTypes.indexOf(fileExtension) === -1) {
        return;
    }

    // Change the file name to add ".txt" as the new extension
    var outputPath = sourcePath + "/" + fileName + ".txt";

    // Early return if the file exists and overwriting is disabled
    if (!overwriteExisting && getPath(outputPath).exists()) {
        return;
    }
    
    // Write the comment to the file
    writeFile(outputPath, comment, true);
}

// Execute the run function
run();

I liked your "inline function" more since it eliminates one indentation.
__________________
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?

Last edited by pspzockerscene; 29.10.2024 at 14:11.
Reply With Quote
  #3074  
Old 29.10.2024, 16:06
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,603
Default

Quote:
Originally Posted by pspzockerscene View Post
The reason I put all the code into a function is to be able to do "return;" instead of an exception since otherwise it won't compile in our framework.
If you mean the script gets disabled on exception, you an either use it in throw/catch or use 'setDisableOnException' and "setNotifyOnException" methods to prevent it.

Quote:
Originally Posted by pspzockerscene View Post
I guess your "inline function" would also allow a "return;".
Yes.

Quote:
Originally Posted by pspzockerscene View Post
I liked your "inline function" more since it eliminates one indentation.
You can also use self-invoking/anonymous function.

Code:
(function() {
    if (!link.finished) {
        return;
    }
    alert(link.name);
})();
Reply With Quote
  #3075  
Old 30.10.2024, 10:48
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,223
Default

Quote:
Originally Posted by mgpai View Post
If you mean the script gets disabled on exception, you an either use it in throw/catch or use 'setDisableOnException' and "setNotifyOnException" methods to prevent it.
No I just mean that something like this is not possible as script (can't even compile):

Code:
    if (!link.isFinished()) {
        return;
    }
While this is working:
Code:
function run() {

    if (!link.isFinished()) {
        return;
    }
}

run();
Quote:
Originally Posted by mgpai View Post
You can also use self-invoking/anonymous function.
Thanks.
I've never really delt much with js.
I mostly read all of the js related memes on reddit lol
__________________
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
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 15:05.
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.