Working CLI interface for 0.5.0 for sabnzbd+

Got a program that plays well with SABnzbd? Share it here!
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Working CLI interface for 0.5.0 for sabnzbd+

Post by tobiasthecommie »

UPDATE:

I have rereleased this as SABcli on

http://code.google.com/p/sabcli/

Further updates and changelog will happen there.

------------------------

I hacked the sabnzbd_client.py script to work with 0.5

I'm not sure if there is an official maintainer of the script, i couldn't find anything, so posting the patched version here.

As far as i know there never was a fully implemented CLI(with API limitations before 0.5.0) so i just updated the script i used. I know there are others out there, but as far as i know none of them work with 0.5.0.

For now, at least, it is just a plain transfer to 0.5.0 with one minor, addition. If there is interest i might update the functionality a bit.

Changes since the version i downloaded:
- Added support for 0.5.0*
- The command "status" is now called "queue"
- Added the environment variable "SABCLICFG" so you can now define the location of the config file.

*I haven't tested the newzbin functionality since i don't have a newzbin account.

Does anyone besides me care about this script?
I am considering adding some queue manipulation to the script, and i might just entirely refactor it.
Last edited by tobiasthecommie on April 4th, 2010, 5:17 pm, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: sabnzbd_client.py for 0.5 [working script attached]

Post by tobiasthecommie »

Ok, added some more stuff aleady.

Added version numbering, this is version 0.2(because i consider the first one i downloaded to be 0.1).

Changes since version 0.1
- Added support for 0.5.0 ( newzbin not tested )
- The command "status" is now called "queue"
- Added the environment variable "SABCLICFG" so you can now define the location of the config file.
- Added Warnings
- Added History (And support for delete of ALL history. Does anyone want selective history deletion? Is pretty easy to add)
- Added newapikey support.
- Added speedlimit support.
- Added version support. (Shows program version, api version, and daemon version. Tests if api and daemon version match)

Todo:
- delete and move queue items
- Action on queue complete
- Change Post Processing
- Change Priority
Last edited by tobiasthecommie on March 14th, 2010, 5:59 pm, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
wally007
Release Testers
Release Testers
Posts: 155
Joined: August 28th, 2009, 5:24 pm

Re: sabnzbd_client.py for 0.5 [working script attached]

Post by wally007 »

I may be daft or something but i still havent figured out what the heck your script is about.
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: sabnzbd_client.py for 0.5 [working script attached]

Post by tobiasthecommie »

It's not my script, i just updated it.

It's a CLI interface to sabnzbd. I really prefer to work in terminals, and i like always having access through ssh. I know i can port forward and use the web interface through that. But i would rather just have a nice Command Line Interface.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: sabnzbd_client.py for 0.5 [working script attached]

Post by tobiasthecommie »

Ok, here is version 0.3

Changes since version 0.2
- added priority support
- added rename support
- added remove support
- added pathget support
- added move support. (move items in download queue)
- added postproccessing support
- added queuecompleted support General on the webinterface>
------

Install:
move sabnzbd_client.py to a place in PATH
make sabnzbd_client.py executable
install xmltopy

Usage:
Run sabnzbd_client.py with no arguments to get a help screen:
----
~ $ sabnzbd_client.py
sabnzbd_client.py

Compatible with SABnzbd+: 0.5.0

Commands:
       pause
       resume
       shutdown
       restart
       version
       queue
       warnings
       move [id] [new position]
       history [delete]
       newapikey [confirm]
       speedlimit [value]
       newzbin
       addurl
       pathget
       rename [id] [newname]
       remove [id]
       priority [id] [value]-1 = Low, 0 = Normal, 1 = High, 2 = Force
       postprocessing [id] [value] 0 = Skip, 1 = Repair, 2 = Unpack, 3 = Delete
       queuecompleted - implemented, not confirmed

Environment variables:
       SABCLICFG=~/.nzbrc (default)
----

If there are any questions, bug reports, or feature requests, just reply to this thread and i will get an email.

Though i'm not sure if anyone other than me care about a CLI interface. It is actually the one thing i really miss from hellanzb.
Last edited by tobiasthecommie on March 22nd, 2010, 6:33 pm, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: Working CLI interface for 0.5.0 with working queue manipulation.

Post by tobiasthecommie »

Added better support for managing host information from the command line, instead of using config file.

Version 0.4 - Changelog
- Added argument support for
 - Hostname
 - Port
 - Username
 - Password
 - Apikey

-- Help screen --


sabnzbd_client.py

Compatible with SABnzbd+: 0.5.0

