{{keywords>mythtv aontv iptv howto anleitung m3u network recorder lan telekom austria xmltv grabber wakeup wake-on-lan tv-movie}}
====== Introduction and Overview ======
In this tutorial I want to explain how you can combine [[http://www.mythtv.org/|Mythtv]] (a free Media Center software for Linux) and [[http://www.telekom.at/dasfernsehenderzukunft|Aontv]] (an Austrian IPTV service of [[http://www.telekom.at/|Telekom Austria]]). Why do you want to do this when you already have a working Settop Box sitting beneath your TV? Mythtv turns your PC into a digital video recorder with the following features:
* watch and record TV programs
* Pause, skip, and rewind live TV (time-shift)
* connect several frontends and backends to your system
* a webfrontend makes recording scheduling and administration easy
* open source
* several plugins for creating a customized media center
* automatic detection of commercials
* schedule recordings automatically (e.g. once a week, every day, find once)
* watch DVDs and your video collection
* also Mac support, but no Windows for the moment
* and my picture's quality is better than the one of Aontv's settop box!
{{:ubuntu:aontv_livetv.png?300&direct|livetv}} {{:ubuntu:aontv_welcome.png?300&direct|welcome}} {{:ubuntu:aontv_recorded.png?300&direct|recordings}}
The tutorial basically shows how I configured my system and does not claim to be the only or most elegant solution. It still is your own risk to follow my example. The tutorial covers different aspects, which may or may not be relevant for your own setup. You decide what you need and how much you are capable of realizing. The network configuration and the installation of Mythtv is rather easy and well documented here. The latter chapters may demand better skills and own research. Some configurations may be a task of a few minutes or may evolve into time and energy vampires. The provided link literature should in any case point you towards the right directions for problem solving. You should definitely check it if some of my comments are not so clear to you.
====== Mythbuntu Installation ======
For the operating system, I now use Mythbuntu 10.04 (get it [[http://www.mythbuntu.org/|here]]) and formerly use a standard Ubuntu Linux version. Mythbuntu gives you the advantage of installing a lightweight Mythtv installation right away - lightweight because it is using xfce instead of gnome. There are hardly any differences in the configuration but I will try to report most of them. One big difference is the installation, since Mythtv is configured and installed right from the LiveCD. Please mind that you have the possibility of installing a new system with a USB stick instead of burnt CDs ([[http://en.wikipedia.org/wiki/Ubuntu_Live_USB_creator|Startup Disk Creator on Ubuntu]]).
The basic installation of Mythbuntu is easy ([[http://www.mythpvr.com/mythtv/distribution/mythbuntu/install.html|slightly outdated tutorial]]). The only thing which requires your brain is the partitioning. Since 1 hour of recorded video is approximately 1.3 gigabyte you should have enough space. My filesystem consists of a 10gb system partition on / (ext4), 1gb swap space, the rest (ext4) for /home. The larger harddrive sdb1 250gb is mounted at /home/mythtv and also formatted to ext4. This is the place where I want Mythtv to store its recordings.
During the installation of Mythbuntu the basic settings for Mythtv are configured. Choose primary backend with frontend when asked. You may already enable the propietary driver for your graphics card if you available. The most parameter can be made later on in the Control Center, so I suggest skipping the settings concerning MythTV service, Lirc, etc. neither do you need to launch the Mythtv-Setup.
For best results connect your PC to the TV using a HDMI cable. check if your display is configured correctly. I needed to change my resolution manually to 1920x1080 using Nvidias system tool by choosing the correct resolution and writing it to the //X Conf File//. Additionally, make sure you installed all system updates. This may take some time...
One of the first things I deselect is to automatically launch the Frontend after reboot - this is not nice if your system is supposed to shutdown automatically (screenshot??). I install the text editor //gedit// and a Firefox extension called [[http://urandom.ca/nosquint/|No Squint]] which makes the browsing on the TV more convenient by increasing the Zoom level. And I need alsa-tools-gui for my soundcard. Last system setting I am doing is enabling the VNC server, because I often need to administer my mythbox from another PC. //Enable// it in the Mythbuntu Control Centre and enter a password followed by a restart (screenshot??).
automatically login??
===== Already existing Ubuntu installation =====
For a standard Ubuntu installation I recommend to use the Mythbuntu Control Centre, which makes the various options easily accessible.
* Install the package mythbuntu-control-centre by opening a terminal and running ''sudo apt-get install mythbuntu-control-centre''
* During installation, confirm the information regarding the MySQL password and the 2 lirc options are best set to //None// for the moment. They can be configured later as well.
* Start the Mythbuntu Conrtol Center (//System// > //Administration//) and choose the //frontend// and //primary backend// system roles.
* Install also //mythweb// under //Plugins//.
Enable the proprietary graphic driver (if available). In Ubuntu disable Compiz's effects (in //Appearence// > //Visual Effects//) as there are problems with the panels being always on top [[https://bugs.launchpad.net/mythbuntu/+bug/216861|bugreport]].
====== Watching Aontv with VLC - only if needed======
For setting up an Internet and an IPTV connection, I use 2 network cards. Other scenarios with different router firmwares are possible. Since only the firmware 8.6.9.0 for the Thomson Speedtouch 585v7 was running flawlessly for me, I chose to buy a network PCI card for less than 10€. If you have a newer firmware you do not need the second network interface! However, please note that Aontv currently only allows two IPTV streams, and only if you own two settop boxes. You can watch a show with one settop box and record another program with your mythbox.
You can find out if you are able to watch IPTV and Internet with the same connection by trying to open this [[http://www.download.alitility.com/vlc_aontv_livetv_0911.m3u|.m3u playlist]] with VLC. It often takes some time until the picture comes up, so don't be too impatient. If you don't see anything you should proceed with the method outlined below or maybe update the router's firmware [[http://www.dieschmids.at/Zum-Forum/|further reading]].
The plan is to have one card accessing the Internet while the second card uses the IPTV stream. As a consequence, the different areas for each card need to be defined, i.e. by creating static routes. Additionally, the two cards need to get static IPs for being identifiable. So let's start:
* Install the second network card. But do not yet connect it to the router [[http://lifehacker.com/135479/hack-attack-how-to-install-a-pci-card|tutorial]].
* Make sure that in the first step only the card for the internet connection is hooked up to the router. (Be aware that the TG585v7 is preconfigured with the ports 1&2 providing Internet and the ports 3&4 Aontv respectively. So choose one of the first ports!)
* Check your internet connection, which should already be configured automatically after plugging in the cable.
* Open the terminal and run ''ifconfig''. Your output should be similar to this one:
stefan@earl:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:24:01:31:71:8b
inet addr:10.0.0.38 Bcast:10.0.0.255 Mask:255.255.255.0
...
eth1 Link encap:Ethernet HWaddr 00:0c:6e:34:0f:08
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
...
* You will see that only one card is up and running - the one which was given an IP by the router. Note the card's name In my example above that's //eth0// with the IP //10.0.0.38//.
* Right click on the network symbol on the upper panel and choose //edit connections//
{{:ubuntu:aontv_net01.png?200&direct|}}
* Double click on //Auto ethX// (the network interface) we just identified. You can also compare the mac address to see if it is the correct interface.
{{:ubuntu:aontv_net02.png?200&direct|}}
* Change the //Connection name// to something like //static_internet//,
{{:ubuntu:aontv_net03.png?200&direct|}}
* Go to //IPv4 Settings//
* Choose //Manual// as //Method// - for setting a static IP.
* Click //Add// and fill in the following values manually: IP: //10.0.0.2//; DNS Masq: //255.255.255.0//; Gateway //10.0.0.138// (default for the aon router); DNS Server is the same: //10.0.0.138// and click ok
{{:ubuntu:aontv_net04.png?200&direct|}}
* The connection is now quit and reestablished - confirm that the configuration is working by checking the internet. You now have a static IP address for this network interface - //10.0.0.2// - you may need to physically disconnect and reconnect the network cable, if it is not working!
* Now, connect the second network card with the Aontv ports of the router (3, 4)
* Again: right-click on the network symbol > //Edit Connections// > choose //auto eth1// (the second device, you may rename to static_aontv) > //IPv4 Settings// > //Method: Manual// > //Add// and fill in the following values for the second card: IP: //10.0.2.2//; DNS Masq //255.0.0.0//; Gateway //0.0.0.0// (is only needed to silence the system), no dns is needed
{{:ubuntu:aontv_net06.png?200&direct|}}
* Click on routes
* Add a first entry: IP: //239.0.0.0//; DNS: //255.0.0.0// and a second entry with IP: //224.0.0.0//; DNS: //255.0.0.0//, confirm with ok, then apply
{{:ubuntu:aontv_net07.png?200&direct|}}
* That's it. Install [[http://www.videolan.org/vlc/|vlc]] if necessary (e.g. ''sudo apt-get install vlc'') and try the following [[http://www.download.alitility.com/vlc_aontv_livetv_0911.m3u|.m3u playlist]] with it. The channels should show up after some time. Check also if the internet is working while watching TV. The final test is a restart... just to make sure! - Congratulations!
===== Comments & Troubleshooting =====
* Please note that you should not allocate the same IP to 2 different interfaces in one LAN. If you want to watch Aontv on another computer as well, use another IP of the same network instead, e.g 10.0.2.3!
* Make sure the settop boxes are not running! Keep in mind: maximally 2 streams can be watched simultaneously.
====== MythTV Setup ======
Before we start with configuring Mythtv, two more items need to be dealt with. First, a channel list for Aontv programs is required. You can use [[http://www.download.alitility.com/mythtv_aontv_channels_1002.m3u|mine]] for a start or customize it to your preferences (e.g. channel number, channel name). The syntax of the .m3u file is pretty understandable and easy to be configured manually with a text editor. Just note that the //@// sign is not needed for mythtv but for vlc. In addition, the XMLTVIDs I use in my file are only relevant for people who want to use the xmltv grabber for the [[ubuntu:aontv_mythtv#Electronic Program Guide]]. You are also able to change these details in the backend (//Channel Editor//). Anyway, I recommend to use the provided file for the start.
Second, it is a good idea to create directories, where Mythtv stores its recordings. Create the directories on a larger partition: one directory for livetv and one for recordings. In my case I created /home/mythtv/livetv & /home/mythtv/recordings. Please keep in mind that the Mythtv Backend is run by the user //mythtv// and not by your own user account. As a result, user mythtv needs read and write permissions for these directories. Either set them by using the file manager: right click on the folder > //Properties// > //Permissions// or by using our friend the command line:''sudo chown -R mythtv /home/mythtv/livetv'' and ''sudo chgrp -R mythtv /home/mythtv/livetv'' (adjust the path and the user to your situation!). The result should be owner and group: //mythtv// (create and delete files). (screenshot?? - sudo chmod 775 -R for mythweb ".mpg does not exist on the host..")
and now for the fun part:
* Start the //Mythtv Backend Setup// under //System//
* //General//: change the IP address, to the one reachable from the LAN - in my example this was //eth0// with the IP //10.0.0.2//.
{{:ubuntu:aontv_backend02.png?200&direct|}} {{:ubuntu:aontv_backend03.png?200&direct|}}
* //Capture Cards//: create a new capture card, choose //Freebox Network Recorder// as //card type// and provide the path to the .m3u (you should use ''http://www.download.alitility.com/mythtv_aontv_channels_1002.m3u'') ; additionally increase the //Tuning Timeout// to about //1300// if you encouter problems - (I did!). The rest is ok.
{{:ubuntu:aontv_backend04.png?200&direct|}}
* //Video Sources//: create a new //Video Source//, name the source "aontv" (you can be creative here), but select no grabber for the moment.
{{:ubuntu:aontv_backend05.png?200&direct|}}
* //Input Connections//: choose the //Video source// to the just created //aontv//, select //Scan for channels//, confirm the already given path to the .m3u, the channels are now written to the database. Nothing can be seen and bar remains at 0 percent but it works. Check in the Channel Editor. The rest of the default configurations is ok.
{{:ubuntu:aontv_backend06.png?200&direct|}}
* //Storage directory//: provide the paths to the location where Mythtv should store the recordings (under //default//) and livetv files under (you guessed it: //Livetv//); as already mentioned the directories must already exist and the permissions need to allow writing for mythtv)
* Close the Mythtv Backend Setup with Esc.
* You can cancel the mythfilldatabase prompt now.
The time has arrived to test your new Media Center. Start the frontend and hit //Watch Livetv//! The first channel should show up after little delay. Test as well the mythweb plugin by starting your browser and directing it to this link: http://localhost/mythweb (remote machines use the Backend's IP instead of localhost, e.g. http://10.0.0.2/mythweb). Why not start your first test recording? Go to mythweb and schedule a recording for a certain channel in the near future... leave your mythbox running... and then check if the recording worked. It did? Perfect!
===== Some tweaks for Mythtv =====
(?? Samba+Mythbuntu /etc/samba/smb.conf - path videos in backend and frontend)
* Mythvideo is a plugin I highly recommend, because you can use it to watch DVDs and play your media files. It is installed by default in Mythbuntu. All official plugins are available in the Mythbuntu Control Center. Some of my modifications:
* I recommend setting up a separate directory for media files and configure the permissions similar to the livetv and recordings directory.
* Install the libdvdcss2 codec for DVD playback in the Control Centre.
* Then choose this directory as video directory for the mythvideo plugin (In the frontend: //Utilities// > //Setup// > //Media Settings// > //Video Settings// > //General Settings//).
* For some movies to work, I needed to change the file type associations for ''.avi'' from the default command to ''Internal'' (//Utilities// > //Setup// > //Media Settings// > //Video Settings// > //File Types//)
* You can also share the directory with [[http://www.samba.org/|Samba]] for making it available to other devices in your LAN. Right-click on the folder, then //Sharing Options//. Select all options for sharing the directory to everybody on the LAN.
{{:ubuntu:aontv_share.png?200&direct}}
* Change the default theme to something prettier. Other themes are easily installable via the Mythbuntu Control Center. Then, choose your favorite in the frontend: //Utilities// > //Setup// > //Appearence//. It may be worth to set also the font size and the date format in this category. Also check the OSD theme and the default font size under //Utilities// > //Setup// > //TV Settings// > //Playback OSD//.
{{:ubuntu:aontv_themes.png?200&direct}}
* Configure the time to record before and past a scheduled recording under //Utilities// > //Setup// > //TV Settings// > //General//.
* You can skip the CPU intensive commercial detection for those channels not broadcasting commercials during shows. Set those channels as commercial free in the backend under //Channel Editor//. - or simply disable the commflag job (where??).
* Define how much space should be left free by mythtv under //Utilities// > //Setup// > //TV Settings// > //General//.
* "Confirm Exit" is something I don't like, easily to disable in //Utilities// > //Setup// > //General//.
{{:ubuntu:aontv_login.png?200&direct}}
===== Connect other frontends =====
In Ubuntu install the Fronted with the package of //mythtv-frontend//. For connecting remote frontends to your primary backend, you need to know the MySQL password. The easiest way to find this password is to look in the backend setup under //General// on the first page. Additionally, the IP address is required. We already configured the IP of the backend to be reachable via LAN in Mythtv. The IP was //eth0// with //10.0.0.2// in my example. The details need to be included in the the remote computer's frontend.
You will be informed that your user needs to be added to the //mythtv// group when starting the frontend for the first time; confirm the dialog; log out and log in again.
===== Troubleshooting =====
* In Jaunty the mythbuntu theme is automatically installed - but you can easily remove it using the mythbuntu control centre again:
* click on the option //Automatically start ..// two times for the Mythbuntu artwork option become active
* you can now deselect the artwork.
{{:ubuntu:aontv_artwork_.png?200&direct}}
If you cannot connect to a remote backend, then its MySQL installation is most likely not configured for remote connections. To change this:
* open a terminal and run ''sudo gedit /etc/mysql/my.cnf''
* in this file, comment (which means add a ''#'' sign at the beginning of this line) # bind address = 127.0.0.1
* and then restart mysql with ''sudo /etc/init.d/mysql restart''
====== Electronic Program Guide ======
The EPG used by the Aontv settop boxes is at the moment not to accessible by Mythtv. A good workaround is the usage of a free [[http://wiki.xmltv.org/index.php/Main_Page|xmltv grabber]], I chose: [[http://swolter.sdf1.org/software/article-tvmovie.html|the TV Movie grabber]]. However, note that not all TV channels of Aontv are provided by this grabber (e.g. Puls 4). That is a limitation you must live with - or you go out there, find a solution and report it here. First of all, install some packages needed for using xmltv and compiling the grabber:
* open a terminal and run sudo apt-get install xmltv build-essential checkinstall libxml2-utils unzip
* visit the [[http://swolter.sdf1.org/software/article-tvmovie.html|site]] and download the grabber, an archive named something like //tvmovie-xmltv-1.2.tar.gz//
* move into the directory of the downloaded grabber and extract it with the command: tar xzf tvmovie-xmltv-1.2.tar.gz
* move into the newly created directory and look out for the file //tables.cpp//
In the tables.cpp, the channels for the grabber are defined. The easiest way is simply to replace the file with this one [[http://www.download.alitility.com/tables_aontv.cpp|here]].
Alternatively, you can configure the grabber's channel list yourself. Each channel needs to be configured with an XMLTVID in the grabber and in the mythtv database. What we want to achieve is that the XMLTVIDs of the grabber match the XMLTVIDs of Mythtv, so the right program information can be linked to the right channel. In the file //tables.cpp// the XMLTVIDs of the grabber can be included. It is easy to edit the file with a standard text editor. Look at the already configured entries in the file and start to make your own; remove the entry //NULL// and insert your XMLTVID instead, e.g.
{ "Arte", NULL, "" , "010" }
{ "Arte", "arte-tv.com", "" , "010" }
Of course, only the channels provided by Aontv should get an XMLTVID (so remove unnecessary entries).
On the Mythtv side, XMLTVIDs can be entered and changed in the Channel Editor of the Backend. Following the above example, the XMLTVID for the channel Arte becomes //arte-tv.com//. XMLTVIDs may already be set in the .m3u file for Mythtv. If you used my .m3u file you can also use [[http://www.download.alitility.com/tables_aontv.cpp|my tables.cpp]], as the entries are already made and match those of my m3u file.
Once you replaced the tables.cpp, open a terminal, move into the newly extracted directory and compile the grabber by running ([[https://help.ubuntu.com/community/CompilingEasyHowTo|English howto]], [[http://wiki.ubuntuusers.de/Programme_kompilieren|German howto]]):
* ./configure
* make
* sudo checkinstall
* confirm the first question with ''y''
* type in a description for the installed grabber, e.g. "grabber for mythtv" or "mythtv's grabber" or "grabber" or "xmltv grabber" or you come up with a good idea yourself
* and confirm the suggested package values.
Now, the grabber is compiled and installed. Next, start the Mythtv Backend Setup and select //Video Sources//:
* choose the //TV Movie clickfinder grabber (xmltv)// as grabber
{{:ubuntu:aontv_epg01.png?200&direct|}}
* select //Configure//
* you will be asked if a specific channel should be included, you can safely type ''all'' and press Enter here, in order to include all configured channels at once.
* close the mythbackend and let mythfilldatabase be run when you are asked for it (or run ''mythfilldatabase'' yourself in a terminal) - This command loads the program information to the Mythtv database.
Open a browser and surf to your web frontend. Click on //Listings//. If you see the names of lots of TV shows for the different channels, you did it!
For downloading EPG data automatically, enable the //Automatic run mythfilldatabase// option in the frontend //Utilities// > //Setup// > //General//. I changed the //mythfilldatabase Program// command to //mythfilldatabase// from //usr/bin/mythfilldatabase//. You may also disable the //Run mythfilldatabase at time suggested by the grabber// and define the time and frequency the grabber should run.
If the times of the TV show listings are not displayed correctly: open the backend setup, select //General// and change //your local time zone// to //auto// (or configure the hours manually if that doesn't work).
{{:ubuntu:aontv_epg02.png?200&direct|}}
{{:ubuntu:aontv_mythfilldatabase.png?200&direct}}
===== Problems & Troubleshooting =====
* In Mythbuntu in contrast to Ubuntu I needed to install the packages libxml2-utils and unzip manually, see [[http://swolter.sdf1.org/software/article-tvmovie-1-2.html|here]].
* Some warning message about: //mythfilldatabase --manual - your grabber does not provide channel numbers, so you have to set them manually// was not relevant for me - I simply ignored it.
* If the compilation fails try to extract the archive again (after you backed up your customized table.cpp).
====== Wake On Lan ======
You probably don't want to stand up from your convenient couch and start your mythbox by using your own hands - how oldschool! After a few modifications, you are able to start your PC via network ([[http://ubuntuforums.org/showthread.php?t=234588|English howto]], [[http://wiki.ubuntuusers.de/Wake_on_LAN|German howto]]).
* Check your bios for //Wake-On-Lan// features. You may have to enable this function in the Bios first.
* On the mythbox, install the package //ethtool//: ''sudo apt-get install ethtool''
* insert the line ethtool -s eth0 wol g in // /etc/rc.local// between ''# By default this script does nothing.'' and ''exit 0'' - while //eth0// being the card reachable in the LAN!
* Additionally, open the file // /etc/init.d/halt// and change the entry ''NETDOWN=yes'' to ''NETDOWN=no''
* Run ''ifconfig'' in a terminal and note the MAC address of the device you want to wake up
* Install the //wakeonlan// package on another Ubuntu machine on the same LAN.
* Write your own wakeup script with the previously noted MAC address of the network interface to wake up. here is a sample you can use:
#!/bin/bash
wakeonlan 00:0c:6e:34:0f:08
* Replace the MAC address and make the script executable. By executing this script, a so-called magic packet is sent to the network device which immediately wakes up your computer.
====== Programmed Wake-Up - ACPI Wakeup ======
One of the disadvantages of the mythbox is that it must be running for recording. A 24/7 server is neither environmentally friendly nor economically friendly and it is not necessary. You can configure your mythbox to wake up just a few minutes before a recording is scheduled. Your motherboard has to support this feature, but hardly any modern motherboards is not capable of waking up by alarm. For boards manufactured after 2000 the wakeup at a specific time and date should work. Furthermore, the mythbox can be configured to automatically shutdown, if it has nothing to do - how nice!
See those links for further information on ACPI wakeup:\\
http://www.mythtv.org/wiki/ACPI_Wakeup\\
http://www.vdr-wiki.de/wiki/index.php/ACPI_Wakeup\\
https://help.ubuntu.com/community/MythTV/Install/WhatNext/ACPIWake - good article but outdated method: /proc/acpi/alarm\\
In my case only the old method of NVRAM is supported (I have an asus p4pe). I can therefore only report about this outdated method, which you can try if you are not successful with the approach presented above (more info [[http://www.vdr-wiki.de/wiki/index.php/NVRAM_WakeUp|here]] and [[http://www.mythtv.org/wiki/Shutdown_Wakeup|here]]):
* Install the package //nvram-wakeup//
* Run the command ''sudo nvram-wakeup -D'' and see if the motherboard is recognized - For the possible problem with /dev/nvram: ''nvram'' should be enlisted in the // /etc/modules// file followed by a restart.
* The alarm in my bios must be changed for a date (other boards may need the option to be disabled - try different settings)
Check, if it works by setting the wakeup time to 10 minutes in the future : /usr/sbin/nvram-wakeup -s $((`date +%s` + 10 * 60))
If you have troubles with permissions for // /dev/mem // then you probably need to use ''sudo''.
So far so good. If the wakeup command requires administration rights, the mythtv user must be equipped with some special rights.
* run ''sudo visudo'' in a terminal
* add the following string %mythtv ALL = NOPASSWD: /sbin/halt, /usr/sbin/nvram-wakeup to the very last line of the file. These are the commands for shutting down and for setting the wakeup alarm for the mythtv user. While editing the file make sure there is just one entry of mythtv ([[https://help.ubuntu.com/community/MythTV/Install/WhatNext/ACPIWake|reference]]). Here is a sample:
(?? check sudo)
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
%mythtv ALL = NOPASSWD: /sbin/halt, /usr/sbin/nvram-wakeup
It's now time to configure Mythtv under //Utilities// > //Setup// > //General//. I always deselct the //Block shutdown before...//. Set a time for the seconds of idle time before the system is automatically brought down. Also, the time for the system to wait for the next scheduled recording and how many minutes before the recording the alarm is set. The //wakeup time format// is ''time_t'' for the nvram method and the //command to set wakeup time// is ''sudo /usr/sbin/nvram-wakeup -s $(($time +300))''. The //server halt command// is a simple ''sudo shutdown -h now''. In any case, take a look at the provided screenshot and read the explanations for the available options in Mythtv.
{{:ubuntu:aontv_wakeup.png?200&direct}}
====== Remote Control via Lirc ======
What is missing for a true media center is a remote control. I recommend buying your own on the internet, but be sure to check for its compatibility with linux i.e [[http://www.lirc.org/|lirc]]. I've bought a USB remote control for one of Microsoft's Media Center software, which I highly recommend ([[http://www.mythtv.org/wiki/MCE_Remote]] & [[http://www.oneweb.co.uk/mythtv/2009/02/configuring-your-mce-ir-remote/]]). [[https://help.ubuntu.com/community/LIRC|English lirc howto]] [[http://wiki.ubuntuusers.de/Lirc|German lirc howto]].
In my case the configuration was easy using the Mythbuntu Control Centre. Under //Infrared Devices// select the configuration files for your remote; mine //Windows Media Center remotes//.
{{:ubuntu:aontv_lirc.png?200&direct}}
Customize the remote buttons to your hands. First, you must find out how the remote's buttons are recognized by your system. This information is found in the file // /etc/lirc/lircd.conf//. It is possible that this file only holds links to other configuration files of remotes, which you should read instead! In those .conf files a name is allocated to each button's infrared code, e.g.
begin codes
input 0xD02F
energy_saving 0xA956
power 0x10EF
tvradio 0x0FF0
av_mode 0x0CF3
one 0x8877
Similarly, in the //~/.lircrc// file the buttons' names are allocated to actions or again links are provided to the actual files (e.g. the //.lirc// directory). In essence, the //.lircrc// defines what happens when a certain button is pressed. Each program may have its own file, per default mythtv's lirc commands are set in //~/.lirc/mythtv//. Have a look at [[http://www.download.alitility.com/lirc.mythtv|mine]]. As you can see, important variables are the name of the remote, the program the command is executed in, the button pressed and the action to execute. Just follow the example and use the [[http://www.mythtv.org/wiki/Keybindings|keybindings]] of Mythtv for your own customized remote.
These keypresses are only active if mythfronted is running. If you want to start the program with the remote, you can use the [[http://www.lirc.org/html/irexec.html|irexec]] program, which simply executes commands on keypresses.
* Open the file .lircrc in your home directory
* Copy these lines beneath the other entries
* Configure the button and the remote you want to use.
begin
remote = mceusb
prog = irexec
button = Home
config = mythfrontend &
end
The //&// sign is necessary to make irexec available during Mythtv. Then start irexec as daemon process by running //irexec -d// and let the system launch irexec after startup (list it under //System// > //Preferences// > //Startup Applications// in Ubuntu and under //System// > //Session and Startup// with the command ''irexec -d'').
===== IR Transmitter =====
You have external devices like your TV or an amplifier you want to control with your mythbox's remote? With the necessary hardware (IR eye, transmitter), you can pass on custom IR commands to these devices. Just plug in your IR eye and point it to the IR receiver of your device in short distance.
* You need a .conf file which holds the button codes of the external device's remote. Either you look for it [[http://lirc.sourceforge.net/remotes/|here]] or [[http://lircconfig.commandir.com/lircd.conf/|here]] or you make it yourself with [[http://www.lirc.org/html/help.html|irrecord]].
* Choose the transmitter driver, again in the Mythbuntu Control Center. Mine is the //Microsoft Windows Media Center V2//. Now, the lirc device should be correctly set in the // /etc/lirc/hardware.conf// file.
* Include your remote .conf file in // etc/lirc/lircd.conf // (but change the path and filename).
include "/usr/share/lirc/remotes/custom/custom.conf"
* check if it is working:
* restart lirc by sudo /etc/init.d/lirc restart and start irexec again by running irexec -d (if it isn't already running)
* Then send a command to your device by executing ([[http://www.lirc.org/html/irsend.html|reference]]): irsend SET_TRANSMITTERS 1
irsend SEND_ONCE RM-S325 vol+ adjust the number of the transmitter, the name of the remote (here: //RM-S325//) and the name of the button (here //vol+//). You should now see some reaction of the device.
* Make a script out of these commands. This may look like this:
#!/bin/bash
irsend SET_TRANSMITTERS 1
irsend SEND_ONCE RM-S325 vol+
* Don't forget to make each scripts executable.
* and finally link the script to a button of your remote in ~/.lircrc using irexec
begin
remote = mceusb
prog = irexec
button = VolUp
config = /home/stefan/Desktop/louder.sh
repeat = 0
delay = 0
end
* That's it. After restarting lirc and irexec, check if your keypresses are transmitted correctly.
====== Links ======
===== Aontv related =====
http://osalliance.com/netculture/project/multimediahome/summary - osalliance - where I learned about mythtv+aontv\\
http://lab.netculture.at/wiki/doku.php?id=utopia:mythtv#myth_server_lab_dornbirn - net culture lab wiki - valuable infos\\
http://www.dieschmids.at/ - fantastic site for aon and aontv related topics\\
http://xdsl.at/viewtopic.php?f=59&t=46556 - windows solution for static routes of aontv and internet\\
http://www.aontv.org/ - aontv wiki, check out the forum\\
===== Mythtv =====
http://www.mythtv.org/wiki/XMLTV\\
~~DISCUSSION~~