#2661
|
|||
|
|||
![]()
Hallo,
normalerweise ist es so, dass der JDownloader den nächsten Download beginnt, wenn der Download des aktuellen Links fehlschlägt. Für spezielle Downloads nutze ich Jdownloader so, dass er per Event-Scripter den Zeitstempel der Fertigstellung an den Namen hinzufügt, damit fürs spätere Sortieren eine Reihenfolge eingehalten werden kann. Dafür stelle ich auch ein, dass er nur ein Link zur selben Zeit runterlädt. Nun, wenn Link X mal fehlschlägt und er dann weiterspringt, was bei YT relativ oft passiert, gerät die Reihenfolge natürlich wieder durcheinander. Könnte mir jemand ein Script dafür schreiben, dass er im Falle eines fehlgeschlagenden Versuchs, die Datei automatisch zurücksetzt und neustartet? Vielen Dank. Last edited by OvO; 03.08.2023 at 14:37. |
#2662
|
|||
|
|||
![]()
I have a situation where Event Script objects are vexing me. My aim is to reconcile the contents of downloaded Packages with what exists on disk after the files have been reviewed, and unwanted ones discarded, or others inserted by other Packages. I am aware of the 'filePath.exists()' method, but mgpai has suggested that 'filePath.getChildren()' method a better solution, in another situation in Post https://board.jdownloader.org/showpo...postcount=1121
I have been trying to use this in my script snippet below, recognising that of the two, it's likely the much more economical with machine resources. My plan is to loop through whichever of Link list and Disk File list is shorter and check if there's a match in the other list. I'm trying to use the Filesystem Path for the comparison. I believe that is what I've done in the snippet, as demonstrated by the log() responses shown, but the comparison always fails, with two slightly different variations below. Is there a basic error or misunderstanding getting in my way? If this is a deadend, I could compare the String representations of the filepath, or use 'filePath.exists()', which of these would be the more efficient? I tried to use .constructor to throw some light on my comparisons, but that couldn't help. Why? Code:
// Trigger: Downloadlist context menu button pressed switch (name) { case "LG context menu demo": try { // dlSelection appears to be the single item under the pointer, even if a range of lines is highlighted var myDownloadlistSelection = dlSelection; var myFilePackage = myDownloadlistSelection.getContextPackage(); // Get Links of Package in Downloads list var myDownloadLinks = myFilePackage.getDownloadLinks(); // Get files actually existing in Package's disk Folder var strDlFolder = myFilePackage.getDownloadFolder(); var folderFPath = getPath(strDlFolder); /*Get a FilePath Object*/ var filesPresent = folderFPath.getChildren(); // Get a sample Download Link and its matching File (indexes differ due to file deletions) var sampleLink = myDownloadLinks[14]; var sampleLinkFPath = getPath(sampleLink.getDownloadPath()); var sampleFile = filesPresent[1]; log(folderFPath); // -> /Volumes/Data1/JD/Test log(sampleLink); // -> DownloadLink Instance: 18.jpg log(typeof(sampleLink)); // -> object log(sampleLink.constructor); // -> undefined log(sampleFile); // -> /Volumes/Data1/JD/Test/18.jpg log(typeof(sampleFile)); // -> object log(sampleFile.constructor); // -> undefined log(sampleLink == sampleFile); // -> false <-- ? log(sampleLinkFPath); // -> /Volumes/Data1/JD/Test/18.jpg log(typeof(sampleLinkFPath)); // -> object log(sampleLinkFPath.constructor); // -> undefined log(sampleLinkFPath == sampleFile); // -> false <-- ? } catch (e) { alert(e.message); } break; default: } Last edited by Nimboid; 08.08.2023 at 19:48. Reason: Additional query |
#2663
|
|||
|
|||
![]() Quote:
Code:
dlSelection.packages.forEach(function(package) { var files = getPath(package.downloadFolder).children.map(function(file) { return file.name + file.size; }) package.downloadLinks.forEach(function(link) { if (files.indexOf(link.name + link.bytesTotal) > -1) { link.enabled = false; } }) }) |
#2664
|
|||
|
|||
![]()
I'm not even sure if this is possible but I'm hoping the great minds here could write a script that would let JDownloader NOT download video files that are shorter in video playback duration that a specified amount (ex. Don't download video files with a playback duration shorter than 00:05:00 (hh:mm:ss) minutes long.
|
#2665
|
||||
|
||||
![]()
@Esteban4u
Sure that is possible but first the length of the video needs to be known/stored somewhere. Are you talking about YT videos or videos of another website? If you're talking about YT: The length [in seconds] is available as DownloadLink property "YT_DURATION".
__________________
JD Supporter, Plugin Dev. & Community Manager Erste Schritte & Tutorials || JDownloader 2 Setup Download ----------------------------------- On Vacation / Im Urlaub Start: 2023-12-09 End: TBA |
#2666
|
|||
|
|||
![]()
@pspzockerscene - Yes, kinda, I meant from any website. If there is a method to determine the video length before or even during download, so that JD can either skip or auto-abort the download if it's x minutes and x seconds too short (hh:mm:ss format maybe).
|
#2667
|
||||
|
||||
![]()
Well each plugin is using custom properties to store such information.
I'd say most plugins are not saving this information at this moment which is why I asked. You will need to ask us to add/store this information on a per-website/plugin basis. At this moment you might first want to get your script working and test it with YT - you can use it for other websites afterwards. More about custom plugin properties: https://support.jdownloader.org/Know...-packagizer/20 -> Search for "Plugin specific properties"
__________________
JD Supporter, Plugin Dev. & Community Manager Erste Schritte & Tutorials || JDownloader 2 Setup Download ----------------------------------- On Vacation / Im Urlaub Start: 2023-12-09 End: TBA |
#2668
|
||||
|
||||
![]()
For anyone who finds that useful:
Code:
// Copy links back to LinkGrabber {by fbd - github.com/FarBeyondDriven/JDscripts} // // Trigger : "DownloadList Contextmenu Button Pressed" // // Add a custom menu entry to the DownloadList Context menu, name it "Copy to LinkGrabber" // (or to any other name, that you also need to customize below) disablePermissionChecks(); if (name == "Copy to LinkGrabber") { var links = dlSelection.getDownloadLinks(); for (i = 0; i < links.length; i++) { var link = links[i]; var urls = []; // try to get all urls that the link has associated if (link.getContentURL()) { urls.push(link.getContentURL()); } if (link.getContainerURL()) { urls.push(link.getContainerURL()); } if (link.getOriginURL()) { urls.push(link.getOriginURL()); } if (link.getUrl()) { urls.push(link.getUrl()); } if (link.getPluginURL()) { urls.push(link.getPluginURL()); } var myFilePackage = link.getPackage(); callAPI("linkgrabberv2", "addLinks", { "deepDecrypt": false, "packageName": myFilePackage.getName(), "destinationFolder": myFilePackage.getDownloadFolder(), "links": urls.join("\r\n") }); } }
__________________
irc.libera.chat #jDownloader web.libera.chat/#jDownloader Last edited by FBD; 07.11.2023 at 02:59. Reason: Typos |
#2669
|
|||
|
|||
![]()
Hi everyone. I would need a script that iterates through all the links/urls of my DownloadList and deletes subsequent duplicates once it finds the first one (which is kept) from the list alone. Any file on the disk is not deleted
Package1 --file1(url.com/file/1) FIRST -> it is not deleted --file2(url.com/file/2) FIRST -> it is not deleted --file3(url.com/file/3) FIRST -> it is not deleted --file1(url.com/file/1) DUPLICATE-> TO DELETE Package2 --file2(url.com/file/2) DUPLICATE-> TO DELETE --file4(url.com/file/4) FIRST -> it is not deleted --file3(url.com/file/3]) DUPLICATE-> TO DELETE package3 --file2(url.com/file/1) DUPLICATE-> TO DELETE --file4(url.com/file/4) DUPLICATE-> TO DELETE --file3(url.com/file/2) DUPLICATE-> TO DELETE --file3(url.com/file/5) NOT DUPLICATE -> it is not deleted can someone help me? Has anyone done something like this in this thread before? Thank you |
#2670
|
|||
|
|||
![]()
Hello all!
What I need to do is, I hope, something pretty simple: I need to reverse the current sort order. NOT changing any SORTED BY column (there isn't one!) - just reverse the order things are in in the DOWNLOAD list, nothing more. From then on, everything should be good. I am NOT a programmer/coder/scripter, so none of this makes any sense to me, and any assistance with this would be GREATLY appreciated! :-) Thank you! --- DS No one can help out? :-( Last edited by DeathStalker; 09.09.2023 at 23:59. |
#2671
|
|||
|
|||
![]()
Hi,
Sorry if this is a stupid question, this forum is very difficult to navigate and find things on. One of the things I've most wanted to be able to use JDownloader to do is automatically crawl the same link every day and download all the (new) PDF files found there. It's essentially the most basic usage of JDownloader, it's just that it takes me a lot of time to do manually. Even if there was some way to make a 'speed-dial' that was a pre-configured set of links and download destinations for those links, that would also be a major step-up for my need. I have no Javascript experience but I could probably edit a preexisting script if one exists. Thank you for any help you may provide. |
#2672
|
||||
|
||||
![]()
@KoneDrat
Some pages earlier I've already posted some hints on how this is possible with minimum effort as another user posted a similar question.
__________________
JD Supporter, Plugin Dev. & Community Manager Erste Schritte & Tutorials || JDownloader 2 Setup Download ----------------------------------- On Vacation / Im Urlaub Start: 2023-12-09 End: TBA |
#2673
|
|||
|
|||
![]()
Hi,
I've started using the "auto update on idle" script and I was wondering if it's possible to receive an email after a successful update & restart? |
#2674
|
|||
|
|||
![]()
I made a script to split a package into single seasons if you are interessted
Code:
// Trigger : Linkgrabber Contextmenu Button Pressed if ( name == "Split Packages By Season" ) { var package = lgSelection.getContextPackage(); var links = package.getDownloadLinks(); var maxNrOfSeasons = 20; var oldFolder = package.getDownloadFolder(); var packageName = package.getName(); var cntalert = 0; for ( var Season = 1; Season <= maxNrOfSeasons; Season++ ) { var S = "S" + ("0" + Season).slice(-2); var links2 = links; var UUIDS = []; for ( var i = 0; i < links.length ; i++ ) { var link = links[i]; var filename = link.getName(); var ind = filename.toUpperCase().indexOf(S + "E"); if ( ind < 0 ) { // file not current season continue; } UUIDS.push( link.getUUID() ); } if ( UUIDS.length > 0 ) { var newPackage = packageName + " _ " + S; var newFolder = oldFolder + " _ " + S; const regex = /(.*)(S\d\d\.-\.S\d\d)(.*)/ var newPackage2 = packageName.replace( regex, "$1" + S + "$3" ); if ( newPackage2 != packageName ) { newPackage = newPackage2 newFolder = oldFolder.replace( packageName, newPackage ) } setNewFolder( UUIDS, newPackage, newFolder ); } } } // Add sub folder function setNewFolder( UUIDS2Move, newPackageName, newFolder ) { callAPI( "linkgrabberv2", "movetoNewPackage", UUIDS2Move, [], newPackageName, newFolder ); } |
#2675
|
|||
|
|||
![]()
Hi there,
i have a long running script which gets started by a button in toolbar. Is it possible to stop/exit the script if the button is pressed again? or if another button is pressed? Code:
if (name == "Test1") { var links = getAllDownloadLinks(); for (i = 0; i < links.length; i++) { var link = links[i]; var waiting = true; while(waiting) { .... sleep(2000); } } .... alert("All Done"); } Is there any method list available anywhere? like api documentation? Last edited by Heinz; 24.09.2023 at 16:35. |
#2676
|
|||
|
|||
![]()
Hey I'm trying to write an eventscript to add the sourceurl where the file was scraped from to the metadata of the resulting file (e.g. in the comment field).
What would be the best way to do this? |
#2677
|
|||
|
|||
![]()
Hola,
Estoy editando el plugin de instagram para que me ponga el nombre como yo quiera según los tag, de esta manera. *uploader*_*date* - *main_content_id*_*orderid**ext* Tal que así: pepito_2023-01-01 - Cm3wOPrM8k9_1.jpg Pero resulta que cuando hay varias publicaciones con el mismo nombre, añade 1, 2, 3 ... según el número de publicaciones dentro del mismo albúm. Esto lo consigo con el *orderid*, hasta aquí, actúa según lo que he puesto. Pero cuando hay una publicación con solo un elemento añade 1 cuando yo solo quiero que en este caso no añada el *orderid*, es decir que actué igual que lo hace por defecto. ¿Hay alguna manera para que el *orderid* cuando está definido en personalizado solo se muestre cuando haya más nombres iguales?, es decir varios elementos dentro una misma publicación. Esto lo consigo dejándolo por defecto sin personalizar. Pero entonces no lo tendría como yo quiero. ¿Como puedo lograrlo a través de un script EventScripter? |
#2678
|
|||
|
|||
![]()
Hi everyone.
I would need a script that deletes archives successfully extracted from the download list, older than X days, with the Interval trigger. The automatic deletion function in the post-extraction option unfortunately, does not delete disabled links. Thanks to those who will help me ![]() |
#2679
|
|||
|
|||
![]() Quote:
i've translated the text above and i'm not sure i've understood all. |
#2680
|
|||
|
|||
![]()
Greetings:
I seek your wisdom. I am trying to create a script that talks to Home Assistant to turn on my Philips Hue lights to alert me when a download finishes. Home Assistant has the scene successfully working.✅✅ When executed using a cURL command, it works.✅✅ When I run this JavaScript code in WebStorm, it successfully works.✅✅ Now JDownloader is the challenge. Code:
const fetch = require("node-fetch"); const url = "**External links are only visible to Support Staff**; const options = { method: 'POST', headers: { 'Authorization': 'Bearer thisismysupersecretlonglivedaccesstokenJpc3MiOiI4MmQyODIz0302ZGU0NDlkODQx14UzMiIsImlhdCI6MTY5NzYxODc1MiwiZXhwIjoyMDEyOTc4NzUyfQ.3ePYuab4RD5Kp7vubRDQ2yCGkPChKmmugrZcldLMRBQ', }, }; fetch(url, options) .then(response => { if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } return response.json(); }) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); I tried to make the code compatible with Event Scripter by asking ChatGPT to create the equivalent code using ES5 and no modules. It gave me this code. When I run it in WebStorm, it does work! Code:
// var request = require("request"); var request = require("C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\request\\request.js"); var url = "**External links are only visible to Support Staff**; var options = { method: 'POST', headers: { 'Authorization': 'Bearer thisismysupersecretlonglivedaccesstokenJpc3MiOiI4MmQyODIz0302ZGU0NDlkODQx14UzMiIsImlhdCI6MTY5NzYxODc1MiwiZXhwIjoyMDEyOTc4NzUyfQ.3ePYuab4RD5Kp7vubRDQ2yCGkPChKmmugrZcldLMRBQ', }, }; request(url, options, function (error, response, body) { if (!error && response.statusCode === 200) { console.log(body); } else { console.error('Error:', error); } }); JDownloader says Code:
TypeError: Cannot read property “strict” from undefined. Last edited by michaeljh; 23.10.2023 at 03:43. |
![]() |
Thread Tools | |
Display Modes | |
|
|