Page 1 of 1

Retry all failed downloads

Posted: July 12th, 2013, 10:11 am
by szafran
Hi,

I have lots of failed, because I haven't got the time to get through the history in some time.
I've just been adding new things to the queue.
Now it's time to make some cleaning up.

How can I retry all failed downloads from history ?
Retrying them one by one would take me 2 days :/

Re: Retry all failed downloads

Posted: July 12th, 2013, 12:59 pm
by shypike
szafran wrote: Retrying them one by one would take me 2 days :/
You can retry the next one before the first is finished.

Re: Retry all failed downloads

Posted: July 12th, 2013, 5:55 pm
by szafran
shypike wrote:
szafran wrote: Retrying them one by one would take me 2 days :/
You can retry the next one before the first is finished.
hm... ???

So... I'll ask again... How can I retry them all at once ?

Re: Retry all failed downloads

Posted: July 14th, 2013, 4:30 am
by shypike
Currently not, unless you write a script that uses SABnzbd's API.
I'll see what I can do.

Re: Retry all failed downloads

Posted: July 14th, 2013, 4:33 am
by szafran
It would be great if you could help me.

Re: Retry all failed downloads

Posted: July 14th, 2013, 4:36 am
by shypike
That would be a button in a later release, so it may take some time.

Re: Retry all failed downloads

Posted: July 14th, 2013, 4:39 am
by szafran
Any help with the script that you mentioned ?
Don't know anything about SABs API :/

Re: Retry all failed downloads

Posted: July 14th, 2013, 4:45 am
by shypike
That's just too much work.
The button is actually easier.

Re: Retry all failed downloads

Posted: July 14th, 2013, 8:23 am
by szafran
K. Thanks for the info.

Re: Retry all failed downloads

Posted: April 18th, 2014, 3:14 am
by keksautomat
I just wrote a little script for that.
Use it as a new script in Tampermonkey:

Code: Select all

// ==UserScript==
// @name       Sabnzb Retry Script
// @namespace  http://use.i.E.your.homepage/
// @version    0.1
// @require    http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @require    https://raw.githubusercontent.com/madbook/jquery.wait/master/jquery.wait.js
// @description  This script will set your failed downloads to retry via its API
// @match      http://changeme:8080/
// @copyright  2014, keksautomat
// ==/UserScript==

//set me to false if you do not want me to run
var run = true;
init();
function init() {
    if(run === false) return false;
    
    //Fill me with your APIkey!
    var APIkey = 'changeme';
    
    //Change refresh rate so it doesnt fuck with my work
    $("#refreshRate-option").val('1800').change();
    
    if($("#historyTable > tbody > tr").length == 0) {
        setTimeout(init, 5000) //with delay of 5 seconds so it wont break the browser or anything
    }
    //First set failed downloads to everything, so I can iterate through it with no problems in the way
    $("#history-pagination-perpage").val('9999999').change();
    
    //Get the ids of each table row, that way I can make an ajax call to retry given element
    $('#historyTable > tbody > tr').wait(1000).each(function() {
        //Do this with a delay of 1 second as it might crash the browser otherwise
        var rID = $(this).prop("id");
        
        //Make the ajax call, I do not need to know where you're sitting as I should only work on the given URL set above (@match)
        $.ajax("api?mode=retry&apikey=" + APIkey + "&value=" + rID)
        .done(function() {
            //TODO: get a cookie as a reward
        })
        .fail(function() {
            //TODO: what to do, what to do..
        });
    });   
}
Dont forget to change the @match in the Header and the APIKey of your sab installation.


//Edit

Version 0.2
Removed if statement. If you dont want the script to run, just disable it via Tampermonkey. No need to edit the script for that.
Added "ignoring" list of a item which is already on the retry list. Sab will thank me for that. :D

Code: Select all

// ==UserScript==
// @name       Sabnzb Retry Script
// @namespace  http://use.i.E.your.homepage/
// @version    0.2
// @require    http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @require    https://raw.githubusercontent.com/madbook/jquery.wait/master/jquery.wait.js
// @description  This script will set your failed downloads to retry via its API
// @match      http://changeme:8080/
// @copyright  2014, keksautomat
// ==/UserScript==

//set me to false if you do not want me to run
init();
function init() {
    
    //Fill me with your APIkey!
    var APIkey = 'changeme';
    
    //Change refresh rate so it doesnt fuck with my work
    $("#refreshRate-option").val('1800').change();
    
    if($("#historyTable > tbody > tr").length == 0) {
        setTimeout(init, 5000) //with delay of 5 seconds so it wont break the browser or anything
    }
    //First set failed downloads to everything, so I can iterate through it with no problems in the way
    $("#history-pagination-perpage").val('9999999').change();
    
    //Get the ids of each table row, that way I can make an ajax call to retry given element
    $('#historyTable > tbody > tr').wait(1000).each(function() {
        //Do this with a delay of 1 second as it might crash the browser otherwise
        var rID = $(this).prop("id");
        
        //Check if first child of this has class "Loaded". If it does, skip this item as its already being retried
        if($(this).children(":first").children(":first").hasClass("Loaded")) {
            console.log("No need for " + rID + " to be added to retry list, as its already on the list!");   
            return;
        }
        
        
        //Make the ajax call, I do not need to know where you're sitting as I should only work on the given URL set above (@match)
        $.ajax("api?mode=retry&apikey=" + APIkey + "&value=" + rID)
        .done(function() {
            //TODO: get a cookie as a reward
        })
        .success(function() {
            console.log("Sab will retry " + rID);
        })
        .fail(function() {
            //TODO: what to do, what to do..
        });
    });   
}


This only works on "Plush" btw!

Re: Retry all failed downloads

Posted: January 5th, 2015, 4:37 am
by sabnzbler
Hi,
thanks for the script.
I'm trying to get this to run but I did not succeed.
I installed Tampermonkey and inserted your script.
Then I inserted my Sab URL in the settings as user match.
But what ist it with
// @require http://ajax.googleapis.com/ajax/libs/jq ... ery.min.js
// @require https://raw.githubusercontent.com/madbo ... ry.wait.js
I put this in user include. Is that right?

Thanks in advance for your help!

sabnzbdler

EDIT:
I noticed that I only have to insert my IP and the API Key and don't have to do anything with the required things.

EDIT EDIT:
IT WORKED! THANKS A LOT!
Silent in the backround it did it's job.
When I wachted my downloads they were all processed!
But unfortunately it's not working at all. Have no errors but it isn't happening anythin :-\

Re: Retry all failed downloads

Posted: January 5th, 2015, 9:05 am
by shypike
There will be something for this in 0.8.0

Re: Retry all failed downloads

Posted: February 9th, 2015, 10:26 pm
by keksautomat
There will be something for this in 0.8.0
Thanks. :)
EDIT EDIT:
IT WORKED! THANKS A LOT!
Silent in the backround it did it's job.
When I wachted my downloads they were all processed!
But unfortunately it's not working at all. Have no errors but it isn't happening anythin :-\
The script changes the auto-reload time to 30mins that is why you have to manually reload the site to actually see something.

Its an easy fix to set it back to 8s or something when nothing is found but I am currently unable to test anything because I dont have a sabnzd set-up.