Commands:
       pause
       resume
       shutdown
       restart
       version
       queue
       warnings
       move [id] [new position]
       history [delete]
       newapikey [confirm]
       speedlimit [value]
       newzbin
       addurl
       pathget
       rename [id] [newname]
       remove [id]
       priority [id] [value]-1 = Low, 0 = Normal, 1 = High, 2 = Force
       postprocessing [id] [value] 0 = Skip, 1 = Repair, 2 = Unpack, 3 = Delete
       queuecompleted - implemented, not confirmed

Arguments:
       -h [--help]                     Help screen
       -j [job-option=3]               Set job-option
       -H [--hostname=localhost]       Hostname
       -P [--port=8080]                Port
       -u [--username=user]            Username
       -p [--password=pass]            Password
       -a [--apikey=15433acd...]       Apikey

Environment variables:
       SABCLICFG=~/.nzbrc (default)
Last edited by tobiasthecommie on March 21st, 2010, 6:31 pm, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: Working CLI interface for 0.5.0 with working queue manipulation.

Post by tobiasthecommie »

Yet another version

Version 0.5 - Changelog
- Version bumped to version 0.5 since all the functionality seems to be there. Future versions(if any) will be in the form of 0.5-1. The major version number will match the SABnzbd+ from here on out(with the added -X for minor bugfixes etc).
- Replaced the NZO_id with index id in all functions.
- Now shows queue if launched with no command.
- Much improved queue screen
  - 3 line layout.
  - Fixed problem with too many whitespaces.
  - Added average age
  - Added Timeleft
  - Added Priority
  - Added PostProcessing.
  - Added percentage for individual downloads, and for total queue.
- Better feedback on all functions.
  - These functions "remove, rename, move, priority, postprocessing, addurl, pause and resume" now all give the queue screen as output.
- Much improved history screen.
 - Now shows if par verify passed or failed.
 - Same for unpack.
 - Shows what went wrong on failure.
 - There is no feedback about delete, so that has been left out.
- Changed temp/target to free/total on target. - That is, free/total disk space on target disk.

----- Queue screen -----
$ sabnzbd_client.py

Free/Total Disk: 13.11 / 270.66 GB                           Speed: 1356.90 kb/s                          
                       Queue: 425.06 / 1410.06 MB [30%]                        
# - Filename                                                     Size (MB) [pct]                                                    
--------------------------------------------------------------------------------
0 - download.1 (active)
   Priority: Normal - PostProcessing: Download, Repair
   Average Age: 14d - Timeleft: 0:00:21                    28.91 / 406.59 [92%]                  

1 - download.3
   Priority: Normal - PostProcessing: Download, Repair
   Average Age: 1d - Timeleft: 0:06:04                    454.36 / 501.74 [ 9%]                  

2 - download.2
   Priority: Normal - PostProcessing: Download, Repair
   Average Age: 1d - Timeleft: 0:12:23                    501.74 / 501.74 [ 0%]                  

---- History screen -----

$ sabnzbd_client.py history

Free/Total Disk: 9.25 / 270.66 GB                               Speed: 0.00 kb/s                              
                       Queue: 0.00 / 0.00 MB [ 0%]                        
# - Filename                                                           Size (MB)                                                          
--------------------------------------------------------------------------------
Name.S00E00.HDTV.XviD-bla
- [download: 182.66 MB] [par2: OK] [unpack: OK]

multiple.gb.download
- [download: 14.38 GB] [par2: FAIL]
- [rw-cd3] Repair failed, not enough repair blocks (100 short)
- [rw-cd1] Repair failed, not enough repair blocks (117 short)
- [rw-cd2] Repair failed, not enough repair blocks (87 short)
Last edited by tobiasthecommie on March 22nd, 2010, 5:29 pm, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: Working CLI interface for 0.5.0 with working queue manipulation.

Post by tobiasthecommie »

Version 0.5-1 - Changelog
- Minor cleanup
- Cleanup of help screen
- History is now in reverse order(newest last)
- Added Pause individual download
- Added Resume individal download
- Added status for all items in queue
- Added details view for items in queue
- Added temporary pause
- Added ability to delete multiple items from the queue, or the entire queue

----- Queue screen -----
$ sabnzbd_client.py

Free/Total Disk: 13.11 / 270.66 GB                           Speed: 1356.90 kb/s                          
                       Queue: 425.06 / 1410.06 MB [30%]                        
# - Filename                                                     Size (MB) [pct]                                                    
--------------------------------------------------------------------------------
0 - download.1 (Paused)
   Priority: Normal - PostProcessing: Download, Repair
   Average Age: 14d - Timeleft: 0:00:21                    28.91 / 406.59 [92%]                  

1 - download.3 (Downloading)
   Priority: Normal - PostProcessing: Download, Repair
   Average Age: 1d - Timeleft: 0:06:04                    454.36 / 501.74 [ 9%]                  

