Quote:
Originally Posted by Fetter Biff
Gibt es ein Skript oder sonst eine automatisierte Möglichkeit, zu vermeiden, dass Links, deren Dateien JD schon irgendwann einmal (in den letzten Jahren) runtergeladen hat, nicht noch einmal ruterlädt?
|
Following context menu scripts will delete links from download/linkgrabber list, which cannot be undone. Keep a backup of your link lists and test the scripts with non-critical links first.
Default location of history file: "<JDownloader folder>\cfg\history.txt"
Move selected download links to history file:
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 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("downloadsV2", "removeLinks", linkIds, []);
}
dlSelection.getLinks().forEach(function(link) {
if (link.isFinished()) {
var url = link.getContentURL() || link.getPluginURL();
var id = link.getUUID();
if (history.indexOf(url) == -1) linkUrls.push(url);
linkIds.push(id);
}
})
if (linkUrls.length) {
data = "Added from the downloadlist 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);
}
Move selected linkgrabber lnks to history file:
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);
}
Detect/mark duplicate files when they are added to the linkgrabber tab:
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);
}
}
Skip duplicate links on download start:
Code:
// Skip link if it present in download history (has "#duplicatelink" in comment)
// To download the file (prevent skipping), remove "#duplicatelink" from comment
// Trigger required: A Download Started
var comment = link.getComment() || "";
if (comment.indexOf("#duplicatelink") > -1) {
var url = link.getContentURL() || link.getPluginURL();
link.setSkipped(true);
alert("Download Skipped: \"" + url + "\" is present in history file.");
}