Instructables

MythTV / AppleTV2 Integration- Non Jailbreak Version

Picture of MythTV / AppleTV2 Integration- Non Jailbreak Version
I've been running MythTV in my home since late 2006, and have had great joy working with it over the years (started running it on Fedora Core 6- that's how long it's been!).  

So that's why when my wife got me an AppleTV2 for my birthday last year, I just had to integrate it into my MythTV environment.  The first thing I did was jailbreak the device, and installed XBMC.  Using the built-in DLNA server that MythTV includes, I was able to stream my recordings directly to my Apple TV2 with quite a bit of success.

While XBMC is a great product, using it on an Apple TV2 is not quite ideal- it requires a jailbreak, and it's a little odd moving back and forth between the Apple UI and the XBMC UI- which our family found ourselves doing quite a bit.  Also, Apple products seem to work best when you buy into their ecosystem- I know that sounds rather "sheep"-ish, but it's true.  

This instructable outlines how I am able to watch all of my MythTV shows on my AppleTV2, while staying "genius" friendly...

Step 1: My Environment- Overview

Picture of My Environment- Overview
This is my environment.  A brief description of how the setup works:

1) MythTV records a TV show
2) A custom job executes at the end of the recording which uses HandBrakeCLI to encode the video into AppleTV2 format.
3) Every 5 minutes, a powershell job executes on the Win7 VM.  This job does the following:
     a)  Uses the iTunes SDK to acquire an instance of the active iTunes "TV Shows" library.
     b)  Performs a query on MythConverg looking for all transcoded shows, and finds any not in iTunes yet.
     c)  Adds any missing shows from mythconverg into the TV Shows library
     d)  Looks through the TV Shows library, and removes any that are no longer in mythconverg

4) Wife enjoys Big Brother on our Apple TV2!

Note: All scheduling of new shows, and deletion of old shows happens through mythweb.
 
Remove these adsRemove these ads by Signing Up
sweet instructable thank you!
Cool. What gets me is there are all these streaming boxes based on open source that you dare not modify unless you want the wrath of the gods. Then there is Apple tv so proprietary and it is the one you can modify. Does not seem right.
cinntax (author) 2 years ago
Okay I took another look at this- and I think I know what the issue is.
Here's an example of what gets passed in from mythtv ($3):
2012-08-03T21:58:00

Here's what's in mythconverg as the start time field:
2012-08-03 21:58:00

So the ${3/T/ } is simply a bash construct to do a find/replace on the character 'T'.

Knowing this- i doubt that $3 will actually work- it may have cleared up your error, but I'm sure your database didn't get updated properly, so I would guess that your test recordings are not watchable at the moment (it's an easy fix however).

Here's the root of the problem though- the ${3/T/ } is a BASH construct, so you must actually be running BASH, and not another shell. On my machine, /bin/sh happens to be a symlink to bash, so that top line in the script is actually causing bash to run :).

Try this:
from the command line- run: whereis bash
on line 1- replace /bin/sh with the output from that (likely /bin/bash- so #!/bin/bash for example.)

I'll update the code to be /bin/bash instead of /bin/sh. Thanks- let me know if that fixes it!
Aha, yup on Ubuntu /bin/sh is symlinked to /bin/dash, that probably caused the problem.

Thanks!
BoxOfSnoo2 years ago
I can't get the bash script to work, it dies at this line:

SHOWTIME=${3/T/ }

What's it do? Why wouldn't SHOWTIME=$3 work? It seems to do so on my tests.
cinntax (author)  BoxOfSnoo2 years ago
Thanks for trying it- I know it had something to do with formatting the date so the SQL query would work (sorry I wrote it a while ago). I'm out and about, but will investigate when I get home.