#11
|
|||
|
|||
Hi there, I was hoping for some help in making a script.
I have a MEGA folder someone's shared with me that occasionally has new files added to it. I was hoping for a way to automatically add those new files to JD2 and have them downloaded to a specific folder. I figured the best way to do this is to have an Interval trigger EventScripter script that has LinkGrabber periodically re-analyse the MEGA folder URL, and if it finds new download links that have not previously been added to the download list then it should add them to the download list and start the download. Is there a way to do this with event scripter? EDIT: Here's my script in case it's useful for anyone else. Code:
// Paste this script into Jdownloader's EventScripter under a new Event named "LinkWatcher", with trigger set to "Interval", and interval set to 21600000 milliseconds (6hrs). // Make sure to "Test Run" once after making the event or editing the script, which will bring up a one-time pop-up box asking if you're okay that the script does API calls; click yes obviously and make sure "do not ask again" is checked. // If a particular link isn't working with this for some reason, remove all existing packages in the Linkgrabber that relate to that URL and try again. // Define each link to watch as a dict within the links array. // Leave unnecessary fields blank; e.g. password for download or extract (DPW and EPW respectively) may be unnecessary. // Name is just a field to make that particular link dict identifiable to you, it's not passed along to JD. // PackageName on the other hand defines the packge name in JD. // Ensure the backslashes in Path are doubled to escape them var links = [{ Name: "TV Show", PackageName: "AwesomePackage", URL: "**External links are only visible to Support Staff**, Path: "C:\\Downloads", DPW: "", EPW: "" }, { Name: "TV Show #2", PackageName: "LessAwesomePackage", URL: "**External links are only visible to Support Staff**, Path: "C:\\Downloads", DPW: "", EPW: "" }] // For info on the structure/options within the addlinks API call, see the following: https://my.jdownloader.org/developers/#tag_244 and https://my.jdownloader.org/developers/#tag_245 // Overwrite Packagizer Rules allows you to define the download path and Package Name, etc here in the script // Autostart automatically moves the files from linkgrabber -> download list and starts downloading them. // In order to make this operate entirely without human intervention, you need to set some keys in the Advanced Settings section of JD Settings // Set LinkgrabberSettings.defaultonaddeddupeslinksaction to "do NOT add, but remove them from linkgrabber". // Set LinkgrabberSettings.handledupesonconfirmlatestselection to "do NOT add, but remove them from linkgrabber". // The first is the most important one. This makes it so that by default, WITHOUT being asked, if you try to move an already-downloaded link from linkgrabber -> download list, it'll remove it from linkgrabber but it WON'T try to redownload it. To redownload it you'd need to delete the link from the download list, or just click Reset on it. for (i = 0; i < links.length; i++) { var link = links[i]; callAPI("linkgrabberv2", "addLinks", { "overwritePackagizerRules": true, "autostart": true, "links": link.URL, "packageName": link.PackageName, "downloadPassword": link.DPW, "extractPassword": link.EPW, "destinationFolder": link.Path }); }; Last edited by HeyItsJono; 14.04.2023 at 09:34. |
Thread Tools | |
Display Modes | |
|
|