Special PP script for videos? (probably VERY easy!)

Come up with a useful post-processing script? Share it here!
Post Reply
JohnEric
Release Testers
Release Testers
Posts: 16
Joined: June 1st, 2010, 8:19 pm

Special PP script for videos? (probably VERY easy!)

Post by JohnEric »

Hi all,
First off... god.. SABNzbd.. what a GODSEND!  I still remember my paring/unraring days manually. :D

Anyways, I am looking to see if anyone can help write a PP script for SAB (latest beta)
This is what I want to do:

0) IF file is a single file (e.g. video) then USE the post-processing script
1) Delete .nfo file
2) Move video/file from D:\Incoming to D:\Videos
3) Delete folder created by SABnzbd from D:\Incoming

Is this possible?
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: Special PP script for videos? (probably VERY easy!)

Post by rascalli »

Why not use the categories ???
JohnEric
Release Testers
Release Testers
Posts: 16
Joined: June 1st, 2010, 8:19 pm

Re: Special PP script for videos? (probably VERY easy!)

Post by JohnEric »

Why not use the categories
Could you clarify please?  I don't understand :(
JohnEric
Release Testers
Release Testers
Posts: 16
Joined: June 1st, 2010, 8:19 pm

Re: Special PP script for videos? (probably VERY easy!)

Post by JohnEric »

rasc,

I looked up what you meant. That's a great idea! I'm sorry for the noobish-ness. I'm relatively new to SAB.

At any rate, I am still looking for post processing scripts that do the above, if anyone can help. :(
JohnEric
Release Testers
Release Testers
Posts: 16
Joined: June 1st, 2010, 8:19 pm

Re: Special PP script for videos? (probably VERY easy!)

Post by JohnEric »

Shameless bump. I tried to do this myself. rofl. So fail :(

First, I tried plug and playing some other people's codes but it didn't work.
Second, what do I NAME the file (what extension?)
Third, help! :(
minimeh
Newbie
Newbie
Posts: 34
Joined: March 26th, 2010, 12:42 pm

Re: Special PP script for videos? (probably VERY easy!)

Post by minimeh »

stisev wrote: This is what I want to do:

0) IF file is a single file (e.g. video) then USE the post-processing script
1) Delete .nfo file
2) Move video/file from D:\Incoming to D:\Videos
3) Delete folder created by SABnzbd from D:\Incoming
As suggested, use categories. This is very much what they do.

When an nzb is loaded by sabnzbd, set it to an appropriate category. In the scenario cited, a category of "Videos" could be used, or more popularly more granular categories such as "Movies", "TV", "Anime", etc.

In the category configuration page, set the destination for files of this category to where you want, e.g. D:\Videos for the generic "Videos" category. Now your "Videos" will end up in D:Videos and Bob's your uncle.

There is an option in sabnzbd to remove unwanted files of a type. Include ".nfo" there. If you still need some post processing, to say delete the occasional stray .nfo or .1 or .2 file, you can create a shell script (DOS batch file on Windows), python code, a binary executable or pretty much anything else that can be executed on your computer and put it into your designated sabnzbd scripts folder. Then for your "Videos" category, just set the default post processing action to your "script". It will appear in the drop down list.

That's about it. Pretty straight forward, really.  :)
JohnEric
Release Testers
Release Testers
Posts: 16
Joined: June 1st, 2010, 8:19 pm

Re: Special PP script for videos? (probably VERY easy!)

Post by JohnEric »

Hi mini,
Thanks for the response.
There is an option in sabnzbd to remove unwanted files of a type. Include ".nfo" there. If you still need some post processing, to say delete the occasional stray .nfo or .1 or .2 file, you can create a shell script (DOS batch file on Windows), python code, a binary executable or pretty much anything else that can be executed on your computer and put it into your designated sabnzbd scripts folder. Then for your "Videos" category, just set the default post processing action to your "script". It will appear in the drop down list.

That's about it. Pretty straight forward, really.  Smiley
I setup categories to move Anime to my Anime folder. Thanks, but there are a few other things that (I believe) requires post-processing script.


So far, I have found no way of preventing SAB from creating folder of the NZB file name.  For example, I download onepiece.nzb.  Then, I load into SAB and it places it in a folder called onepiece.  I hate that! I have to manually clean up the folders afterwards. It's not a lot of work, but it's an extra step! :(

Questions:
1) Is there ANY way to prevent SAB from making folders of the NZB downloads?
2) I don't want to remove .NFO files from some downloads -- JUST anime.  Is this possible and could you point to the solution (I am not a programmer :( )
minimeh
Newbie
Newbie
Posts: 34
Joined: March 26th, 2010, 12:42 pm

Re: Special PP script for videos? (probably VERY easy!)

Post by minimeh »

stisev wrote: 1) Is there ANY way to prevent SAB from making folders of the NZB downloads?
2) I don't want to remove .NFO files from some downloads -- JUST anime.  Is this possible and could you point to the solution (I am not a programmer :( )
1) Not something I'd ever do so don't know. Suspect not.
2) Here is a naive (read: raw, untested, and undoubtedly flawed) batch file that you could try as the basis for your Anime category script:

Code: Select all

@echo off
for %%i in ("%1\*.avi" "%1\*.mkv" "%1\*.wmf") do move "%%i" "%1\.."
for %%i in ("%1\*.nfo" "%1\*.1" "%1\*.2") do del "%%i"
rmdir "%1"
This is expecting the complete destination directory in parameter 1 (%1), which Sabnzbd does when it calls the user script.

The script searches for some typical media files in the destination folder. You can add or subtract file types as necessary. Note the quotes around the path names to ensure that a path with spaces will work. For each file of the type specified, it will be moved to the parent of the destination folder, e.g. "D:\Anime\onepiece\onepiece.avi" will be moved to "D:\Anime\onepiece.avi".

Then, after any media files are moved, unwanted files are deleted. Again, add and subtract file types as required.

Finally, the nzb directory is removed. Note that this has an inherent safety mechanism. If there is still a file in the nzb directory, it would be something that was unexpected. The attempt to remove the directory will fail because it is not empty. You can examine the directory and determine if the leftover file is something you want or something else to add to the list of file types to be automatically moved or removed.

On the other hand, if you just want to nuke with prejudice the nzb folder, then this modification will be of interest:

Code: Select all

@echo off
for %%i in ("%1\*.avi" "%1\*.mkv" "%1\*.wmf") do move "%%i" "%1\.."
rmdir /s /q "%1"
I'd be real hesitant to do this, though. If you attempt to move a media file and that fails, then you would end up nuking your media file.

Anyway, something to get you started. Have fun!
JohnEric
Release Testers
Release Testers
Posts: 16
Joined: June 1st, 2010, 8:19 pm

Re: Special PP script for videos? (probably VERY easy!)

Post by JohnEric »

I will try this now
JohnEric
Release Testers
Release Testers
Posts: 16
Joined: June 1st, 2010, 8:19 pm

Re: Special PP script for videos? (probably VERY easy!)

Post by JohnEric »

i saved it as TEST.bat

it did not do the intended thing.  All it did was move the NFO + ANIME + folder to D:\videos.
:(
Post Reply