Page 1 of 1

Automatically create subfolders for subs and samples

Posted: October 2nd, 2013, 5:18 am
by johnsosius
Hi there,

I was wondering if it would be possible to automatically create sub folders for the subtitles and samples (if available) after downloading a scene release.
I couldn't find it on the board. Anyone can help me with this?

Thanks in advance!


Greetings

Re: Automatically create subfolders for subs and samples

Posted: October 2nd, 2013, 5:47 am
by shypike
You would need your own post processing script for this.
More info: http://wiki.sabnzbd.org/user-scripts

Re: Automatically create subfolders for subs and samples

Posted: October 3rd, 2013, 7:47 am
by johnsosius
Okay thanks for pointing that out - I'll have a look!

Re: Automatically create subfolders for subs and samples

Posted: October 3rd, 2013, 10:10 am
by johnsosius
I saw this topic: http://forums.sabnzbd.org/viewtopic.php ... e&start=15 and that's where I found this script:

Code: Select all

echo off
cd /c "%1"
IF EXIST *sample* (mkdir Sample && move *sample* "Sample") ELSE exit
IF EXIST *subs* (mkdir Subs && move *subs* "Subs") ELSE exit
The script itself is working: when I put the .bat file in the folder I want to test it creates the 2 sub folders I want.
I am on Windows btw and my download directory is C:\Users\X\Documents\Downloads\complete.
However if I let sab run the post-script it returns with an error, this is what the log is showing:

Code: Select all

2013-10-03 17:01:26,148::INFO::[__init__:893] C:\Users\X\Documents\Downloads\incomplete\teevee 720p bad ink\__ADMIN__\SABnzbd_nzf_buc3bt removed
2013-10-03 17:01:26,148::INFO::[__init__:893] C:\Users\X\Documents\Downloads\incomplete\teevee 720p bad ink\__ADMIN__\SABnzbd_nzf_ou9uet removed
2013-10-03 17:01:26,150::INFO::[misc:1295] Cannot remove folder C:\Users\X\Documents\Downloads\incomplete\teevee 720p bad ink\__ADMIN__
2013-10-03 17:01:26,151::INFO::[misc:1295] Cannot remove folder C:\Users\X\Documents\Downloads\incomplete\teevee 720p bad ink\__ADMIN__
2013-10-03 17:01:26,151::INFO::[postproc:84] Saving postproc queue
2013-10-03 17:01:26,151::INFO::[__init__:904] Saving data for postproc1.sab in C:\Users\X\AppData\Local\sabnzbd\admin\postproc1.sab
2013-10-03 17:01:26,151::INFO::[downloader:246] Post-processing finished, resuming download
2013-10-03 17:01:26,210::INFO::[downloader:664] Thread 11@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:26,309::INFO::[downloader:664] Thread 2@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:26,410::INFO::[downloader:664] Thread 10@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:26,509::INFO::[downloader:664] Thread 19@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:26,609::INFO::[downloader:664] Thread 4@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:26,710::INFO::[downloader:664] Thread 6@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:26,809::INFO::[downloader:664] Thread 20@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:26,910::INFO::[downloader:664] Thread 18@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:27,009::INFO::[downloader:664] Thread 17@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:27,109::INFO::[downloader:664] Thread 13@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:27,210::INFO::[downloader:664] Thread 3@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:27,309::INFO::[downloader:664] Thread 16@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:27,410::INFO::[downloader:664] Thread 15@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:27,509::INFO::[downloader:664] Thread 9@ssl-eu.astraweb.com:563: forcing disconnect
2013-10-03 17:01:29,151::INFO::[nzbqueue:211] Saving queue
2013-10-03 17:01:29,201::INFO::[__init__:904] Saving data for queue9.sab in C:\Users\X\AppData\Local\sabnzbd\admin\queue9.sab
2013-10-03 17:01:29,203::INFO::[__init__:904] Saving data for totals9.sab in C:\Users\X\AppData\Local\sabnzbd\admin\totals9.sab
2013-10-03 17:01:29,203::INFO::[__init__:904] Saving data for rss_data.sab in C:\Users\X\AppData\Local\sabnzbd\admin\rss_data.sab
2013-10-03 17:01:29,203::INFO::[__init__:904] Saving data for bookmarks.sab in C:\Users\X\AppData\Local\sabnzbd\admin\bookmarks.sab
2013-10-03 17:01:29,204::INFO::[__init__:904] Saving data for watched_data.sab in C:\Users\X\AppData\Local\sabnzbd\admin\watched_data.sab
2013-10-03 17:01:29,206::INFO::[postproc:84] Saving postproc queue
2013-10-03 17:01:29,206::INFO::[__init__:904] Saving data for postproc1.sab in C:\Users\X\AppData\Local\sabnzbd\admin\postproc1.sab
2013-10-03 17:01:29,207::INFO::[postproc:651] Queue has finished, launching: None (None)
I am a complete noob when it comes to scripts, could anyone point out to me what I might do wrong?
The download it self is 100% complete though, but obviously the sub folders aren't created.

