sabRE - an alternative multi-user web frontend

Got a program that plays well with SABnzbd? Share it here!
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

sabRE - an alternative multi-user web frontend

Post by realgeizt »

Hi!

We built a web application to remote control SABnzbd. It is made for situations where one wants to give access to some other people to an instance of SABnzb but with limited rights - users can only enqueue NZBs, view SABnzb's status and download files downloaded by SABnzbd.
sabRE and a small guide on how to get it running (it's easy, everything was tested with Ubuntu) is located at https://github.com/realgeizt/sabRE.

Here is a screenshot:
Image

If you have any questions just ask, I would be happy if anybody has a use for it :) ...
Last edited by realgeizt on September 12th, 2014, 6:06 pm, edited 1 time in total.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

I get "Error: In cs_app/sabnzbd.coffee, Parse error on line 96: Unexpected 'INDENT'"

Code: Select all

sudo apt-get install coffeescript
sudo apt-get install npm

git clone https://github.com/realgeizt/sabRE.git
cd sabRE/

npm install

chmod +x run.sh 
./run.sh 


sander@flappie:~/git/sabRE$ ./run.sh 
info: starting up...
Error: In cs_app/sabnzbd.coffee, Parse error on line 96: Unexpected 'INDENT'
    at Object.parseError (/usr/lib/coffee-script/lib/coffee-script/parser.js:477:11)
    at Object.parse (/usr/lib/coffee-script/lib/coffee-script/parser.js:554:22)
    at Object.exports.compile.compile (/usr/lib/coffee-script/lib/coffee-script/coffee-script.js:47:20)
    at compileScript (/usr/lib/coffee-script/lib/coffee-script/command.js:182:33)
    at /usr/lib/coffee-script/lib/coffee-script/command.js:152:18
    at fs.js:268:14
    at Object.oncomplete (fs.js:107:15)
error: error compiling file, exiting...
sander@flappie:~/git/sabRE$ 
I did NOT edit cs_settings/settings.coffee.

Tips?
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Hi sander,

I don't know what is wrong but using your commands I can reproduce the error. At the first look, the file looks right...
When removing coffeescript and npm via apt-get and installing node.js from source afterwards it suddenly works. I will take a closer look at this issue soon.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

FWIW:

$ nodejs --version
v0.10.25

$ coffee --version
CoffeeScript version 1.4.0
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

I pushed a fix, it should work now.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

In the meantime I had tried this:

Code: Select all

sudo npm install -g coffee-script
./run.sh 
node
sudo apt-get install node
./run.sh 

sander@flappie:~/git/sabRE$ ./run.sh 
info: starting up...
error: error compiling file, exiting...
sander@flappie:~/git/sabRE$

sander@flappie:~/git/sabRE$ coffee --version
CoffeeScript version 1.4.0
And:

Code: Select all

sander@flappie:~/git/sabRE$ git pull
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 7 (delta 5), reused 4 (delta 3)
Unpacking objects: 100% (7/7), done.
From https://github.com/realgeizt/sabRE
   ed99025..4993c8a  master     -> origin/master
Updating ed99025..4993c8a
Fast-forward
 README.md             | 2 +-
 cs_app/sabnzbd.coffee | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
sander@flappie:~/git/sabRE$ ./run.sh 
info: starting up...
error: error compiling file, exiting...
sander@flappie:~/git/sabRE$ 

So I've made it worse?
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

OK, removed node and coffeescript, and now:

Code: Select all

sander@flappie:~/git/sabRE$ ./run.sh 
info: starting up...

module.js:340
    throw err;
          ^
Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/sander/git/sabRE/app/app.js:6:11)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
error: failed to start node
error: error starting node, exiting...
sander@flappie:~/git/sabRE$ 
After

Code: Select all

sudo npm install express
sudo npm install underscore
sudo npm install winston
sudo npm install body-parser
sudo npm install cookie-parser
sudo npm install method-override
sudo npm install jade
I have a nice screen on http://localhost:3000/ and I can login with user1/pass1, which then nicely shows SABnzbd info.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

OK, now the non-technical remarks:

"Finished downloads" only shows failed downloads. Is that how it is meant?

I hoped that user1 would only see his own downloads, but that seems not the case: user1 sees all downloads: generic SAB, and also user2's. Is that how it is meant? EDIT 2: *if* you want this functionality, I think you can achieve it by defining *category* user1 which downloads into subdirectory user1/ ...

EDIT: technical remark:

Chrome offers to translate the page for me ... ? Probably because of "<html lang="de-de" ng-app="webapp">" in the source of the page.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Hi!

Nice everything is working now.

Code: Select all

sudo npm install express
sudo npm install underscore
sudo npm install winston
sudo npm install body-parser
sudo npm install cookie-parser
sudo npm install method-override
sudo npm install jade
Usually the "npm install" mentioned in my start guide should install all these dependencies. But it does not matter now I think :)
"Finished downloads" only shows failed downloads. Is that how it is meant?
No, there should be links to downloads. Look at SABnzbd's history, there should be the output of the postprocessing ("postprocessor.py" delivered with sabRE). Usually it should work like this:
  • User enqueues URL with sabRE. When sending it to SABnzbd it tells it to use the script "postprocessor.py".
  • When download is finished, the postprocessor will run, and in the end it should build a .tar archive.
  • sabRE sees there is a .tar file that has the same name as an entry in SABnzbd's history, so it displays a download link.
