Retry all failed downloads

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
szafran
Newbie
Newbie
Posts: 5
Joined: July 11th, 2013, 3:46 pm

Retry all failed downloads

Post 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 :/
Best regards
Szafran
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Retry all failed downloads

Post 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.
szafran
Newbie
Newbie
Posts: 5
Joined: July 11th, 2013, 3:46 pm

Re: Retry all failed downloads

Post 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 ?
Best regards
Szafran
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Retry all failed downloads

Post by shypike »

Currently not, unless you write a script that uses SABnzbd's API.
I'll see what I can do.
szafran
Newbie
Newbie
Posts: 5
Joined: July 11th, 2013, 3:46 pm

Re: Retry all failed downloads

Post by szafran »

It would be great if you could help me.
Best regards
Szafran
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Retry all failed downloads

Post by shypike »

That would be a button in a later release, so it may take some time.
szafran
Newbie
Newbie
Posts: 5
Joined: July 11th, 2013, 3:46 pm

Re: Retry all failed downloads

Post by szafran »

Any help with the script that you mentioned ?
Don't know anything about SABs API :/
Best regards
Szafran
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Retry all failed downloads

Post by shypike »

That's just too much work.
The button is actually easier.
szafran
Newbie
Newbie
Posts: 5
Joined: July 11th, 2013, 3:46 pm

Re: Retry all failed downloads

Post by szafran »

K. Thanks for the info.
Best regards
Szafran
keksautomat
Newbie
Newbie
Posts: 4
Joined: April 18th, 2014, 3:10 am

Re: Retry all failed downloads

Post 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!
sabnzbler
Newbie
Newbie
Posts: 2
Joined: January 5th, 2015, 3:54 am

Re: Retry all failed downloads

Post 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 :-\
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Retry all failed downloads

Post by shypike »

There will be something for this in 0.8.0
keksautomat
Newbie
Newbie
Posts: 4
Joined: April 18th, 2014, 3:10 am

Re: Retry all failed downloads

Post 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.
Post Reply