JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #3001  
Old 06.07.2024, 22:51
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

@dataDyne: Your script is missing closing
Quote:
}
tags add another } at the end
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3002  
Old 07.07.2024, 01:23
dataDyne's Avatar
dataDyne dataDyne is offline
Baby Loader
 
Join Date: Mar 2024
Posts: 8
Lightbulb

Yes, work and without errors, but I want with the option automatically delete all original files...any help for this?
This is a working script for convert all audio files to MP3 320Kbps, but I want with erase the original files:
EDIT: 100% working script for convert all audio files (YouTube, etc...) to MP3 320Kbps and automatically delete all original files:
Code:
/*
    Convert aac/m4a/ogg/opus files to 320 kbps mp3.
    Trigger required: "A Download Stopped".
*/

if (link.finished) {
    var input = link.downloadPath;
    var output = link.downloadPath.replace(/(.+\.)(aac|m4a|ogg|opus)$/i, "$1mp3");

    if (input != output) {
        var interfaceName = "org.jdownloader.controlling.ffmpeg.FFmpegSetup";
        var ffmpeg = callAPI("config", "get", interfaceName, null, "binarypath");

        callSync(ffmpeg, "-n", "-i", input, "-b:a", "320k", output);
        getPath(output).size && getPath(input).delete();
    }
}

Last edited by dataDyne; 07.07.2024 at 04:52.
Reply With Quote
  #3003  
Old 07.07.2024, 01:34
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

@dataDyne: the script already has the deleting part in it
Quote:
getPath(output).size && getPath(input).delete();
when output(mp3) exists, it should delete the original file
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3004  
Old 07.07.2024, 04:49
dataDyne's Avatar
dataDyne dataDyne is offline
Baby Loader
 
Join Date: Mar 2024
Posts: 8
Default

YES! Now work correctly...and delete all original audio files.
Thank you so much!...have a nice day!
Reply With Quote
  #3005  
Old 21.07.2024, 12:23
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default Worked fine, now I get "Security Violation errors"

