Oh sorry, so many scripts, the wrong one. So I comment it out and could use it if need be. So I can use link.setEnabled(false); twice (if need be)(?) - where the lines are commentet out:
Quote:
skipLink(); is a invalid command. To skip link you have to use link.setSkipped(true);. Also, if you choose to disable the link it is not necessary to also skip it.
|
Oops, two times the invalid command, do not have any idea how these commands get there.
Very strange, the script (obviously) worked with an invalid command.
Quote:
Also, if you choose to disable the link it is not necessary to also skip it.
|
Yes, isn't it disabled (commented out)? But it would work? Both ones at the same time, I mean? I just would exchange the commands, if need be, comment out the other one.
Hope, it is correct now:
Code:
// Skip download link, if filename exists in the user-spcified list
// To download the file (prevent skipping), remove "#duplicatefile" from comment
// Trigger required: A Download Started
var fileNamesList = "I:\\jD-Downloads\\jD-Dummies.txt"; // < Set path to text file which contain the file names. Use "\\" or "/" as path separators.
var dupeFilecheck = link.getProperty("dupeFileCheck");
var linkName = link.getName();
var comment = link.getComment() || "";
var skipLink = function() {
link.setSkipped(true); //To disable the link instead of skipping it, replace link.setSkipped(true); with link.setEnabled(false); in both the scripts.
alert("Download Skipped: File \"" + linkName + "\" is present in files list.");
}
if (dupeFilecheck) {
if (comment.indexOf("#duplicatefile") > -1) link.setSkipped(true);
} else {
var fileNames = readFile(getPath(fileNamesList)).trim().split("\r\n");
fileNames.some(function(fileName) {
if (linkName == fileName.trim()) {
var text = "#duplicatefile";
comment = comment ? text + " " + comment : text;
link.setComment(comment);
// link.setEnabled(false); falls Duplikate im Download-Fenster enabled werden sollen
link.setSkipped(true);
return true;
}
})
link.setProperty("dupeFileCheck", true);
}
Quote:
You will also have to add link.setEnabled(false); in the link check script, if you want to disble the links in linkgrabber tab.
|
Hope, it is correct:
Code:
// If download link is present in history file, mark it as duplicae (add "#duplicatelink" to comment)
// Trigger required: Packagizer Hook
if (state == "AFTER") {
var url = link.getURL();
var historyFile = getPath(JD_HOME + "/cfg/history.txt");
var history = historyFile.exists() ? readFile(historyFile) : "";
if (history.indexOf(url) > -1) {
var text = "#duplicatelink";
var comment = link.getComment();
comment = comment ? text + " " + comment : text;
link.setComment(comment);
link.setEnabled(false);
}
}