View Single Post
  #1050  
Old 29.01.2020, 17:24
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,545
Default

Quote:
Originally Posted by ElCho View Post
... a script which fixes the faulty status of some "Zippyshare" downloads (usually just one) that get stuck every now and then, blocking the "shutdown extension" and, consequently, making my PC stays on all the time just because one or two incomplete files ...
The status message available to the script will be different than the one displayed in GUI. To be able to create/test a script based on status messages, one should be able to access it. I may not be able to do so, since I rarely download from that hoster. Even if I did for testing purposes, It might not be easy to trigger those exact messages. If you are familiar with Javascript, I can offer you my assistance (if required) to create one.

Alternatively, you might be able to achieve the same result with the following script. It will skip/restart (or reset, depending on if any data has been downloaded for that link) failed downloads as long as other downloads are active. In the event they do not start during that period, they will remain skipped and allow the extension to shutdown the system.

Code:
// Skip/Unskip (or reset) unfinished downloads from user-spcified hosters
// Trigger: A download stopped

var myHosts = ["example.com", "demo.com,", "zippyshare.com"]; // <- Process links only from these hosters

if (link.isFinished()) {
    getAllDownloadLinks().filter(function(link) {
        if (link.isFinished()) return;
        if (myHosts.indexOf(link.getHost()) == -1) return;
        if (!link.isSkipped()) return;
        if (link.getSkippedReason() != "MANUAL") return;
        if (link.getBytesLoaded()) link.setSkipped(false);
        if (!link.getBytesLoaded()) link.reset();
    })
}

if (!link.isFinished() && myHosts.indexOf(link.getHost()) > -1) {
    link.setSkipped(true);
}

Last edited by mgpai; 29.01.2020 at 17:28.
Reply With Quote