Quote:
Originally Posted by mgpai View Post
Code:
/*
    generate "video_duration_comma" 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) {
        link.setProperty("video_duration_comma", duration.toString().replace(".",","));
    }
}
Until yesterday (July 20) this script worked fine for me. But now sometimes(!) I'm getting below error message.



When it appeared for the first time, I could click on error details (see below) and I could click on OK, so that JD continued grabbing.

Today it appeared again, but this time I had to end the JD process in TaskManager. No reaction on any mouse clicks. It must have something to do with the files I'm grabbing, because when I add a block of links to "Analyze and add links"-window and click on continue, a couple of links are being grabbed and then the error message pops up.

Reproducible, as often as I like...

Maybe a JD update could (also) have something to do with it. Because for two weeks of intensive use, this error never occurred.

Any ideas?

Thanks for any help provided in advance!


Code:
net.sourceforge.htmlunit.corejs.javascript.EcmaError: Security Violation: Security Violation java.lang.Short (#8)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3935)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3919)
	at org.jdownloader.extensions.eventscripter.ScriptThread.isClassVisibleToScript(ScriptThread.java:505)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory$2.visibleToScripts(JSHtmlUnitPermissionRestricter.java:180)
	at net.sourceforge.htmlunit.corejs.javascript.JavaMembers.<init>(JavaMembers.java:31)
	at net.sourceforge.htmlunit.corejs.javascript.JavaMembers.lookupClass(JavaMembers.java:785)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaObject.initMembers(NativeJavaObject.java:53)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaObject.<init>(NativeJavaObject.java:43)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaObject.<init>(NativeJavaObject.java:34)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxNativeJavaObject.<init>(JSHtmlUnitPermissionRestricter.java:295)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxWrapFactory.wrapAsJavaObject(JSHtmlUnitPermissionRestricter.java:287)
	at net.sourceforge.htmlunit.corejs.javascript.WrapFactory.wrap(WrapFactory.java:72)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxWrapFactory.wrap(JSHtmlUnitPermissionRestricter.java:266)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod.call(NativeJavaMethod.java:222)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1536)
	at script(:8)
	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(JSHtmlUnitPermissionRestricter.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:169)

Last edited by StefanM; 21.07.2024 at 12:36.
Reply With Quote
  #3006  
Old 21.07.2024, 13:48
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

@StefanM: Thanks for the report, will be fixed with next update later today
optimization of json parser that reduces memory consumption is causing this
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3007  
Old 21.07.2024, 13:53
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: Thanks for the report, will be fixed with next update later today
optimization of json parser that reduces memory consumption is causing this
Thanks for the prompt reply and reaction.
Reply With Quote
  #3008  
Old 22.07.2024, 17:23
senormal senormal is offline
Baby Loader
 
Join Date: Mar 2024
Posts: 9
Default Parse comments for links

Hello!
I am trying to create a little script that adds the entire content of a comment to the linkgrabber function: my hope is that the links within the comment will be automatically parsed and added to the hit list while conserving the save folder parameters of the link that had the comment.
Would it be possible for me to get help with this? I have asked copilot but the script is not working... Would there be a way to enable this only for certain domains/hosters?


Code:
for (var i = 0; i < package.getChildren().length; i++) {
    var hit = package.getChildren()[i];
    if (hit.getComment() && hit.getComment().length > 0) {
        var comment = hit.getComment();
        linkCollector.addURL(url);
        }
    }
}
Thank you kindly!
Reply With Quote
  #3009  
Old 22.07.2024, 17:24
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,118
Default

Context regarding the post of user "senormal":
https://board.jdownloader.org/showthread.php?t=96066
__________________
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
  #3010  
Old 22.07.2024, 18:36
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: Thanks for the report, will be fixed with next update later today
optimization of json parser that reduces memory consumption is causing this
Update is released
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3011  
Old 22.07.2024, 19:24
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default

Quote:
Originally Posted by Jiaz View Post
Update is released

Fehler!


Tja, jetzt werden bei mir Links gar nicht mehr gefunden.
Getestet mit k2s und mit wetransfer.

Wohl aber mit der vorherigen Version, die ich als BAK gesichert hatte.

EDIT

Should have written in English:

Error!
JD doesn't find links anymore!
Tested with k2s and wetransfer.

Previous JD version (from Sunday), however, restored from a backup, still finds those links.

Last edited by StefanM; 22.07.2024 at 19:35.
Reply With Quote
  #3012  
Old 22.07.2024, 19:48
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,118
Default

Quote:
Originally Posted by StefanM View Post
Tja, jetzt werden bei mir Links gar nicht mehr gefunden.
Das Problem wurde hier bereits gemeldet.

Bitte abonniere den verlinkten Thread, um über einen Bugfix informiert zu werden.
__________________
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
  #3013  
Old 22.07.2024, 20:07
StefanM's Avatar
StefanM StefanM is offline
JD Legend
 
Join Date: Oct 2020
Posts: 722
Default

Quote:
Originally Posted by Jiaz View Post
@StefanM: Thanks for the report, will be fixed with next update later today
optimization of json parser that reduces memory consumption is causing this
Last update (18:53 German DST) seems to have cured the original problem.
Four tests with a larger number of links and the script enabled could not provoke the error (freezing,...) anymore.

But as I will continue using that script on a daily basis, there will be more reliable test results pretty soon.
Reply With Quote
  #3014  
Old 25.07.2024, 10:38
mrbigmouth502 mrbigmouth502 is offline
Baby Loader
 
Join Date: Dec 2021
Location: Canada
Posts: 7
Default

Hi, I'm trying to add the following auto-update script from the Knowledge Base to my headless JDownloader2 configuration through MyJDownloader, and it completely refuses to save. It always ends up reverting to the default blank "[]" entry. What can I do about it?

Code:
[ {
  "eventTrigger" : "INTERVAL",
  "enabled" : true,
  "name" : "Auto-update JD",
  "script" : "// Restart & Update when JD is idle, or after 'x' hours.\n// Trigger: Interval (Recommended 600000 or more).\n\nvar hours = 0; // Update after 'x' hours, even if JD is not idle. (0 = Disabled)\n\nif (callAPI(\"update\", \"isUpdateAvailable\")) {\n\n    var updateNow = false;\n\n    if (hours > 0) {\n        \n        if (!getProperty(\"date\", false)) {\n            setProperty(\"date\", new Date(Date.now() + hours * 60 * 60 * 1000), false);\n        }\n\n        if (Date.now() > getProperty(\"date\", false)) {\n            updateNow = true;\n        }\n    }\n\n    if (!updateNow) {\n        \n        var idle = isDownloadControllerIdle() &&\n            !callAPI(\"linkcrawler\", \"isCrawling\") &&\n            !callAPI(\"linkgrabberv2\", \"isCollecting\") &&\n            !callAPI(\"extraction\", \"getQueue\").length > 0;\n\n        if (idle) {\n            updateNow = true;\n        }\n    }\n\n    if (updateNow) {\n        callAPI(\"update\", \"restartAndUpdate\");\n    }\n}",
  "eventTriggerSettings" : {
    "lastFire" : 1594799412187,
    "interval" : 600000,
    "isSynchronous" : false
  },
  "id" : 1594796988140
} ]
Reply With Quote
  #3015  
Old 25.07.2024, 10:43
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

@mrbigmouth502: what browser are you using? what os? I'm asking because on MacOS chrome and safari might cause issues
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3016  
Old 25.07.2024, 11:12
mrbigmouth502 mrbigmouth502 is offline
Baby Loader
 
Join Date: Dec 2021
Location: Canada
Posts: 7
Default

@Jiaz: I'm using Firefox on EndeavourOS; basically Arch Linux. If it makes any difference I'm using KDE Plasma 6 as my DE, and I'm running under Wayland.
Reply With Quote
  #3017  
Old 25.07.2024, 11:35
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

@mrbigmouth502: how do you do it? do you click on the save button or how exactly? I can reproduce the issue but only on enter or clicking somewhere else, when hitting save button, it works
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3018  
Old 26.07.2024, 00:17
mrbigmouth502 mrbigmouth502 is offline
Baby Loader
 
Join Date: Dec 2021
Location: Canada
Posts: 7
Default

@Jiaz: I have been hitting the save button. I highlight the script, right click, click "copy", delete the brackets in the box where you're supposed to paste the script, right click the box, click "paste", hit the save button, and then it just vanishes.

Could it be because I use a dedicated browser profile for MyJDownloader?

UPDATE: I think I finally figured out a solution. I had to go into the Advanced Settings and add my script there. I also deleted the last line of whitespace after the last "]". When I did that, it asked if I wanted to grant my script the Interval permission, which I did.

UPDATE2: OK, new problem. When I open up MyJdownloader, I get this error, sometimes multiple times:
Quote:
The Event Script 'Auto-update JD' requires permissions for the trigger 'Interval'. The script tries to call the Remote API: update/isUpdateAvailable. Do you want to allow this? If you are not sure, please check your script!
Do I just have to check the box that says "don't show this again", or do I have to do something else to auto-enable the permissions?

Last edited by mrbigmouth502; 26.07.2024 at 04:02.
Reply With Quote
  #3019  
Old 26.07.2024, 11:08
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

@mrbigmouth502: Thanks for the followup, I will test again what happens when I have spaces at the end of ] as I always just copied the *exact/correct* json part in my testing.
Quote:
Originally Posted by mrbigmouth502 View Post
Do I just have to check the box that says "don't show this again", or do I have to do something else to auto-enable the permissions?
You have two options:
1.) hit *don't show this again* and okay, so JDownloader remembers your decision
2.) add
Quote:
disablePermissionChecks();
in the beginning of the script
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 26.07.2024 at 11:11.
Reply With Quote
  #3020  
Old 01.08.2024, 12:25
mrbigmouth502 mrbigmouth502 is offline
Baby Loader
 
Join Date: Dec 2021
Location: Canada
Posts: 7
Default

Quote:
Originally Posted by Jiaz View Post
@mrbigmouth502: Thanks for the followup, I will test again what happens when I have spaces at the end of ] as I always just copied the *exact/correct* json part in my testing.

You have two options:
1.) hit *don't show this again* and okay, so JDownloader remembers your decision
2.) add in the beginning of the script
I went with option 1 a few days ago, and it's been working well for me. At the time I didn't know for sure if you were supposed to do that, but I'm happy to know that it's a valid option.

Last edited by mrbigmouth502; 01.08.2024 at 12:27.
Reply With Quote
  #3021  
Old 19.08.2024, 16:56
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,600
Default

Quote:
Originally Posted by senormal View Post
... script that adds the entire content of a comment to the linkgrabber ... conserving the save folder parameters of the link that had the comment .... enable this only for certain domains/hosters?
Code:
getAllCrawledPackages().forEach(function(package) {
    var links = [];

    package.downloadLinks.forEach(function(link) {
        if (link.host == "myhost.com" && link.comment) {
            links.push(link.comment);
        }
    })

    if (links.length) {
        callAPI("linkgrabberv2", "addLinks", {
            links: links.join("<br>"),
            destinationFolder: package.downloadFolder
        })
    }
})
Reply With Quote
  #3022  
Old 19.08.2024, 20:11
wkearney99 wkearney99 is offline
Vacuum Cleaner
 
Join Date: May 2024
Posts: 15
Default

Is there a way to use one event script to move completed downloads, but let the archive extractor finish first?

I have an event script set up that works, in that it checks isFinished and uses moveTo to move the files.

But if the JD has detected that there are archives in it, the archive extractor doesn't get a chance to extract them before the isFinished event script fires.

Code:
var packageFinished = link.getPackage().isFinished();

if (packageFinished) {
    var curFolder = link.package.downloadFolder;
    var destFolder = getPath("E:\\moved\\somehost\");
    var pathString = curFolder.valueOf();
    var needsMoving = pathString.indexOf('somehost');
 
    if (needsMoving > -1){
        getPath(curFolder).moveTo(destFolder);
    }
}
The current script looks at the local destination path and if it contains a certain string it then moves the folder into another local path.

Is there something I should put in my event script that waits on the Archive Extractor to finish?
Reply With Quote
  #3023  
Old 19.08.2024, 20:21
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

@wkearney99: when I remember right, there already is such a script, somewhere in this thread. try to use "search this thread" or ask mgpai, he might know better if/where it can be found
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3024  
Old 20.08.2024, 14:59
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,600
Default

Quote:
Originally Posted by wkearney99 View Post
... let the archive extractor finish first?
Code:
package.downloadLinks.forEach(function(link) {
    while (
        ["IDLE", "RUNNING"].indexOf(link.extractionStatus) > -1
    ) sleep(1000);
})

//your code goes here

If you are running the script on packag finished trigger, additional package.isFinished check within the script is not required.
Reply With Quote
  #3025  
Old 21.08.2024, 22:02
senormal senormal is offline
Baby Loader
 
Join Date: Mar 2024
Posts: 9
Default

Quote:
Originally Posted by mgpai View Post
Code:
getAllCrawledPackages().forEach(function(package) {
    var links = [];

    package.downloadLinks.forEach(function(link) {
        if (link.host == "myhost.com" && link.comment) {
            links.push(link.comment);
        }
    })

    if (links.length) {
        callAPI("linkgrabberv2", "addLinks", {
            links: links.join("<br>"),
            destinationFolder: package.downloadFolder
        })
    }
})


Thank you so much!
Reply With Quote
  #3026  
Old 22.08.2024, 10:47
MCorgano MCorgano is offline
Modem User
 
Join Date: Oct 2023
Posts: 2
Default

Quote:
Originally Posted by FBD View Post
This is easily done with some regular expressions in the Packagizer, click the Wiki/FAQ link at the top here and check out the Knowledgebase pages for the Packagizer - or come to the support chat and i'll able to help you out with it.



When you create a new script in the Event Scripter or edit an existing script, you can click on the "Show/Hide Help" menu item at the top which will give you a complete list of all functions and features available to the event script. The variables are named very descriptive and mostly self-explanatory. Also the Event Scripter forum thread here will also give you tons of working scripts you can use and edit yourself.
I got to this point

Code:
// Function to detect duplicate entries in the download list based on RyuuIDs and archive names.
function detectDuplicateEntries() {
    // Define the regex pattern to match the RyuuID in the package name.
    var regexPattern = /(r[a-z]{0,3}-?[a-z]{0,3}\d{4,10})\b/i;

    // Paths for cache and log files.
    var cacheFilePath = getPath(JD_HOME + "/ryuuID_cache.json");
    var logFilePath = getPath(JD_HOME + "/Ryuu.log");

    // Function to load cache data.
    function loadCache() {
        if (cacheFilePath.exists()) {
            try {
                var cacheData = readFile(cacheFilePath);
                return JSON.parse(cacheData);
            } catch (error) {
                log("Error reading cache: " + error);
            }
        }
        return null;
    }

    // Function to save cache data.
    function saveCache(data) {
        try {
            writeFile(cacheFilePath.toString(), JSON.stringify(data, null, 2), true);
        } catch (error) {
            log("Error saving cache: " + error);
        }
    }

    // Function to get a list of archive names for a package.
    function getArchiveNames(package) {
        var archiveNames = [];
        var archives = package.getArchives();
        for (var i = 0; i < archives.length; i++) {
            archiveNames.push(archives[i].getName());
        }
        return archiveNames;
    }

    // Function to log messages to the log file.
    function log(message) {
        try {
            writeFile(logFilePath.toString(), message + "\n", true);
        } catch (error) {
            alert("Error writing to log file: " + error);
        }
    }

    // Delete the log file if it exists.
    if (logFilePath.exists()) { 
        logFilePath.delete(); 
    }

    // Get the list of all file packages.
    var downloadPackages = getAllFilePackages();
    var currentPackageCount = downloadPackages.length;

    // Log the start of the script.
    log("Script started with " + currentPackageCount + " packages");

    // Load cache data.
    var cache = loadCache();

    // Check if we need to re-scan the download list.
    var uuidRyuuMap = {};
    var archiveMap = {};
    if (cache && cache.packageCount === currentPackageCount) {
        uuidRyuuMap = cache.uuidRyuuMap;
        archiveMap = cache.archiveMap;
        log("Loaded lists from cache");
    } else {
        log("Deriving Cache...");
        var logMessages = "";

        // Re-scan the download list to build the UUID:RyuuID map and archive names.
        for (var i = 0; i < downloadPackages.length; i++) {
            var package = downloadPackages[i];
            var packageName = package.getName();
            var uuid = package.getUUID();
            var match = regexPattern.exec(packageName);

            if (match && match[0]) {
                var ryuuID = match[0];
                uuidRyuuMap[uuid] = ryuuID;

                // Store archive names.
                archiveMap[uuid] = getArchiveNames(package);
                logMessages += "    Adding " + uuid + " with RyuuID " + ryuuID + " and archives " + archiveMap[uuid].join(", ") + "\n";

                // Write to file if batch size is reached.
                if ((i + 1) % 300 === 0) {
                    log(logMessages.replace(/\n$/, ''));
                    logMessages = ""; // Clear log messages after writing.
                }
            }
        }
        // Write any remaining log messages after the loop.
        if (logMessages) {
            log(logMessages);
        }

        // Save the new cache data.
        saveCache({
            packageCount: currentPackageCount,
            uuidRyuuMap: uuidRyuuMap,
            archiveMap: archiveMap
        });
    }

    // Detect duplicates.
    var duplicates = {}; // Object to store duplicate RyuuID with list of UUIDs.
    var matches = {}; // Object to store all UUIDs with the same RyuuID.
    var ryuuIdMap = {};  // Map to track RyuuIDs and their associated UUIDs.

    for (var uuid in uuidRyuuMap) { // Iterate through each UUID in the UUID:RyuuID map.
        var ryuuID = uuidRyuuMap[uuid]; // Get the RyuuID associated with the current UUID.
        var archives = archiveMap[uuid]; // Get the list of archives for the current UUID.

        // Log the comparison.
        // log("Comparing " + uuid + ": " + ryuuID + " with archives: " + JSON.stringify(archives));

        // Check if this RyuuID has been seen before.
        if (ryuuIdMap[ryuuID]) {
            var duplicateUUID = ryuuIdMap[ryuuID]; // Get the UUID of the previously seen RyuuID.
            var duplicateArchives = archiveMap[duplicateUUID]; // Get the list of archives for the duplicate UUID.

            log("  Checking " + uuid + ": " + ryuuID + " with archives: " + JSON.stringify(archives));
            log("  Match to " + duplicateUUID + ": " + ryuuID + " with archives: " + JSON.stringify(duplicateArchives));
            

            // Track all UUIDs with the same RyuuID.
            if (!matches[ryuuID]) {
                matches[ryuuID] = [];
            }
            matches[ryuuID].push(uuid);
            matches[ryuuID].push(duplicateUUID);

            // Check if all archives in the current package exist in the duplicate package.
            var isDuplicate = archives.every(function(archive) {
                return duplicateArchives.indexOf(archive) !== -1;
            });

            if (isDuplicate) { // If all archives match, the packages are considered duplicates.
                log("    Duplicate found! " + duplicateUUID + " and " + uuid + " with archives: " + JSON.stringify(duplicateArchives));
                if (!duplicates[ryuuID]) {
                    duplicates[ryuuID] = [];
                }
                duplicates[ryuuID].push(uuid);
                duplicates[ryuuID].push(duplicateUUID);
            // } else {
            //     log("No match found between UUID: " + uuid + " and duplicate UUID: " + duplicateUUID);
            }
        } else {
            // If the RyuuID is not in the map, add it with the current UUID.
            ryuuIdMap[ryuuID] = uuid;
        }
    }

    // Format the duplicates message
    var duplicateMessage = "Duplicates:\n";
    for (var ryuuID in duplicates) {
        duplicateMessage += ryuuID + "\n";
        for (var i = 0; i < duplicates[ryuuID].length; i++) {
            var uuid = duplicates[ryuuID][i];
            duplicateMessage += "\t" + uuid + ": " + JSON.stringify(archiveMap[uuid]) + "\n";
        }
        duplicateMessage += "\n"; // Add extra lines of space between different RyuuIDs
    }
    duplicateMessage += "\n\n\n\n"; // Add extra lines of space between different RyuuIDs
    
    // Format the matches message
    duplicateMessage += "Matches:\n";
    for (var ryuuID in matches) {
        duplicateMessage += ryuuID + "\n";
        for (var i = 0; i < matches[ryuuID].length; i++) {
            var uuid = matches[ryuuID][i];
            duplicateMessage += "\t" + uuid + ": " + JSON.stringify(archiveMap[uuid]) + "\n";
        }
        duplicateMessage += "\n"; // Add extra lines of space between different RyuuIDs
    }

    if (duplicateMessage) {
        alert(duplicateMessage);
        log(duplicateMessage); // Log the final results.
    } else {
        alert("No duplicate entries found.");
        log("No duplicate entries found.");
    }
}

// Call the function to detect duplicate entries.
detectDuplicateEntries();
I'm stuck on not finding a way to actually MERGE the packages. Like right click -> move to new package when selecting them manually. I have the UUID's of ones I think are same and ones that I confirmed are same.
Reply With Quote
  #3027  
Old 22.08.2024, 20:44
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,049
Default

Quote:
Originally Posted by MCorgano View Post
I'm stuck on not finding a way to actually MERGE the packages. Like right click -> move to new package when selecting them manually. I have the UUID's of ones I think are same and ones that I confirmed are same.
You've got to use the callapi method,search this thread. Here you can find the api docs , https://my.jdownloader.org/developers/. With callapi you can call all those api methods. Please also check/search this thread and in doubt , better ask
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3028  
Old 05.09.2024, 05:26
John19234 John19234 is offline
Modem User
 
Join Date: Aug 2024
Posts: 3
Default

Is there a script to have Kaspersky (or other antivirus) scan the downloads once the download is done?

FDM has this feature. I would love it for JDM and was told event script might help.
Reply With Quote
  #3029  
Old 05.09.2024, 12:29
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,118
Default

Can't you go the other way and setup your dedicated AV application to actively monitor certain directories?
Apart from that: Yes this is definitely possible using EventScripter scripts.
__________________
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
  #3030  
Old 05.09.2024, 13:17
John19234 John19234 is offline
Modem User
 
Join Date: Aug 2024
Posts: 3
Default

how do I do the first option?

And how can I get a script for the second option?
Reply With Quote
  #3031  
Old 05.09.2024, 13:38
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,118
Default

Quote:
Originally Posted by John19234 View Post
how do I do the first option?
Pose this question to the manufacturer of your AV software.

Quote:
Originally Posted by John19234 View Post
And how can I get a script for the second option?
Ask other users for help in this thread or pay a freelancer to code a script for you (e.g. on fiverr.com).
__________________
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
  #3032  
Old 05.09.2024, 14:37
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,671
Default

@John19234
Usually AV software scan everything by default and you need to opt out of locations it wont scan. Maybe with the exception of network paths.
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #3033  
Old 05.09.2024, 14:48
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,118
Default

Quote:
Originally Posted by raztoki View Post
Usually AV software scan everything by default
I had the same thought but at the same time I knew that FDM has that feature and I never understood the purpose.

Maybe this is for users who have their AV disabled but wnat to proactvely only scan items downloaded by FDM.
__________________
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
  #3034  
Old 05.09.2024, 15:46
John19234 John19234 is offline
Modem User
 
Join Date: Aug 2024
Posts: 3
Default

Quote:
Originally Posted by raztoki View Post
@John19234
Usually AV software scan everything by default and you need to opt out of locations it wont scan. Maybe with the exception of network paths.
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.

Last edited by John19234; 05.09.2024 at 15:49.
Reply With Quote
  #3035  
Old 07.09.2024, 17:10
FiskX FiskX is offline
Baby Loader
 
Join Date: May 2021
Posts: 8
Default

I cannot execute a .cmd script with Eventscripter.
With callSync(“D:\\Test.cmd”) nothing happens, .exe files work without problems

Does Jdownloader have no permission for scripts? Start as admin doesn't work.
Reply With Quote
  #3036  
Old 07.09.2024, 18:27
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,600
Default

Quote:
Originally Posted by FiskX View Post
I cannot execute a .cmd script with Eventscripter.
With callSync(“D:\\Test.cmd”) nothing happens, .exe files work without problems

Does Jdownloader have no permission for scripts? Start as admin doesn't work.
Code:
callSync("cmd", "/c", "D:\\Test.cmd");
Reply With Quote
  #3037  
Old 07.09.2024, 19:19
FiskX FiskX is offline
Baby Loader
 
Join Date: May 2021
Posts: 8
Default

Quote:
Originally Posted by mgpai View Post
Code:
callSync("cmd", "/c", "D:\\Test.cmd");
ChatGPT has already suggested the same thing, but it doesn't work either.


Edit:
callSync("cmd", "/c", "start", "D:\\test.cmd");

This works when I add “start”, but it only starts the old cmd window and not Windows Terminal :(
Is there any way to change this?

Edit2: Fixed
callSync("wt", "cmd", "/c", "D:\\test.cmd");

Last edited by FiskX; 07.09.2024 at 20:29.
Reply With Quote
  #3038  
Old 10.09.2024, 01:10
jDX007 jDX007 is offline
Modem User
 
Join Date: Aug 2024
Posts: 2
Default

Hello friends,

I know that we can use the "variables" to customize the "downloaded file's name"
eg. *DATE_UPLOAD[yyyy.MM.dd]* (up) - *VIDEO_NAME*.*EXT*

but there are 260 characters limitation on the file's name.

so, I would like to put that information into the "comment" part of the file instead


using the variables shown in "Filename & Packagename" on the YouTube plugin


I did a search, and found this topic, scripted and written by "mgpai"
refer to this topic https://board.jdownloader.org/showthread.php?t=87352

but as of now, in September 2024, the script does not seem to work, or maybe I did something wrong, please help me further with this.

btw, that script only provides only 5 variables, could it be customized to provide ALL the variable above that is shown in "Filename & Packagename" on YouTube plugin


for example in the file's "comments" (on the "Details" tab")
can be like the following




Thank you so much in advanced

Last edited by jDX007; 10.09.2024 at 01:24.
Reply With Quote
  #3039  
Old 11.09.2024, 15:08
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

Could one make a script that does a reconnect after a reconnect if there is no internet connection within 4 minutes of the first reconnect? And only then?
__________________
Aktuelles Windows
Reply With Quote
  #3040  
Old 11.09.2024, 15:14
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 73,118
Default

This should already happen automatically, even by default.
Check Settings -> Advanced Settings -> Search for "Reconnect" and check all entries starting with "Reconnect:" to adjus the timings.
__________________
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 05:15.
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.