Welcome to Media Center Master!
A powerful solution for mastering your digital media library.
Supporting Emby, Kodi/XBMC/OSMC, Plex, Windows Media Center, and more!

Home Download Gallery Wiki Issue Tracker Licensing Forums

   FAQ  •  Search •  Login •  Register     
It is currently December 13th, 2017, 7:08 am

All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: SabNZBd post-processing script for separating downloads
PostPosted: May 27th, 2013, 6:52 pm 
Offline
Developer/Owner
User avatar

Joined: May 1st, 2009, 10:12 am
Posts: 11315
Location: Meridian, ID, USA
If you use Media Center Master with SabNZBd, you may find this little script handy. It simply tries to determine if a download has video in it and if so, it'll move the download to a folder that Media Center Master can process -- otherwise it will move it elsewhere:

Code:
@ECHO OFF
REM **
REM ** If SabNZBd says the processing completed successfully...
REM **
IF %7 == 0 (
   CD /D %1
   IF EXIST *.mkv (
      REM **
      REM ** ... and this folder has an MKV video, then we must have downloaded a movie or TV episode ...
      REM **
      CD \
      ECHO This is a *VIDEO* and is being moved accordingly...
      MOVE %1 D:\Downloads\Auto-scan
      EXIT 0
   )
   
   IF EXIST *.mp4 (
      REM **
      REM ** ... or this folder has an MP4 video, then we must have downloaded a movie or TV episode ...
      REM **
      CD \
      ECHO This is a *VIDEO* and is being moved accordingly...
      MOVE %1 D:\Downloads\Auto-scan
      EXIT 0
   )
   
   IF EXIST *.avi (
      REM **
      REM ** ... or this folder has an AVI video, then we must have downloaded a movie or TV episode ...
      REM **
      CD \
      ECHO This is a *VIDEO* and is being moved accordingly...
      MOVE %1 D:\Downloads\Auto-scan
      EXIT 0
   )

   IF EXIST *.ts (
      REM **
      REM ** ... or this folder has a ts video, then we must have downloaded a movie or TV episode ...
      REM **
      CD \
      ECHO This is a *VIDEO* and is being moved accordingly...
      MOVE %1 D:\Downloads\Auto-scan
      EXIT 0
   )
   
   IF EXIST *.wmv (
      REM **
      REM ** ... or this folder has a wmv video, then we must have downloaded a movie or TV episode ...
      REM **
      CD \
      ECHO This is a *VIDEO* and is being moved accordingly...
      MOVE %1 D:\Downloads\Auto-scan
      EXIT 0
   )
   
   
   REM **
   REM ** ... otherwise ...
   REM **
   CD \
   ECHO This is a miscellaneous download and is being moved accordingly...
   MOVE %1 D:\Downloads\Other
   EXIT 0
)

REM **
REM ** Tell SabNZBd that all is well with our script.
REM **
EXIT 0


Note that I use "D:\Downloads\Auto-Scan" for completed downloads that Media Center Master should parse and "D:\Downloads\Other" for everything else. You'll want to modify the script accordingly. For reference, I have SabNZBd's completed downloads in "D:\Downloads\Completed".

_________________
Peter Souza IV
stable version 2.16.11117.1299 / April 21st, 2017
Media Center Master on Facebook!


 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: September 30th, 2013, 4:22 am 
Offline
Xvid Movie

Joined: September 20th, 2013, 1:18 pm
Posts: 33
Very nice script! I had it up and running nicely with SABnzbd up until a couple days ago. I am running a development build of 0.8.x and for some reason when it passes the folder name to the script it prefixes it with \\?\ (\\?\D:\Downloads\... instead of D:\Downloads\...) which of course throws a UNC error. I realize this is a bug/WIP issue with SABnzbd since I am running the development version, but I was hoping you could help me with a work around until this is fixed. Thank you!


 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: September 30th, 2013, 12:35 pm 
Offline
Developer/Owner
User avatar

Joined: May 1st, 2009, 10:12 am
Posts: 11315
Location: Meridian, ID, USA
Sure -- don't use a dev build of SabNZBd. ;)

No, but seriously -- is there something in the dev builds you need? Clearly they're breaking essential functionality.

_________________
Peter Souza IV
stable version 2.16.11117.1299 / April 21st, 2017
Media Center Master on Facebook!


 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: October 1st, 2013, 6:42 pm 
Offline
Xvid Movie

Joined: September 20th, 2013, 1:18 pm
Posts: 33
I hear you about running development software... I just can't help but play with things, even when they are working as intended. :)

Nothing that I absolutely needed. I was getting a lot of downloads that needed repairs, and it was a lengthy process that was backing up my queue (completed downloads waiting for post-processing). The development version has some really nice features that dramatically improve the repair process as well as more features/options to manage your queue that I really like. I was thinking maybe something like a regex to strip the \\?\ from the variable before continuing, but I don't know how to implement something like that. Currently that is the only problem I have run into in 0.8.x.


 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: October 9th, 2013, 7:44 am 
