Hier sind die Skripte, die "history" enthalten:
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 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);
}