2 - download.2 (Queued)
   Priority: Normal - PostProcessing: Download, Repair
   Average Age: 1d - Timeleft: 0:12:23                    501.74 / 501.74 [ 0%]                  


----- Details screen -----
$ sabnzbd_client.py details 0

Filename
--------------------------------------------------------------------------------
download.1.rar
- [Status: finished] [Downloaded: 19.69/19.69 MB]

download.1.r00
- [Status: active] [Downloaded: 15.12/19.69 MB]

download.1.par2
- [Status: queued] [Downloaded: 0.38/3.97 MB]



--------------------------------------------------------------------------------

There are currently only a few things missing from the API:
- Anything to do with categories
- Anything to do with scripts
- Extra information (priority, category, etc) when adding new downloads.
- Swapping two items in the queue
- Deleting specific(single or multiple) history items.

everything else at http://wiki.sabnzbd.org/api have been implemented, unless i have missed something.
Last edited by tobiasthecommie on March 29th, 2010, 1:06 pm, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: Working CLI interface for 0.5.0 for sabnzbd+

Post by tobiasthecommie »

This is probably going to be the last update for 0.5 of sabnzbd+

Baring API changes there really isn't that much left to do with 0.5

Version 0.5-2 - Changelog
- Updated/Simplified queue view
- Added progress bar to queue view
- Minor changes in Warnings view (added whitespaces to make it slightly prettier)


NOTE: The lines line up and look better in a terminal than on the forum

~ $ sabnzbd_client.py

Free/Total Disk: 11.60 / 270.66 GB                                                                                                        Speed: 4990.67 kb/s                                                                                                        
                                                              Queue: 183.36 / 1503.21 MB [12%]                                                              
# - Filename [Age/Priority/Post Processing] (Status)                                                                              Downloaded/Total (MB) [pct]                                                                              
-------------------------------------------------------------------------------------------------------------------------------------------------------------
0 - download.1 [12h/Normal/Delete] (Downloading)
   [0:02:28] [======================================================>           ] 6218.77 / 6763.98 [91%]


1 - download.12 [12h/Normal/Delete] (Queued)
   [>                                                                                                                                  ] 0.00 / 751.61 [ 0%]
Last edited by tobiasthecommie on April 3rd, 2010, 5:22 am, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: Working CLI interface for 0.5.0 for sabnzbd+

Post by tobiasthecommie »

Version 0.5-3 - Changelog
- Minor bugfixes
- Code cleanup and refactor
- Added warnings. (Client will now warn you if queue size is bigger than free space, or total space, on destination device).
- The layout of the queue screen has been improved.

NOTE: I just updated the file. There was a minor bug in the warnings system. Low space warnings was triggered even when there was enough disk space left.
Last edited by tobiasthecommie on April 4th, 2010, 5:17 pm, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: Working CLI interface for 0.5.0 for sabnzbd+

Post by tobiasthecommie »

I have rereleased this as SABcli on

http://code.google.com/p/sabcli/

Further updates and changelog will happen there.

A 0.5-4 has been released there, and a 0.5-5 with color support is on the roadmap.

Note: If anyone have had problems wtih the dependency on xmltopy(which isn't on my freebsd system), i have removed that dependency as of 0.5-4.

Also, as of 0.5-4 the program is released under GPLv3

This thread will recieve no further updates.
Last edited by tobiasthecommie on April 4th, 2010, 8:17 pm, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
User avatar
thaylok
Newbie
Newbie
Posts: 29
Joined: November 20th, 2008, 11:39 am

Re: Working CLI interface for 0.5.0 for sabnzbd+

Post by thaylok »

thanks! this was actually quite useful :)
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: Working CLI interface for 0.5.0 for sabnzbd+

Post by tobiasthecommie »

thaylok wrote: thanks! this was actually quite useful :)
I'm glad someone finds it useful. :)

And i already released the next version, that is, 0.5-5.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
emilb
Newbie
Newbie
Posts: 13
Joined: May 19th, 2009, 7:33 pm

Re: Working CLI interface for 0.5.0 for sabnzbd+

Post by emilb »

Hi,

it works great, thanks alot!

/Emil
tobiasthecommie
Newbie
Newbie
Posts: 21
Joined: March 14th, 2010, 11:24 am
Contact:

Re: Working CLI interface for 0.5.0 for sabnzbd+

Post by tobiasthecommie »

emilb wrote: Hi,

it works great, thanks alot!

/Emil
Thanks. But i honestly believe the curses version is the superior program. Though the cli version clearly has its uses.(you can pipe it)

The curses version is easier and more intuitive to use.
Last edited by tobiasthecommie on May 18th, 2010, 11:32 am, edited 1 time in total.
Fully featured (as of 0.5.3) CLI and Curses client at:

http://code.google.com/p/sabcli/
Post Reply