Usually the output of the postprocessor gives more information about what went wrong.
I hoped that user1 would only see his own downloads, but that seems not the case: user1 sees all downloads: generic SAB, and also user2's. Is that how it is meant?
Yes, it is ment this way. For my scenario everybody should see anything, but this could easily be changed with some modifications.
Chrome offers to translate the page for me ... ? Probably because of "<html lang="de-de" ng-app="webapp">" in the source of the page.
Does removing lang="de-de" help? But I don't know Chrome and cannot say when it offers translation and when it does not.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

The result of "grep -i postprocessor.py ~/.sabnzbd/logs/sabnzbd.log" is empty. FYI: I did not set up anything special. Please advise what to do.

I changed to '<html lang="en-US">' in views/base.jade, but Chrome was not offering to translate anymore, probably because I ignored it yesterday.

A upload and history page & download directory per user would be very useful
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

I failed. It's not postprocessor.py, it's postprocess.py. Do you find something with this? I tried your grep line here and it gives many results.
I changed to '<html lang="en-US">' in views/base.jade, but Chrome was not offering to translate anymore, probably because I ignored it yesterday.
I might try it myself soon.
A upload and history page & download directory per user would be very useful
If you or somebody else say they would use sabRE with this functionality included I might integrate it, but I just stepped down from another project because I need more time for other things in life - it's just that I don't want to invest time for nothing. In the end, it is hosted on github so that other people might pick up improving if there is a need for such a tool - the source code is really easy to understand and it is not much code. Also it is a great project to learn more about node.js/CoffeeScript/Angular.js... :D
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

"grep -i postprocess.py ~/.sabnzbd/logs/sabnzbd.log" is empty too.

There is a lot of "Starting postprocessor", but that was already before I started sabRE

There has been demand in the past for a multiuser-SAB, or a multiuser frontend for SAB.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

Remark:

After "run.sh" and stopping it via CTRL-C, my prompt / shell does not show keyboard input anymore :-(
A "stty sane" is needed to repair it.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

"grep -i postprocess.py ~/.sabnzbd/logs/sabnzbd.log" is empty too.
Okay, that is interesting. Did you point your SABnzbd postprocessing folder to the sabRE folder "sabnzbd/scripts/"? If SABnzbd cannot find postprocess.py, it will do nothing, and there will be no tar file for sabRE. If you use other postprocessing scripts, copy everything from "sabnzbd/scripts/" to your usual script folder (but don't forget to adjust the paths in settings.py).
There has been demand in the past for a multiuser-SAB, or a multiuser frontend for SAB.
Okay, I will look at this :)
After "run.sh" and stopping it via CTRL-C, my prompt / shell does not show keyboard input anymore :-(
A "stty sane" is needed to repair it.
Yeah, that run.sh is hacked together, and I am by far no bash professional. It is mainly needed for automatic recompilation of .coffee to .js and restarting node afterwards, you can run sabRE using "node app/app.js", too - with less problems I think.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

realgeizt wrote:
"grep -i postprocess.py ~/.sabnzbd/logs/sabnzbd.log" is empty too.
Okay, that is interesting. Did you point your SABnzbd postprocessing folder to the sabRE folder "sabnzbd/scripts/"? If SABnzbd cannot find postprocess.py, it will do nothing, and there will be no tar file for sabRE. If you use other postprocessing scripts, copy everything from "sabnzbd/scripts/" to your usual script folder (but don't forget to adjust the paths in settings.py).
No, I did not change the SAB script folder. I'm a bit reluctant to do that right now ... OK, I'll do it for now ... result:

Code: Select all

2014-06-09 16:12:33,183::DEBUG::[interface:421] API-call from 127.0.0.1 [??] {'nzbname': 'x64gujd635-es321f-hyu56e13', 'pp': '3', 'apikey': 'INSERT_YOUR_SABNZBD_API_KEY_HERE', 'name': '/tmp/x64gujd635-es321f-hyu56e13.nzb', 'script': 'postprocess.py', 'mode': 'addlocalfile'}
2014-06-09 16:13:40,425::INFO::[postproc:283] Starting PostProcessing on x64gujd635-es321f-hyu56e13 => Repair:True, Unpack:True, Delete:True, Script:postprocess.py, Cat:*
2014-06-09 16:13:45,896::INFO::[newsunpack:147] Running external script /home/sander/git/sabRE/sabnzbd/scripts/postprocess.py(/home/sander/Downloads/complete/x64gujd635-es321f-hyu56e13.1, x64gujd635-es321f-hyu56e13.nzb, x64gujd635-es321f-hyu56e13, , *, alt.binaries.misc, 0, )
sander@flappie:~$ 
... but still nothing in the sabRE history (only the failed downloads from SAB itself)

EDIT:

The sab logging says:

Code: Select all

           x64gujd635-es321f-hyu56e13.1/
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13.nzb
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/QoQ-sbusLN.DivX.31E10S.eniN-eniN.nylkoorB.avi
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/QoQ-NEWSFLASH.txt
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/Place 2 Home/
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/Place 2 Home/Place2Home.Net.jpg
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/Place 2 Home/Place2Home.Net.url
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/T.gif
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/ultimate-torrents.cc.URL
x64gujd635-es321f-hyu56e13.1/x64gujd635-es321f-hyu56e13/P.png
x64gujd635-es321f-hyu56e13.1/mmonrobryw.jpg
processing "x64gujd635-es321f-hyu56e13.1" in directory "/home/sander/Downloads/complete/"
getting files...
  no files found
FYI: this is a correct NZB; downloading via SABnzbd itself works.

Result in Downloads/complete:

Code: Select all

-rw-rw-rw-  1 sander sander 284334080 jun  9 16:13 x64gujd635-es321f-hyu56e13.1.tar
... strange.
Post Reply