sabRE - an alternative multi-user web frontend

Got a program that plays well with SABnzbd? Share it here!
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

Ouch: http://localhost:8080/sabnzbd/ now says:

Code: Select all

Incorrect parameter

Configuration is locked 
... and I can't access SABnzbd anymore. I have to solve that first.

EDIT: 'solved' by removing sabnzbd.ini and creating a new one via the SAB wizard.
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

realgeizt wrote: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).
Yes, complete_dir is in [misc]. See below. Maybe sabRE does not like the relative path? Or the space?

Code: Select all

$ grep -i -n -e '\[' -e complete_dir ~/.sabnzbd/sabnzbd.ini
2:[misc]
101:complete_dir = Downloads/complete
149:[logging]
155:[growl]
162:[nzbmatrix]
166:[newzbin]
173:[nzbxxx]
176:[servers]
177:[[newszilla6.xs4all.nl]]
190:[[newsreader3.eweka.nl]]
203:[categories]
204:[[*]]
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

It's the relative path. Should be fixed with latest push, sabRE now interprets the path relative to /home/user/.sabnzbd/.
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

realgeizt wrote:It's the relative path. Should be fixed with latest push, sabRE now interprets the path relative to /home/user/.sabnzbd/.
Same result:

Code: Select all

sander@flappie:~/git/sabRE$ git pull
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 4 (delta 3), reused 4 (delta 3)
Unpacking objects: 100% (4/4), done.
From https://github.com/realgeizt/sabRE
   cf40871..1d2e60d  master     -> origin/master
Updating cf40871..1d2e60d
Fast-forward
 cs_app/settings.coffee | 3 +++
 1 file changed, 3 insertions(+)
sander@flappie:~/git/sabRE$ ./run.sh 
info: starting up...
--------------------------------------------------------------------------------
-----------------------------   welcome to sabRE   -----------------------------
--------------------------------------------------------------------------------

it seems this is the first start of the application because no configuration
file could be found. also it seems that SABnzbd is configured on this system,
which makes it possible to setup sabRE automatically because most things can be
read from sabnzbd.ini.

do you want to run the configuration wizard now? (Y/n) 

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

it seems some settings could not be read from sabnzbd.ini.
you need to configure them using the wizard.