Re: Automatically create subfolders for subs and samples

Posted: October 3rd, 2013, 1:10 pm
by shypike
Doesn't look like the script runs.
Did you set one? Do you see it as one of the job attributes?

Re: Automatically create subfolders for subs and samples

Posted: October 3rd, 2013, 2:44 pm
by johnsosius
Yes I see the script in sabnzbd's menu. Its reporting an post processing error (see log).
The only error I can see in the log however is this:

Code: Select all

2013-10-03 21:41:17,674::INFO::[postproc:490] Traceback: 
Traceback (most recent call last):
  File "sabnzbd\postproc.pyo", line 432, in process_job
  File "sabnzbd\newsunpack.pyo", line 140, in external_processing
  File "sabnzbd\newsunpack.pyo", line 1331, in build_command
error: (5, 'GetShortPathName', 'Access Denied.')
error: (5, 'GetShortPathName', 'Access Denied.') <-- what could be the reason of this error?

Re: Automatically create subfolders for subs and samples

Posted: October 4th, 2013, 1:19 am
by shypike
Check permissions of the file and the folder in which it resides.

Re: Automatically create subfolders for subs and samples

Posted: October 4th, 2013, 3:23 am
by johnsosius
I checked the permissions, every directory is accessible.
This is the message sab gives after completing a download:

Code: Select all

Script
    Exit(1) There is already a sub folder or file Sample. (More) 

Code: Select all

(More)

C:\Program Files (x86)\SABnzbd>echo off 
The syntax of the file name, folder name or volume name is incorrect.
Sub folder or file Sample is already there.

Re: Automatically create subfolders for subs and samples

Posted: October 4th, 2013, 8:44 am
by shypike
So the script runs and what you see is the output of your own script.
The problem is this statement:
IF EXIST *sample* (mkdir Sample && move *sample* "Sample") ELSE exit
File names on Windows are not case-sensitive, so your ALSO trying to move the new folder Sample to the new folder Sample.
The same is true for the next line.

Re: Automatically create subfolders for subs and samples

Posted: October 8th, 2013, 4:58 am
by johnsosius
Could you perhaps tell me how I should change these lines in order to get it working? Or is it just not do-able to have only a couple of - simple - lines of code because its Win?

Re: Automatically create subfolders for subs and samples

Posted: October 14th, 2013, 1:10 pm
by shypike
You'll have to ask this question in the scripts sub-forum.
I've stopped writing other people's scripts.
Nothing personal, but I prefer to spend my time on SABnzbd itself.

Re: Automatically create subfolders for subs and samples

Posted: October 15th, 2013, 3:51 am
by johnsosius
Ok thanks for your input shypike the last couple of weeks! You can close this topic my problem is solved.