Scripting n00b...

Come up with a useful post-processing script? Share it here!
Post Reply
undershot
Newbie
Newbie
Posts: 1
Joined: March 25th, 2009, 4:37 pm

Scripting n00b...

Post by undershot »

Hi. I've previously made a couple of bash scripts on my mac to process TV and Movie downloads, but I've recently bought an EeeBox PC to run some windows only programs and have in turn decided to run SABnzbd+ on it, to free up other computers in the house. The EeeBox may even eventually become my media player in the living room  :).

The problem that I have is that the scripts I originally made in Mac OS X with bash don't work on XP. I would somehow like to convert my TV script from bash to cmd/batch? (new to windows scripting), and at the same time, begin to get an understanding of a windows language, so I can continue customising.

My TV script is simple, but has been effective on my mac, and is shown below in bash:

Code: Select all

#!/bin/sh


FOLDER_PATH="$1"
cd "$FOLDER_PATH"
FOLDER_NAME=`echo $FOLDER_PATH | awk -F [/] '{print $NF}'`


echo "\n\nChecking for .avi file..."


if [ -e *.avi ]
  then
    echo "\n\n$FOLDER_NAME.avi found and copied into relevant TV folder."
    cp *.avi "../$FOLDER_NAME.avi"
    rm -rf "$FOLDER_PATH"
  else
    echo "\n\n\tNo .avi file found, left in SABnzbd+ directory."
fi


echo "\n\n...Processing Complete!"
Could somebody please give me an idea on how I'd go about converting this, or actually do it for me, and from that I'll have a reference file to work with.

Cheers.
shadow
Newbie
Newbie
Posts: 2
Joined: April 1st, 2009, 8:37 pm

Re: Scripting n00b...

Post by shadow »

Save yourself the trouble, install cygwin.
BennyHogan
Newbie
Newbie
Posts: 18
Joined: April 2nd, 2009, 2:54 am

Re: Scripting n00b...

Post by BennyHogan »

Hey Undershot,
Anyway you could read my post about MacOSX applescripts?? I think you may have something similar to what I need, but I'm a scripting n00b.

Relevant part of my post:
I'd like to have something setup where I can use SABnzbd in automator or an applescript.  I think it would be cool if I could set it up to so once its completed and uncompressed by SAB it could tell where on my HD to file it away and reformat the name.......i.e. say I downloaded Season 1 Ep 4 of How I met your Mother and it automatically is converted to How I Met Your Mother S01Ep04 (or something like that) and placed on my external HD under TV Shows/How I Met Your Mother/Season 1/Ep 4.....and then have the original .avi file on the HD deleted so only the stored copy on the external remains.
Surely someone has to have something like this setup??? Any ideas

Thanks in advance
Last edited by BennyHogan on April 3rd, 2009, 1:44 pm, edited 1 time in total.
BennyHogan
Newbie
Newbie
Posts: 18
Joined: April 2nd, 2009, 2:54 am

Re: Scripting n00b...

Post by BennyHogan »

Edit
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: Scripting n00b...

Post by markus101 »

BennyHogan wrote: Hey Undershot,
Anyway you could read my post about MacOSX applescripts?? I think you may have something similar to what I need, but I'm a scripting n00b.

Relevant part of my post:
I'd like to have something setup where I can use SABnzbd in automator or an applescript.  I think it would be cool if I could set it up to so once its completed and uncompressed by SAB it could tell where on my HD to file it away and reformat the name.......i.e. say I downloaded Season 1 Ep 4 of How I met your Mother and it automatically is converted to How I Met Your Mother S01Ep04 (or something like that) and placed on my external HD under TV Shows/How I Met Your Mother/Season 1/Ep 4.....and then have the original .avi file on the HD deleted so only the stored copy on the external remains.
Surely someone has to have something like this setup??? Any ideas

Thanks in advance
That's all done within SABnzbd with the Renaming for TV shows and using Categories. Just point the TV category to your external drive and enable the renaming portion of it and you should be golden.
Co-developer of NzbDrone (.Net NNTP PVR) - http://www.nzbdrone.com
BennyHogan
Newbie
Newbie
Posts: 18
Joined: April 2nd, 2009, 2:54 am

Re: Scripting n00b...

Post by BennyHogan »

markus101 wrote:
BennyHogan wrote: Hey Undershot,
Anyway you could read my post about MacOSX applescripts?? I think you may have something similar to what I need, but I'm a scripting n00b.

Relevant part of my post:
I'd like to have something setup where I can use SABnzbd in automator or an applescript.  I think it would be cool if I could set it up to so once its completed and uncompressed by SAB it could tell where on my HD to file it away and reformat the name.......i.e. say I downloaded Season 1 Ep 4 of How I met your Mother and it automatically is converted to How I Met Your Mother S01Ep04 (or something like that) and placed on my external HD under TV Shows/How I Met Your Mother/Season 1/Ep 4.....and then have the original .avi file on the HD deleted so only the stored copy on the external remains.
Surely someone has to have something like this setup??? Any ideas

Thanks in advance
That's all done within SABnzbd with the Renaming for TV shows and using Categories. Just point the TV category to your external drive and enable the renaming portion of it and you should be golden.
I see the options in SABnzbd but how do I have it determine whether its a TV show or Movie without manually clicking on SAB and telling it which one it is while its downloading?? In the folder I download on my external drive I have both tv shows and movies. 
I have SAB set up to enable tv sorting but I don't really know how to get it to be automatically placed in the correct folder because without manually clicking that its tv or move because without doing that it is saved in the root folder and never moved to the correct folder??
Thanks
Last edited by BennyHogan on April 3rd, 2009, 6:44 pm, edited 1 time in total.
BennyHogan
Newbie
Newbie
Posts: 18
Joined: April 2nd, 2009, 2:54 am

Re: Scripting n00b...

Post by BennyHogan »

bump
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Scripting n00b...

Post by switch »

How do you add nzb's to SABnzbd? The watched folder supports categories by creating extra folders for each category, see the Watched Folder section of http://sabnzbd.wikidot.com/configure-directories
Post Reply