View Single Post
  #954  
Old 03.10.2019, 13:23
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 628
Default

Quote:
Originally Posted by Amiganer View Post
I think, that can be done by a plugin? It will collect (like the script now does) the finished links...
Code:
// Build/update downloaded links history and add comment to finished link
// Trigger : JDownloader Started

var list = "c:/downloads/finished.txt"; // <- Set path to history file

var history = getPath(list).exists() ? readFile(getPath(list)).split("\r\n") : [];
var urls = [];

callAPI("downloadsV2", "queryLinks", {
    "comment": true,
    "finished": true
}).filter(function(apiLink) {
    return apiLink.finished && apiLink.comment != "Added to History";
}).forEach(function(apiLink) {
    var link = getDownloadLinkByUUID(apiLink.uuid);
    var url = link.getPluginURL();
    if (history.indexOf(url) == -1) {
        urls.push(url);
        link.setComment("Added to History");
    }
})

if (urls.length) writeFile(getPath(list), urls.join("\r\n") + "\r\n", true);

Quote:
Originally Posted by Amiganer View Post
... and if a new link arrives compare that with already downloaded linkList created by the plugin himself.
Code:
// Disable links, if they exist in history
// Trigger: A Download Started

var list = "c:/downloads/finished.txt"; // <- Location of history file
var history = getPath(list).exists() ? readFile(getPath(list)).split("\r\n") : [];

if (history.indexOf(link.getPluginURL()) > -1) link.setEnabled(false);

Quote:
Originally Posted by Amiganer View Post
Is it possible to mark a downloadlink as double in the linkGrabber? As I know, highlithing it (red I think) is not possible, maybe something like a comment that is shown.... complex....
Code:
// Move links to to "Already Downloaded" package, if they exist in history
// Trigger: Packgizer Hook
// IMPORTANT: Enable "Synchronous execution" checkbox

if (state == "AFTER") {
    var list = "c:/downloads/finished.txt"; // <- Location of downloaded links history file
    var history = getPath(list).exists() ? readFile(getPath(list)).split("\r\n") : [];

    if (history.indexOf(link.getURL()) > -1) link.setPackageName("Already Downloaded");
}
Reply With Quote