2 Linux scripts 1 pre process rss parser (TV) 1 post process (TV and Other)

Come up with a useful post-processing script? Share it here!
Post Reply
Chester77
Newbie
Newbie
Posts: 1
Joined: February 26th, 2011, 1:33 am

2 Linux scripts 1 pre process rss parser (TV) 1 post process (TV and Other)

Post by Chester77 »

Here are 2 scripts I'm using with Sabnzbd+ 0.5.4 (I know it's old but it works good for me) on ubuntu 10.10.
I think they should work on the current version, unless something has changed.

I offer them with no warranty, but if configured correctly they will not harm your Linux box.

I didn't like the way sabnzbd+ was handling my RSS feed from nzbmatrix so I wrote a script to handle the rss feed for me.

The script is called parseRSS.sh.

parseRSS.sh should be added to your crontab and run no more than once every 30 minutes.

parseRSS.sh will download the nzbmatrix rss feed and scan through it for TV Shows that match the shows defined in a file.
If it finds a match to a show name and quality level it will copy it to the sabnzbd+ nzb scanning directory.

Each line in the shows file has 3 columns separated by ; .
The 1st column is the show name with periods between the words.
The 2nd column is the quality (xvid or x264).
The 3rd column is used by the PostProcess script (pp.sh). Leave blank if you do not wish to use the PostProcessing script.

Example:

CSI.New.York;xvid;user2
True.Blood;x264;user1

The PostProcessing script is called pp.sh.

pp.sh handles the post processing needs of all your downloads, not just TV shows.

pp.sh will rename your TV Shows to get rid of ugly filenames.

example: CSI.New.York.S01E12.nonsense.mkv becomes CSI.New.York.S01E12.mkv

pp.sh will store your TV shows in the location specified in the user configuration file

pp.sh supports an unlimited number of different users so different members of the family can keep their shows separate from one another.

pp.sh will send an email to the user whose show has just downloaded to indicate the success to failure of the download and the location that it was stored.

example of user configuration file (3 columns ; delimited):

User1;/media/USB_DRIVE_C-1/TV Shows/User1's Shows;[email protected]
User2;/media/USB_DRIVE_C-1/TV Shows/User2's Shows;[email protected]
Both;/media/USB_DRIVE_C-1/TV Shows/User1 and User2;[email protected],[email protected]

Notice the line for the user "Both". This puts the shows multiple people watch in the same folder and notifies both of them of the status.
If multiple users watch the same show but don't wish to watch together  the shows can be stored in separate locations. Simply add the show multiple times with different users to the show list file.

example:

CSI.New.York;xvid;user1
CSI.New.York;xvid;user2
True.Blood;x264;user1

That's about it for TV Shows.

pp.sh also handles the post processing of your other usenet download needs.

pp.sh can be configured to key off of strings in the nzb filename and move the file to the appropriate location.
pp.sh can also be configured to perform special post-post processing on certain file types,

pp.sh categories configuration file example:

1st column - string to search nzb filename for
2nd column - location to store the extracted files
3rd column - special command to run for post-post processing. the format for this column is "command+argument-argument"
arguments accepted for the special command are name and path. name is the value of $3 (nzb file name without .nzb) minus the key string, and path is the path the download was copied to.
4th column is the email address of the person to notify upon completion. leaving blank will cause a default to be emailed.

example:
HD;/media/USB_DRIVE_D-1/HD;/home/ubuntu/scripts/get-imdb.sh+name-path;
xvid;/media/USB_DRIVE_D-1/DIVX;/home/ubuntu/scripts/get-imdb.sh+name-path;
App;/home/ubuntu/Apps;;[email protected]
3D;/media/USB_DRIVE_D-1/3D;;
Sports;/media/USB_DRIVE_D-1/Sports;;

Using the configuration file above an nzb file downloaded named "Something Cool HD" would get placed in "media/USB_DRIVE_D-1/HD/Something Cool" (the key string is stripped off), and have the script get-imdb.sh run with the name and path arguments. The default email contact is notified of the success or failure.

In addition to the configuration files being properly configured, some variables must be set in each script.
The variables that require configuration are at the top of parseRSS.sh and pp.sh and I have commented them appropriately.
It would be best to use double quotes around all variable values.

The parseRSS.sh HistoryFile and pp.sh Log variables should point to the same file.
The parseRss.sh and pp.sh ShowFile variables should also point to the same file.
example:
parseRSS.sh
User="NZBMATRIXUSER"
Key="YourNZBMATRIXAPIkeyhere"
url="http://rss.nzbmatrix.com/rss.php?page=d ... cenename=1"
HistoryFile=log="/home/ubuntu/scripts/Downloaded.txt"
ShowList="/home/ubuntu/scripts/ShowList.txt"
NzbDir="/home/ubuntu/nzb"
LogDir="/home/ubuntu/log"

pp.sh
ShowList="/home/ubuntu/scripts/ShowList.txt"
DB="/home/ubuntu/scripts/users.cfg"
log="/home/ubuntu/scripts/Downloaded.txt"
Default="[email protected]"
DefaultTVmail="[email protected],[email protected]"
DefaultTVDIR="/home/ubuntu/TV"
DefaultNonShow="/home/ubuntu/misc"
CatFile="/home/ubuntu/scripts/Category.cfg"

I hope I covered everything. If you have trouble I'll try my best to help.

http://www.mediafire.com/file/nnclcrofh ... arseRSS.sh

http://www.mediafire.com/file/5gxr7d533k3n99a/pp.sh

Edit: I forgot that there is 1 dependency for parseRSS.sh. Curl (sudo apt-get install curl for ubuntu users).
Last edited by Chester77 on February 26th, 2011, 5:50 pm, edited 1 time in total.
yeahbut
Newbie
Newbie
Posts: 9
Joined: September 6th, 2009, 12:26 am

Re: 2 Linux scripts 1 pre process rss parser (TV) 1 post pro

Post by yeahbut »

Any chance these could be shared again?

Thanks
Post Reply