View Single Post
  #5  
Old 30.10.2020, 01:35
dereks10 dereks10 is offline
Vacuum Cleaner
 
Join Date: Sep 2020
Posts: 16
Default

Ahhh, foiund it, deeep in a thread. He just drops this script and that was end of thread. I dont know how it turned out, but i have zero knowledge of scripts. Hopefully its just a copy paste with minimal work needed. Ill figure out my event scripter and check back in.
Here is all i could find.

Code:
// Disable the download if the file already exists on the disk with alternate name.
// Trigger Required: "A Download Started".

var name = link.getName();
var altName = /\s/g.test(name) ? name.replace(/\s/g, "_") : name.replace(/_/g, " ");
var altPath = getPath(link.getPackage().getDownloadFolder() + "/" + altName);

if (name != altName) {
if (altPath.exists()) link.setEnabled(false);
}



verify if the file exist in a folder and if no, download the file on a other folder.
example :
verify -> c:\first\folder [EXIST] skip
verify -> c:\first\folder [NO EXIST] download in the folder e:\second\folder ...




Code:
// Change download folder if a file does not already exist in default folder.
// Trigger Required: "A Download Started".

var altFolder = "e:/second/folder"; // <- Set Alternate download folder
var file = getPath(link.getDownloadPath());
var packageName = link.getPackage().getName();
var UUID = link.getUUID();

if (!file.exists()) {
getPath(altFolder).mkdirs();
callAPI("downloadsV2", "movetoNewPackage", [UUID], [], packageName, altFolder);
}

Path can be set/changed only for the entire package. So the link will be moved to a different package (with the same name). Also note, the file on the disk will be moved to the new folder only after the download has stopped.

In General settings enable "skip" if file exists.