My all inclusive AppleTV Mac OS X Bash Post Processing Script
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
My all inclusive AppleTV Mac OS X Bash Post Processing Script
I finally managed to get a working Bash Script for my Mac OS X machine that handles the various types of Video that is passed to it from SABnzbd.
This could be modified for other variations without too much trouble, but this script currently:
Checks if it is a Movie, if so process accordingly, if not
Checks if it is a Formula1 show, if so process accordingly, if not
Checks if it is a MotoGP show, if so process accordingly, if not
Checks if it is a WRC show, if so process accordingly, if not
Processes as a TV Show / Series
The sections for F1, MotoGP and WRC could easily be taken out and the script would then do Movie, TV Shows and TV Shows without Season Episode information. That probably covers most people.
All of the TV Show / Series that I nab have Season and Episode numbers, I created the separate processes for my racing series because they come through in a different format.
The movies section works fine, but I do plan to add more code later that will 1) combine 2 AVI's into a single AVI, and 2) convert Video_TS into ISO. With those two additions it should do everything I want it to. Possibly it may be a good idea to add one final TV type, and that is a non-racing series that does not have Season and Episode information - that would cover shows like The Daily Show.
This could be modified for other variations without too much trouble, but this script currently:
Checks if it is a Movie, if so process accordingly, if not
Checks if it is a Formula1 show, if so process accordingly, if not
Checks if it is a MotoGP show, if so process accordingly, if not
Checks if it is a WRC show, if so process accordingly, if not
Processes as a TV Show / Series
The sections for F1, MotoGP and WRC could easily be taken out and the script would then do Movie, TV Shows and TV Shows without Season Episode information. That probably covers most people.
All of the TV Show / Series that I nab have Season and Episode numbers, I created the separate processes for my racing series because they come through in a different format.
The movies section works fine, but I do plan to add more code later that will 1) combine 2 AVI's into a single AVI, and 2) convert Video_TS into ISO. With those two additions it should do everything I want it to. Possibly it may be a good idea to add one final TV type, and that is a non-racing series that does not have Season and Episode information - that would cover shows like The Daily Show.
Last edited by randyharris on April 13th, 2010, 12:15 am, edited 1 time in total.
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Easy Peasy,
It turned out to be very simple and quick to add the code to convert a VIDEO_TS dvd rip to a UDF ISO image.
It turned out to be very simple and quick to add the code to convert a VIDEO_TS dvd rip to a UDF ISO image.
Last edited by randyharris on April 13th, 2010, 12:16 am, edited 1 time in total.
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
...And updated again to combine 2 Movie AVI's into 1 before encoding with HandBrakeCLI.
Updated Script.
Updated Script.
Last edited by randyharris on April 13th, 2010, 12:16 am, edited 1 time in total.
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Interesting, in live tests my AVI section that joins two AVI's worked flawlessly, but when I have the script run live from SAB it always thinks a single downloaded AVI is two avi's...
Any idea from you Mac Bash Script mavens out there?
Thanks
Any idea from you Mac Bash Script mavens out there?
Thanks
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
I still haven't got the AVI joining to work in live processing (works perfectly in test runs oddly.)
And I haven't had the opportunity to test out the Video_TS -> ISO yet.
I did add an ability for TV Shows to work and inject into iTunes if it is a non Season Episode show. The script would end up writing a file " - SE.m4v" for files that had no Season or Episode information. Now it 'fakes' info and uses the Job Name for the Show name, Season 2010 and Episode 01 if Season and Episode information aren't in the Job Name, the file name is also written as the Job Name.m4v. This works pretty well for me.
And I haven't had the opportunity to test out the Video_TS -> ISO yet.
I did add an ability for TV Shows to work and inject into iTunes if it is a non Season Episode show. The script would end up writing a file " - SE.m4v" for files that had no Season or Episode information. Now it 'fakes' info and uses the Job Name for the Show name, Season 2010 and Episode 01 if Season and Episode information aren't in the Job Name, the file name is also written as the Job Name.m4v. This works pretty well for me.
Last edited by randyharris on April 13th, 2010, 12:17 am, edited 1 time in total.
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Hot Damn!
I got the "join 2 AVI's to 1 AVI" part of the code working. The 'Convert Video_TS to ISO' (so that HandbrakeCLI can encode) is the only section of code that is untested.
Man I'm happy to finally getting this thing working as I had hoped. It has been a real test for me to put this script together because I don't know the first thing about Bash Scripts, not my area of expertise, but web searching and asking for a little help has done wonders. There are so many subtle syntax things to these bash scripts, hard to 'get it' when you don't really understand it to begin with.
I got the "join 2 AVI's to 1 AVI" part of the code working. The 'Convert Video_TS to ISO' (so that HandbrakeCLI can encode) is the only section of code that is untested.
Man I'm happy to finally getting this thing working as I had hoped. It has been a real test for me to put this script together because I don't know the first thing about Bash Scripts, not my area of expertise, but web searching and asking for a little help has done wonders. There are so many subtle syntax things to these bash scripts, hard to 'get it' when you don't really understand it to begin with.
Last edited by randyharris on April 15th, 2010, 7:58 am, edited 1 time in total.
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Hi,
I am running sabNZB under Ubuntu ... and I also want:
- that my series and movies are put into a sepereate directory
- that my TV series gets the correct tag when I import it in itunes that the TV series really comes in the TV Series folder of itunes.
I have been looking at your script ...
Is this also working on Ubuntu?
I am running sabNZB under Ubuntu ... and I also want:
- that my series and movies are put into a sepereate directory
- that my TV series gets the correct tag when I import it in itunes that the TV series really comes in the TV Series folder of itunes.
I have been looking at your script ...
Is this also working on Ubuntu?
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Not familiar with non Mac versions of Unix, you'd have to test and see if the bash script runs on Ubuntu. If it works as it does on Mac then all of these things are built into the script today.i-1 wrote: Hi,
I am running sabNZB under Ubuntu ... and I also want:
- that my series and movies are put into a sepereate directory
- that my TV series gets the correct tag when I import it in itunes that the TV series really comes in the TV Series folder of itunes.
I have been looking at your script ...
Is this also working on Ubuntu?
UPDATE - I must have been sleeping when I wrote that, the script uses AppleScript to inject TV Show info into iTunes, and a Mac app, iDentify for Movies - you'd need to find similar methods for your setup.
Last edited by randyharris on April 15th, 2010, 8:37 am, edited 1 time in total.
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Changed a few things around in the Movies section of the script so that it has better success with ISO/IMG/VIDEO_TS DVD rips. So far it seems to be improved.
Added some error checking in case the REGEX fails to parse out proper tag info from the filename, in this case it will now use the Current Year as the Season, 01 as Episode, and the Job Name as the Show Name.
Also added a lot of comments into the script for other eyes that may be looking at it.
I'm keeping a log of all the various sections that have been tested, haven't run across a VIDEO_TS yet to verify that section, but this baby is 99% done in my opinion. It is working amazingly well and unless I have new features to add it's just about done.
Added some error checking in case the REGEX fails to parse out proper tag info from the filename, in this case it will now use the Current Year as the Season, 01 as Episode, and the Job Name as the Show Name.
Also added a lot of comments into the script for other eyes that may be looking at it.
I'm keeping a log of all the various sections that have been tested, haven't run across a VIDEO_TS yet to verify that section, but this baby is 99% done in my opinion. It is working amazingly well and unless I have new features to add it's just about done.
Last edited by randyharris on April 16th, 2010, 7:00 pm, edited 1 time in total.
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Randy,
Ubunty can do the BASH scripting ... so I can come a long way with that ...
But Ubuntu can not do "osascript" ... so I huess this is apple (MAC OS) specific?
And is this the only place where you use applescript to identify the TV SHOWS?
I also have a question about how you rund the full setup including SabNZB...?
This SabNZB postscripting is a bit new for me ...
So maybe you can tell be in steps what you did to make this work...
Ubunty can do the BASH scripting ... so I can come a long way with that ...
But Ubuntu can not do "osascript" ... so I huess this is apple (MAC OS) specific?
And is this the only place where you use applescript to identify the TV SHOWS?
I also have a question about how you rund the full setup including SabNZB...?
This SabNZB postscripting is a bit new for me ...
So maybe you can tell be in steps what you did to make this work...
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
The section that starts with osascript is AppleScript.i-1 wrote: Randy,
Ubunty can do the BASH scripting ... so I can come a long way with that ...
But Ubuntu can not do "osascript" ... so I huess this is apple (MAC OS) specific?
And is this the only place where you use applescript to identify the TV SHOWS?
I also have a question about how you rund the full setup including SabNZB...?
This SabNZB postscripting is a bit new for me ...
So maybe you can tell be in steps what you did to make this work...
Do you run iTunes on Ubuntu?
On Windows you can use AtomicParsley to tag basic information to M4V files, maybe there is AtomicParsley that you can run in Unix.
Search around for a GUI tagger on Unix that does what MetaX does, this is nice for Movies so you get more info and cover art.
You can hard code SAB for say a script that will do TV shows which is great for RSS feeds, or you can set a script to a Category in SAB, and pick the proper category when you initiate a download.
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Randy,
My "download" PC runs Ubuntu with SabNZBd
However ... my iTunes PC is a Windows 7 machine ... this is where I sync my iPhone and iPad with.
So this means that after downloading and the stuff is downloaded, sorted, converted to MP4 with the TV Series tag...
I will import this into itunes from a network share so it can sync with my iPhone and/or iPad.
So I still wonder how to tackle this ...
My first step would be to get the right TYPE into the right folder...
So I have 3 types 1) Movies 2) TV Series 3) Music
AFter that it is important to get the "movies" converted to MP4 and get the TV series converted to mp4 INCLUDING the TV Series tag so that ipunes will loadin in the correct folder.
But at this point I dont even know how to get the files into the correct folders....
So can tyou explain this from the start ?
Thanks for you help so far Randy!
My "download" PC runs Ubuntu with SabNZBd
However ... my iTunes PC is a Windows 7 machine ... this is where I sync my iPhone and iPad with.
So this means that after downloading and the stuff is downloaded, sorted, converted to MP4 with the TV Series tag...
I will import this into itunes from a network share so it can sync with my iPhone and/or iPad.
So I still wonder how to tackle this ...
My first step would be to get the right TYPE into the right folder...
So I have 3 types 1) Movies 2) TV Series 3) Music
AFter that it is important to get the "movies" converted to MP4 and get the TV series converted to mp4 INCLUDING the TV Series tag so that ipunes will loadin in the correct folder.
But at this point I dont even know how to get the files into the correct folders....
So can tyou explain this from the start ?
Thanks for you help so far Randy!
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
I think you're making it a lot harder on yourself by trying to do it on a machine that doesn't even support iTunes, knock yourself out, that's out of my area.i-1 wrote: Randy,
My "download" PC runs Ubuntu with SabNZBd
However ... my iTunes PC is a Windows 7 machine ... this is where I sync my iPhone and iPad with.
So this means that after downloading and the stuff is downloaded, sorted, converted to MP4 with the TV Series tag...
I will import this into itunes from a network share so it can sync with my iPhone and/or iPad.
So I still wonder how to tackle this ...
My first step would be to get the right TYPE into the right folder...
So I have 3 types 1) Movies 2) TV Series 3) Music
AFter that it is important to get the "movies" converted to MP4 and get the TV series converted to mp4 INCLUDING the TV Series tag so that ipunes will loadin in the correct folder.
But at this point I dont even know how to get the files into the correct folders....
So can tyou explain this from the start ?
Thanks for you help so far Randy!
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
Ok,
My approach will be a bit different now...
I am doing everything on my Windows 7 machine now.
- SabNZB is there
- Itunes is there
so where do I go from now?
My approach will be a bit different now...
I am doing everything on my Windows 7 machine now.
- SabNZB is there
- Itunes is there
so where do I go from now?
-
- Full Member
- Posts: 146
- Joined: January 21st, 2010, 5:36 pm
Re: My all inclusive AppleTV Mac OS X Bash Post Processing Script
http://forums.sabnzbd.org/index.php?topic=4142.0i-1 wrote: Ok,
My approach will be a bit different now...
I am doing everything on my Windows 7 machine now.
- SabNZB is there
- Itunes is there
so where do I go from now?
http://forums.sabnzbd.org/index.php?topic=3984.0