While Windows 7 MCE is amazing at recording scheduled shows you set via the UI, unfortunately there is no good way to record shows from the command line.
After doing some research I found information on the Microsoft ClickToRecord API and decided to have a crack at building an application with my limited (OK, almost non-existent) C# knowledge.
After toiling away for a few hours I was able to make a working code example.
Binary Link
Source Link
Feel free to take my source and do what you want with it, PLEASE clean it up and send it back to me.
How it works
This is a two step process, first to create the recording XML file, then import it into my schedule.exe.
1. Create an XML file as per below.
<?xml version="1.0" encoding="utf-8" ?>You can see the XML file is very simple, I have set up a scheduled record on channel 7 for 30 minutes at 12:00PM on October 26, 2011.
<clickToRecord xmlns="urn:schemas-microsoft-com:ehome:clicktorecord">
<body>
<programRecord programDuration="30">
<service>
<key field="urn:schemas-microsoft-com:ehome:epg:service#mappedChannelNumber" match="exact">7</key>
</service>
<airing>
<key field="urn:schemas-microsoft-com:ehome:epg:airing#starttime">2011-10-26T12:00:00+10:30</key>
</airing>
</programRecord>
</body>
</clickToRecord>
The key properties are:
The program duration, set as 30 minutes in my example.
<programRecord programDuration="30">
The channel number, set as channel 7 in my example.
<key field="urn:schemas-microsoft-com:ehome:epg:service#mappedChannelNumber" match="exact">7</key>
The start time, set as 12:00PM on October 26, 2011 (in UTC + 10:30 hours time zone)
<key field="urn:schemas-microsoft-com:ehome:epg:airing#starttime">2011-10-26T12:00:00+10:30</key>
2. Simply execute the XML with the following command
schedule.exe filename.xml
My Usage
I use an Asterisk script to generate the XML file when I call. First it prompts me for the channel, then program start time and date. Next the MCE is started with a wake-over-lan boot if it is switched off, then XML file is uploaded to the MCE and is then triggered with Sysinternals psexec on the MCE itself.
I hope you find this little utility as useful as I did!
No comments:
Post a Comment