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

Re: sabRE - an alternative web frontend

Post by realgeizt »

;D I can understand this.
If you have other scripts, just copy the sabRE scripts to your usual folder and change settings.py. This way your other scripts should still work while downloads from sabRE will be postprocessed.

Edit: And don't forget to adjust settings.py - when it's not run from inside the sabRE directory (because copied to another postprocessing folder), the pathes need to be adjusted.

Edit 2: It's really nice you take the time to get this running!

Edit 3: If postprocessing does not work, try chmod +x postprocess.py - in my tests it worked when it was not executable, but the SABnzbd wiki states that is needs to be executable.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Regarding your edit:
INSERT_YOUR_SABNZBD_API_KEY_HERE
is in the output of your first quote. Did you adjust settings.coffee? Please really do everything as I wrote on the github page. Every step mentioned there is required to get this running. As you said, the tar file exists - is the folder where to look for tar files right in settings.coffee (downloadDir)? If you don't clear the history of SABnzbd and the tar file exists, incorrect configuration of settings.coffee is the only thing that comes to my mind that could prevent sabRE from displaying download links.
Also keep in mind, when editing a .coffee file, you need to compile it to JavaScript (using run.sh). If you don't use run.sh, then edit the settings in the JavaScript file (settings.js) directly.
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, that's clear, but I don't know which parameters I should change in cs_settings/settings.coffee ... they all look like sabRE parameters and not SABnzbd parameters to me ...

FYI: I've disabled the API-key in SABnzbd, so no API-key is need in cs_settings/settings.coffee I would say.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

I never tested withoud an API-Key, but it might work without. I don't know. If it would not work, sabRE could not even deliver you an overview with the queue/failed titles I think, so it seems to work...

The parameter in settings.coffee you seem to have missed is "downloadDir", does it match with SABnzbds download dir? These have to match exactly and there are no categories allowed (because that would resuld in sub directories).

I'm in night-mode now, will be back tomorrow!
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Downloads per user are integrated now. Just set "hideOtherUsersData" in settings to "true" and everything not enqueued by the currently logged in user is hidden :)
Two things are missing: There is no security check when downloading a file, so when the URL is known, user1 can download files from user2. Also, if two users enqueue the same NZB, it will only be visible by the user who enqueued it first. I might look at these possible problems in some days.
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:I never tested withoud an API-Key, but it might work without. I don't know. If it would not work, sabRE could not even deliver you an overview with the queue/failed titles I think, so it seems to work...

The parameter in settings.coffee you seem to have missed is "downloadDir", does it match with SABnzbds download dir? These have to match exactly and there are no categories allowed (because that would resuld in sub directories).

I'm in night-mode now, will be back tomorrow!
Please define "SABnzbds download dir?" As defined by SAB's download_dir or complete_dir. FWIW: the *rar by sabRE arrived in the complete_dir ...

Code: Select all

sander@flappie:~/git/sabRE$ cat ~/.sabnzbd/sabnzbd.ini | grep -i -e download_dir -e complete_dir
download_dir = Downloads/incomplete
complete_dir = Downloads/complete

sander@flappie:~/git/sabRE$ grep -ir downloadDir cs_settings/settings.coffee
  downloadDir: '/tmp/sabnzbd/done/'