do you want to run the wizard now to configure other settings? (Y/n) 
I removed the directory sabRE, did a fresh git clone, and got the same result again. >:(

Code: Select all

git clone https://github.com/realgeizt/sabRE.git
cd sabRE/
npm install
chmod +x run.sh 
./run.sh 
Tips?
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Hmm, how does your SABnzbd interpret the relative path? If you use "Downloads/complete", where get your files saved? On my setup, they would get saved to "/home/user/.sabnzbd/Downloads/complete". Also the directory has to exist when importing settings.
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

realgeizt wrote:Hmm, how does your SABnzbd interpret the relative path? If you use "Downloads/complete", where get your files saved? On my setup, they would get saved to "/home/user/.sabnzbd/Downloads/complete". Also the directory has to exist when importing settings.
No, in my case: /home/sander/Downloads/complete/ . In general: ~/Downloads/complete/

That's default SABnzbd behaviour. ~/.sabnzbd/ is only used for meta-info like settings, queue and logging. Not for the downloads themselves.

EDIT:

The SAB GUI says:
Default Base Folder: /home/sander
...
Downloads/complete
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

It makes sense what you say, and I would have thought that it works this way. But why does my SABnzbd not behave this way? In Settings->Folders, SABnzbd states on top of the page: "Default Base Folder: /home/user/.sabnzbd" and I read the only way to change this folder is by running SABnzbd with a special argument on startup, but I did not append any arguments... The behavior of that "Default Base Folder" is a little strange I think. I set it to use a config file by specifying the path "/home/user/.sabnzbd/sabnzbd.ini", the "Base Folder" gets "/home/user/.sabnzbd/". If I don't specify a path, the "Base Folder" is "/home/services/sabnzbd/", which is where SABnzbd is installed, but "services" is not the user SABnzbd is run as... Any idea? I will investigate this further the next days.
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

realgeizt wrote:It makes sense what you say, and I would have thought that it works this way. But why does my SABnzbd not behave this way? In Settings->Folders, SABnzbd states on top of the page: "Default Base Folder: /home/user/.sabnzbd" and I read the only way to change this folder is by running SABnzbd with a special argument on startup, but I did not append any arguments... The behavior of that "Default Base Folder" is a little strange I think. I set it to use a config file by specifying the path "/home/user/.sabnzbd/sabnzbd.ini", the "Base Folder" gets "/home/user/.sabnzbd/". If I don't specify a path, the "Base Folder" is "/home/services/sabnzbd/", which is where SABnzbd is installed, but "services" is not the user SABnzbd is run as... Any idea? I will investigate this further the next days.
The webGUI shows my_home, which is determined by sabnzbd.DIR_HOME, which has an detailed process how it is determined

Code: Select all

sander@haring:~/git/sabnzbd$ grep -ir "sabnzbd.DIR_HOME" *

sabnzbd/misc.py:            path = path.replace('~', os.environ.get('HOME', sabnzbd.DIR_HOME), 1)
sabnzbd/utils/pathbrowser.py:    path = sabnzbd.misc.real_path(sabnzbd.DIR_HOME, path)
sabnzbd/api.py:    header['my_home'] = sabnzbd.DIR_HOME
sabnzbd/interface.py:        conf['my_home'] = sabnzbd.DIR_HOME
SABnzbd.py:        sabnzbd.DIR_HOME = sabnzbd.DIR_PROG
SABnzbd.py:            sabnzbd.DIR_HOME = specials['Personal']
SABnzbd.py:                    sabnzbd.DIR_HOME    = '%s\\Documents' % user
SABnzbd.py:                    sabnzbd.DIR_HOME = root
SABnzbd.py:                    sabnzbd.DIR_HOME = sabnzbd.DIR_HOME.encode(codepage)
SABnzbd.py:                        sabnzbd.DIR_HOME = win32api.GetShortPathName(sabnzbd.DIR_HOME)
SABnzbd.py:            sabnzbd.DIR_HOME = home
SABnzbd.py:            sabnzbd.DIR_HOME = home
SABnzbd.py:        sabnzbd.DIR_HOME = os.path.dirname(inifile)
SABnzbd.py:    sabnzbd.cfg.set_root_folders(sabnzbd.DIR_HOME, sabnzbd.DIR_LCLDATA)

sander@haring:~/git/sabnzbd$
Maybe you can ask via de SAB API what the sabnzbd.DIR_HOME is?

EDIT: looks so:

Code: Select all

$ curl --silent 'http://localhost:11111/api?mode=queue&start=START&limit=LIMIT&output=xml' | grep -i my_home
<my_home>/home/sander</my_home>
Can you use that? You already know the APIkey via the ini
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Very nice, I think using this information I can fix it. If I have to go the way with the API it will be some more work, because I would first have to be sure the user has entered the right IP/Port/API-Key, and then I would be able to get the complete dir. So it would be a setup with two "stages". I will post when it's ready, might take until the weekend.
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

A separate suggestion regarding the postporcessing of sabRE:

I would advice to rename your scripts to "sabre-....py", and let the install copy them into the existing SAB script dir (script_dir). So

sabre-postprocess.py
sabre-settings.py
sabre-unrar.py

IMHO that's more clear and more convenient for the user that also wants to keep his normal SAB GUI.

EDIT: I still don't understand why sabRE needs it's own scripts. Why can't SABnzbd handle it in the regular way, and then sabRE finds what the result is?
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Regarding the issue with the my_home I think it can be solved without doing the API call, which makes it easier for me (looked at SABnzbd.py file). You aren't running SABnzbd in daemon mode I think, so it uses your home directory. I run it in daemon mode, so it uses it's installation path and does not access any user's directory (which makes sense).
The renaming of the script files makes sense, and I can integrate a step into the setup to copy the scripts.
I still don't understand why sabRE needs it's own scripts. Why can't SABnzbd handle it in the regular way, and then sabRE finds what the result is?
The files need to be put into a tar archive for easy downloading. Additionally SABnzbd's extraction of passworded rar files did never work for me, so this can also be done by sabRE. Of course that could by changed by integrating a small file explorer into sabRE and let the user browse the directories that SABnzbd created for each download, but it is not needed for my purposes.
User avatar
sander
Release Testers
Release Testers
Posts: 8829
Joined: January 22nd, 2008, 2:22 pm

Re: sabRE - an alternative web frontend

Post by sander »

realgeizt wrote: The files need to be put into a tar archive for easy downloading.
Ah, do you mean this: the separate files of a download are packed into one tar file, which makes remote downloading via een webinterface easier?

If so: I understand the use case.

I was more thinking in this use case: one LAN with several users and one SABnzbd instance. Each user has a seperate account in sabRE and his/her own directory shared on a NAS. sabRE put the downloads into the respective user directory.
In this use case separate files are OK, and no tarring is needed.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

To get it the way you suggest, one has to use categories (you suggested that on the first page of this thread I think) or one would have to modify the postprocessing script so that it would create the users dir, but the first option makes more sense I think. Then sabRE needs to set the category when it enqueues the NZB. This should be easy. To get the "history" on the bottom working with directories, some minimal changes need to be done to sabRE - at the moment it only shows entries in the history when it finds an existing tar file with the same name. This needs to be changed, so it watches for existence of the directory. When no downloads over the interface are required and one uses a network share to provide access to the files it makes the whole thing easier.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

Ah, do you mean this: the separate files of a download are packed into one tar file, which makes remote downloading via een webinterface easier?
Exactly. It does not run on a local LAN for me and is only reachable using HTTP, so I needed an easy way to let users download files.

I implemented your use case, it will be pushed at the weekend together with the changes to the configuration wizard I think.
realgeizt
Newbie
Newbie
Posts: 30
Joined: June 8th, 2014, 8:03 am

Re: sabRE - an alternative web frontend

Post by realgeizt »

I just pushed a new version, I think everything you suggested is included. By setting the value of "noPostProcess" you can control if sabRE will create tar files or use categories for each user to download files (so you can setup shares for each user pointing to that directory).
Post Reply