Hi all,
I need some help with a script that can delete the history (the same as if you were to open the web ui and click 'delete completed").
I currently have script set up that runs after the queue is finished. The script grabs the data from the history rss feed (http://localhost:8080/sabnzbd/rss?mode=history) and dumps it as an xml file on my desktop. - basically a log of what has been downloaded during the day. ( I didn't write this script I found it on the net - so don't ask me how it does what it does).
This allows me to come home, open the file sitting on the desktop and see exactly what has happened during the day.
The issue is - unless the history is deleted after reading the log, all of the history from this log will be included in the next history log since it is still sitting in sab's history.
I'm looking for something that I can run after I have read the log (it would be launched manually by a key combination) that would delete sab's history and then delete the xml from the desktop..
So basically I come home, read the log on the desktop, close the log, and then hit a key combo which launches the script which clears the history and deletes the log from the desktop.
Any help would be great.
Thanks, Ash
Help with script to delete completed history
Re: Help with script to delete completed history
Deleting SAB 's history can be done via the API; see http://wiki.sabnzbd.org/api#toc42:
Deleting all items:
URL: api?mode=history&name=delete&value=all
A curl / wget / lynx command should be able to do that. Do you have one of those three installed?
Deleting the log file can be done via the operating system by just deleting the file (I guess; not tested).
You can put both commands in a shell script. It depends on your operating system how the script should look like.
Deleting all items:
URL: api?mode=history&name=delete&value=all
A curl / wget / lynx command should be able to do that. Do you have one of those three installed?
Deleting the log file can be done via the operating system by just deleting the file (I guess; not tested).
You can put both commands in a shell script. It depends on your operating system how the script should look like.
Re: Help with script to delete completed history
Thanks for the fast reply.
I've just installed Curl (having never used it before) but am not sure how to send the api key.
I've tried using this url:
The url works fine when entered accessed through my browser, it returns an "ok" message and the history is cleared.
But when using it with Curl I get "error Api Key required".
I've just installed Curl (having never used it before) but am not sure how to send the api key.
I've tried using this url:
Code: Select all
http://localhost:8080/sabnzbd/api?mode=history&name=delete&value=all&apikey=XXXXXXXXXXXXXXXXXXXXXXX
But when using it with Curl I get "error Api Key required".
Re: Help with script to delete completed history
How about putting (double?) quotes around the complete URL?
Re: Help with script to delete completed history
Brilliant, that was all it needed. Works like a charm now.
Thanks very much for your help.
Ash
Thanks very much for your help.
Ash
-
- Newbie
- Posts: 4
- Joined: October 26th, 2017, 7:20 am
Re: Help with script to delete completed history
It would be reallly great if you could from the API delete just a specific category from the history e.g. "TV" or something else configures under http://localhost:8080/config/categories/
Re: Help with script to delete completed history
Should be possible already? First api call to get the history output limited to a specific category, collect ids from that; then a second api call to delete those.GhostCOM97 wrote: ↑September 17th, 2019, 3:25 am It would be reallly great if you could from the API delete just a specific category from the history e.g. "TV" or something else configures under http://localhost:8080/config/categories/