Offline
Xvid Movie

Joined: September 20th, 2013, 1:18 pm
Posts: 33
I thought I would report back since I was able to get this working correctly again. Apparently the \\?\ is a built-in Windows function that allows commands to override the long filenames limitation. However, it isn't universally implemented throughout Windows, so CMD see's it as a network address and refuses to continue. So first I had to disable UNC checking with this registry entry:

Under the registry path:
HKEY_CURRENT_USER
\Software
\Microsoft
\Command Processor

add the value DisableUNCCheck REG_DWORD and set the value to 0 x 1 (Hex).

The next obstacle was correcting some commands in the script to work with the new variables. It seems that CMD can utilize \\?\ for everything except changing directories (wierd). You can create a directory using md \\?\d:\new and it works just fine. You can also copy, move, etc. You just can't change directories. To overcome this I removed the "CD /D %1" from line 6, and changed all the IF statements to read "IF EXIST %1\*.ext". And SUCCESS! After that I was able to resume normal usage of the script. :)


 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: December 11th, 2013, 3:23 am 
Offline
Flash Video

Joined: November 4th, 2013, 9:09 pm
Posts: 15
I'm looking to get some help with the above script.


I have Sickbeard working well with SAB, and once a download is completed it runs SabToSickbeard.exe

When there is a movie completed in SAB, I would like to run a post processing script that moves the file to sab\downloads\complete\auto-scan folder (similar to above).

I am an absolute beginner with Scripts but it looks what you have above would work for my purposes. What I want to know is, how do I create the script above to work with SAB? Do I need to create an .exe like with SabToSickbeard? I tried creating a text file, but that does not seem to register as a usable script in SAB.

I know this is real beiginner stuff, but i nearly have everything running perfectly, and would like this last piece of the puzzle to be sorted.

Thanks


 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: January 11th, 2014, 3:35 pm 
Offline
Flash Video

Joined: September 19th, 2010, 9:48 am
Posts: 20
Pete -I am having problems using your script with SABnzdb (see attachment)

I am using the following script. Any ideas?

@ECHO OFF
REM **
REM ** If SabNZBd says the processing completed successfully...
REM **
IF %7 == 0 (
CD /D %1
IF EXIST *.mkv (
REM **
REM ** ... and this folder has an MKV video, then we must have downloaded a movie or TV episode ...
REM **
CD \
ECHO This is a *VIDEO* and is being moved accordingly...
MOVE %1 E:\Recorded TV
EXIT 0
)

IF EXIST *.mp4 (
REM **
REM ** ... or this folder has an MP4 video, then we must have downloaded a movie or TV episode ...
REM **
CD \
ECHO This is a *VIDEO* and is being moved accordingly...
MOVE %1 E:\Recorded TV
EXIT 0
)

IF EXIST *.avi (
REM **
REM ** ... or this folder has an AVI video, then we must have downloaded a movie or TV episode ...
REM **
CD \
ECHO This is a *VIDEO* and is being moved accordingly...
MOVE %1 E:\Recorded TV
EXIT 0
)

IF EXIST *.ts (
REM **
REM ** ... or this folder has a ts video, then we must have downloaded a movie or TV episode ...
REM **
CD \
ECHO This is a *VIDEO* and is being moved accordingly...
MOVE %1 E:\Recorded TV
EXIT 0
)

IF EXIST *.wmv (
REM **
REM ** ... or this folder has a wmv video, then we must have downloaded a movie or TV episode ...
REM **
CD \
ECHO This is a *VIDEO* and is being moved accordingly...
MOVE %1 E:\Recorded TV
EXIT 0
)


REM **
REM ** ... otherwise ...
REM **
CD \
ECHO This is a miscellaneous download and is being moved accordingly...
MOVE %1 E:\
EXIT 0
)

REM **
REM ** Tell SabNZBd that all is well with our script.
REM **
EXIT 0


Attachments:
File comment: Error
SABnzdb.PNG
SABnzdb.PNG [ 8.21 KiB | Viewed 7260 times ]
 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: January 11th, 2014, 10:39 pm 
Offline
Developer/Owner
User avatar

Joined: May 1st, 2009, 10:12 am
Posts: 11315
Location: Meridian, ID, USA
You need quotes around "E:\Recorded TV".

_________________
Peter Souza IV
stable version 2.16.11117.1299 / April 21st, 2017
Media Center Master on Facebook!


 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: January 12th, 2014, 12:11 am 
Offline
Flash Video

Joined: September 19th, 2010, 9:48 am
Posts: 20
Pete wrote:
You need quotes around "E:\Recorded TV".


Thanks. I will give that a try


 Profile  
 Post subject: Re: SabNZBd post-processing script for separating downloads
PostPosted: January 13th, 2014, 11:56 am 
Offline
Flash Video

Joined: September 19th, 2010, 9:48 am
Posts: 20
Pete wrote:
You need quotes around "E:\Recorded TV".


Yep - that worked. Thanks again!


 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group



Copyright © 2009-2017, Media Center Master, Inc. All rights reserved.