sander@flappie:~/git/sabRE$ ll ~/Downloads/complete/*.tar
-rw-rw-rw- 1 sander sander 284334080 jun  9 16:13 /home/sander/Downloads/complete/x64gujd635-es321f-hyu56e13.1.tar
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 »

EDIT: ignore the info below ... that was a NZB with an ugly unit time format.


IGNORE BELOW

Trying to add a NZB results in sabRE saying "could not send data"

sabRE's stdout says:

info: user "user1" logged in
info: user "user1" queued "unixtime-2038---date-2222222222.time"

sabnzbd.log says:

Code: Select all

2014-06-11 00:21:50,200::DEBUG::[interface:421] API-call from 127.0.0.1 [??] {'nzbname': 'unixtime-2038---date-2222222222.time', 'pp': '3', 'apikey': 'INSERT_YOUR_SABNZBD_API_KEY_HERE', 'name': '/tmp/unixtime-2038---date-2222222222.time', 'script': 'postprocess.py', 'mode': 'addlocalfile'}

2014-06-11 00:21:50,200::INFO::[_cplogging:55] [11/Jun/2014:00:21:50] HTTP 
Request Headers:
  HOST: 127.0.0.1:8080
  CONNECTION: keep-alive
  Remote-Addr: 127.0.0.1
2014-06-11 00:21:50,225::DEBUG::[_cplogging:55] [11/Jun/2014:00:21:50] HTTP Traceback (most recent call last):
  File "/usr/share/sabnzbdplus/cherrypy/_cprequest.py", line 618, in respond
    cherrypy.response.body = self.handler()
  File "/usr/share/sabnzbdplus/cherrypy/_cpdispatch.py", line 25, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/share/sabnzbdplus/sabnzbd/interface.py", line 425, in api
    return api_handler(kwargs)
  File "/usr/share/sabnzbdplus/sabnzbd/api.py", line 101, in api_handler
    response = _api_table.get(mode, _api_undefined)(name, output, kwargs)
  File "/usr/share/sabnzbdplus/sabnzbd/api.py", line 377, in _api_addlocalfile
    return report(output, keyword='', data={'status':res[0]==0, 'nzo_ids' : res[1]}, compat=True)
UnboundLocalError: local variable 'res' referenced before assignment
Happens both with
hideOtherUsersData: true
and
hideOtherUsersData: false
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Hi!
Please define "SABnzbds download dir?"
It's the complete_dir. I have some ideas on how to make configuration easier and I will improve documentation a bit.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

I just published a new version.

What has changed?
  • The installation manual at https://github.com/realgeizt/sabRE has been improved
  • You do not need to edit a text file manually to setup sabRE anymore, configuration is now done by a CLI wizard which can also import some settings from your sabnzbd.ini
  • sabRE does not need Apache anymore
  • Bugfixes
If anybody has questions just ask :)
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 removed ~/git/sabRE and ~/tmp, and did a complete fresh install. Result:

Code: Select all

sander@flappie:~/git/sabRE$ ./run.sh
info: starting up...
Error: In cs_app/app.coffee, Parse error on line 145: 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$
Same error as before, but now in a different line?
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Pushed a new version. I did not test it but it was the same mistake as before, so I think it could work now with older CoffeeScript versions.
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 this:

Code: Select all

reading from /home/sander/.sabnzbd/sabnzbd.ini...
  set "sabPort" to "8080"
  set "sabApiKey" to "05b28c7cec4ec6f867627222ce45dd0f"

it seems some settings could not be read from sabnzbd.ini.
you need to configure them using the wizard.
Why can sabRE read some information, but not all? ???

I had to configure "/home/sander/Downloads/complete" by hand. And probably I did something wrong: I do get the sabRE interface, but "add NZB" leads to "could not send data".


Code: Select all

do you want to run the wizard now to configure other settings? (Y/n) 

please configure "useCurl" with current value "false".
description: "check urls with curl before enqueueing to SABnzbd?"
new value (or enter to use current): 

please configure "hideOtherUsersData" with current value "false".
description: "when enabled, users can only see stuff they enqueued. files from 
              other users are hidden."
new value (or enter to use current): true

please configure "nzbUploadDir" with current value "/tmp/".
description: "directory where uploaded .nzb files will be stored. files will be 
              deleted after they have been enqueued."
new value (or enter to use current): 

please configure "downloadDir".
description: "must have same value as "Completed Download Folder" in SABnzbd's 
              configuration."
value: /home/sander/Downloads/complete

please configure "sabHost" with current value "127.0.0.1".
description: "host/ip where SABnzbd is running on."
new value (or enter to use current): 

please configure "remoteAuthEnabled" with current value "false".
description: "make use of user authentication using a remote url?"
new value (or enter to use current): false

please configure "remoteAuthHost" with current value "127.0.0.1".
description: "host where remote authentication is running."
new value (or enter to use current): 

please configure "remoteAuthPort" with current value "80".
description: "port where remote authentication is listening on."
new value (or enter to use current): 8080

please configure "remoteAuthPath" with current value "/remoteauth/".
description: "path for the url to the remote authentication."
new value (or enter to use current): 

setup complete. run sabRE again to start it up, then login with a user defined
defined in users.json.
sander@flappie:~/git/sabRE$ ./run.sh
info: starting up...
info: server listening on port 3000
info: user "user1" logged in
info: user "user1" queued "Modern American Music.nzb"
Tips? Did I do something wrong with the remote* stuff?
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 »

Oh, wait: I tried another .NZB, and I got that into the queue.

However, no result in the output "Finished downloads"?
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 »

Ah, I get "Could not send data" if there is a space in the NZB filename, so "blabla morebla.nzb". That looks like a bug.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Just pushed an update, that bug is fixed. I always tested by enqueueing URLs...

The problem you have when importing from SABnzbd is strange, it works here. sabRE parses the ini file and searches for the key "complete_dir" in the section "misc". Does your ini file have this line? If you want to play around with the settings import just look into settings.coffee, on the top of the file is the definition what settings will be imported from what key in the ini file (no coding required).
Post Reply