Code:
// Add selected linkgrabber links to history, and remove them from the list
// Tirgger required: Linkgrabber Contextmenu Button Pressed
// Customize linkgrabber context menu > Add new "Eventscripter Trigger" button > Rename it to "Move to history" (without quotes) > Change Icon (optional)
if (name == "Move to history") {
var historyFile = getPath(JD_HOME + "/cfg/history.txt");
if (!historyFile.exists()) writeFile(historyFile, "", true);
var history = readFile(historyFile);
var linkUrls = [];
var linkIds = [];
var removeLinks = function(linkIds) {
callAPI("linkgrabberv2", "removeLinks", linkIds, []);
}
lgSelection.getLinks().forEach(function(link) {
var url = link.getUrl();
var id = link.getUUID();
if (history.indexOf(url) == -1) linkUrls.push(url);
linkIds.push(id);
})
if (linkUrls.length) {
data = "Added from the lingkrabber list on " + Date().toString().substring(4, 24) + "\r\n";
data += linkUrls.join("\r\n") + "\r\n\r\n";
writeFile(historyFile, data, true);
}
if (linkIds.length) removeLinks(linkIds);
}
Code:
/*
Add finished download links from selection to history, and remove them from the list
Tirgger required: Downloadlist Contextmenu Button Pressed
Customize downloadlist context menu > Add new "Eventscripter Trigger" button > Rename it to "Move to history" (without quotes) > Change Icon (optional)
*/
if (name == "Move to history") {
var file = getPath(JD_HOME + "/cfg/history.txt"),
urls = file.exists() ? readFile(file) : "",
newUrls = "",
url, data, text, comment;
dlSelection.links.forEach(function(link) {
if (link.finished) {
url = link.contentURL || link.pluginURL;
if (urls.indexOf(url) == -1) {
newUrls += url + "\r\n";
link.remove();
}
}
});
if (newUrls.length) {
data = "Added from the downloadlist list on " + Date().toString().substring(4, 24) + "\r\n";
data += newUrls + "\r\n";
writeFile(file, data, true);
getAllCrawledLinks().forEach(function(link) {
if (link.availableState == "ONLINE") {
url = link.contentURL || link.pluginURL;
text = "#duplicatelink";
comment = link.comment || "";
if (comment.indexOf(text) == -1 && (urls + newUrls).indexOf(url) > -1) {
link.comment = comment ? text + " " + comment : text;
}
}
});
}
}
Code:
// Remove #duplicatelink and #dupliatefile from comment field for selected links
// Trigger: Downloadlist Contextmenu Button Pressed
if (name = "Clear dupe comment") {
dlSelection.getLinks().forEach(function(link) {
var myComments = ["#duplicatelink", "#duplicatefile"];
myComments.forEach(function(myComment) {
var comment = link.getComment() || "";
if (comment.indexOf(myComment) > -1) link.setComment(comment.replace("#duplicatelink", "").replace("#duplicatefile", ""));
})
})
}
Code:
// Remove/Re-add filecrypt.cc links with wrong captcha
// Trigger: Interval (Recommended 60000 or more)
// IMPORTANT: Enable ''Synchronous execution of script' in top panel
var delay = 15; // Set delay (in seconds) between retries
links = getAllCrawledLinks().filter(function(crawledLink) {
var link = crawledLink.contentURL || "";
return link.indexOf("filecrypt.cc") > -1 && crawledLink.name.indexOf("Wrong Captcha!") > -1;
}).forEach(function(crawledLink) {
sleep(delay * 1000);
callAPI("linkgrabberv2", "addLinks", {
"links": crawledLink.contentURL
});
crawledLink.remove();
})
Code:
/*
Disable duplicate link in Lingrabber
Trigger required: A new link has been added
*/
var link = crawledLink;
if (link.availableState == "ONLINE") {
var name = "history";
var lock = getModifyLock(name);
lock.writeLock();
var urls = getProperty(name, true);
if (urls == null) {
try {
var file = JD_HOME + "/cfg/history.txt";
var urls = readFile(file);
setProperty(name, urls, true);
} catch (e) {}
}
lock.writeUnlock();
if (urls) {
var url = link.contentURL || link.pluginURL;
if (link.host == "youtube.com") {
url = link.containerURL;
}
if (urls.indexOf(url) > -1) {
var text = "#duplicatelink";
var comment = link.comment;
if (comment) {
text = text + " " + comment;
}
link.comment = text;
link.enabled = false;
}
}
}
This one does not seem not to be needed anymore, it is deactivated, but who knows:
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 von jD-Downloads - alle Dateien, Dummies aus dem Ordner - alle ca. 95.000 Dateien als Liste.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);
}
And this also seems not be needed anymore, deactivated also:
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 von jD-Downloads - alle Dateien, Dummies aus dem Ordner - alle ca. 95.000 Dateien als Liste.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);
}