Difference between revisions of "HDPVRCapture on Mac"

From MythTV Official Wiki
Jump to: navigation, search
(Remove hardcoding I included for Nick Canada)
 
Line 44: Line 44:
  
 
You have to keep the Calendar/iCal and HDPVRCapture open for this to work.
 
You have to keep the Calendar/iCal and HDPVRCapture open for this to work.
 +
 +
Limitations:
 +
 +
*The recording must the scheduled at least a minute or two before the recording starts.
 +
*MythTV cannot stop the recording.
  
 
TODO:
 
TODO:

Latest revision as of 17:57, 17 July 2013

To record using a Hauppauge HDPVR on a Mac under Mac OS X you have to use the third party software HDPVRCapture.

To record with mythtv select Import Test Recorder and leave the file name blank.

Open the AppleScript Editor and create a new script

on run argv
	set chan to do shell script "mysql5 --user=mythtv --password=mythtv mythconverg -s -N -e 'select channum from channel where chanid=" & (item 1 of argv) & ";'"
	set starttext to (item 2 of argv)
	set start to current date
	set start's year to (text 1 thru 4 of starttext)
	set start's month to (text 5 thru 6 of starttext)
	set start's day to (text 7 thru 8 of starttext)
	set start's hours to (text 9 thru 10 of starttext)
	set start's minutes to (text 11 thru 12 of starttext)
	set start's seconds to (text 13 thru 14 of starttext)
	set endertext to (item 3 of argv)
	set ender to current date
	set ender's year to (text 1 thru 4 of endertext)
	set ender's month to (text 5 thru 6 of endertext)
	set ender's day to (text 7 thru 8 of endertext)
	set ender's hours to (text 9 thru 10 of endertext)
	set ender's minutes to (text 11 thru 12 of endertext)
	set ender's seconds to (text 13 thru 14 of endertext)
	tell application "Calendar"
		tell calendar "HDPVR Recordings"
			make new event at end with properties {summary:"Rec", location:chan, start date:start, end date:ender}
		end tell
	end tell
	do shell script ("ln -s /Users/joe/Movies/" & (text 3 thru 8 of starttext) & "-" & (text 9 thru 12 of starttext) & "-Rec.m2ts  /Users/joe/Movies/" & (item 1 of argv) & "_" & starttext & ".mpg")
end run

This script does a query to get the channel number from the channel id, adds an event to the Mac Calendar to trigger the recording and creates a link from file name mythtv is expecting to the file MDPVRCapture is going to create.

Save the script and add an event under Recording Pending that executes the script by running

osascript scriptname.scpt %CHANID% %STARTTIME% %ENDTIME%

Add a event under Recording Finished that executes

mythcommflag --rebuild --chanid %CHANID% --starttime %STARTTIME% && mysql5 --user=mythtv --password=mythtv mythconverg -e 'update oldrecorded set duplicate=1 where chanid=%CHANID% and starttime=%STARTTIME%;'

This rebuilds the seektable which often corrupted and keeps it from rerecording the program.

You have to keep the Calendar/iCal and HDPVRCapture open for this to work.

Limitations:

  • The recording must the scheduled at least a minute or two before the recording starts.
  • MythTV cannot stop the recording.

TODO:

  • Prevent it from creating 3 or 4 events for every recording
  • Have it open and close HDPVRCapture to prevent it from crashing
  • Mark the files as not damaged