Get SomeHardware
Get a decent mid-sized system with an NVidia card featuring the kind of TV-out you need, a lot of disk space, and a decent amount of RAM. You could go used on the equipment, but I wanted the disks to be fast, so that meant SATA II. Here's what I put together.- An Intel 82801-based motherboard with gigabit Ethernet and ICH7 audio.
- NVidia GForce 8400GS with s-video (I have a low-def, 21" TV).
- Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz
- 1GB RAM
- one 500GB SATA II drive, a 320GB SATA II drive (old movies), and two 250GB SATA II drives (one is an external with old TV).
Install Mythbuntu 8.04.1
This part is pretty straightforward. We're using the LTS because we want this thing to last for years and not have to be screwed with again.Use the standard CD, not the Alternate install disk because the alternate disk won't set things up in the same way and you'll need to do some extra work at the end. Follow the directions on the install and set up the NVidia card with the Mythbuntu tool. Install the modules you want to be using. Make sure to have Videos and Mythweb. Set everything to autologin.
The mount points for my disks look like this:
- 250GB on /
- 500GB on /var/lib/mythtv/recordings
- 250GB of old TV on /var/lib/mythtv/recordings/OldTV
- 320GB of old movies on /var/lib/mythtv/videos/OldMovies
Through SSH, add the Launchpad PAA for Mythbuntu to /etc/apt/source.list in order keep up with the current version of MythTV and get some modules that aren't in Hardy
## Mythbuntu PPAMake sure to update and upgrade when you finish adding the repository.
deb http://ppa.launchpad.net/mythbuntu-testing/ubuntu hardy main
Import your movie collection
You need to install a way to automatically add and look up any videos you add to the system so that you don't have to muck about in the Video Manager.sudo aptitude install mythvideo-bulk-updaterThis will install a cron script which checks for new videos hourly. If you can't wait that long, you can run the Perl script manually the first time.
/usr/share/mythvideo-bulk-updater/mythvideo-bulk-updater.pyMake sure to run the script as the user MythTV logs in as.
Import your TV collection
Steven Adeff was nice enough to write a Perl program which parses a filename, scrapes RageTV, and inserts data into the MythTV database for us. We're goign to use it.Go to http://www.jobs-khakis-chicks.com/MythTV/TVRageImport/ and download the newest version (0.7 right now). There's also a script that uses tv.com, but I haven't tried it. You might run both in parallel to get shows that are on one site but not the other. Save the file to your home directory and set it to be executable with
chmod +x ragetvgrab-0.7.plRun the following commands
cd /var/lib/mythtv/recordingsYou should repeat this command with *.mkv instead of *.avi if you have any old files in that format.
find . -name '*.avi' -type f -exec /home/user/ragetvgrab-0.7.pl -import -lv {} \;
NOTE! You must be in the recordings directory when this command is run or you will have a bunch of listed shows which return "File not found" when you try to play them.
Set up RTorrent to get some new shows
Next, we need a BitTorrent client. I have chosen RTorrent because it is lightweight (I want to watch shows with no skipping) and powerful. It doesn't have a web interface, which some others do. Feel free to replace this with another one if you want. Don't bitch at me about my choice, though, eh?sudo aptitude install rtorrentNext, we need to create a configuration file and some temporary directories for the torrents.
cd ~We want to ask RTorrent to do several jobs it doesn't do by default
mkdir Torrents
cp /usr/share/doc/rtorrent/examples/rtorrent.rc ./
Watch the directory for new files
We will be automatically downloading the .torrent files, so we want RTorrent to keep an eye out for them and stop seeding if the torrent files get deleted. Look for this section in ~/.rtorrent.rc, uncomment the following lines and edit the directory to match this.
# Watch a directory for new torrents, and stop those that have beenAutomatically move completed torrents to recordings
# deleted.
schedule = watch_directory,5,5,load_start=./Torrents/TV/EZTV/*
schedule = untied_directory,5,5,stop_untied=
We don't want incomplete files in the recordings directory (for obvious reasons), but we also want to be able to watch while it's still seeding. We need to move while seeding. Let's edit ~/.rtorrent.rc again and add:
# Check hash for finished torrents. Might be usefull until the bug isStop the torrent after seeding
# fixed that causes lack of diskspace not to be properly reported.
#check_hash = no
on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,/var/lib/mythtv/recordings/ ;d.set_directory=/var/lib/mythtv/recordings/"
In order to do this, we need to uncomment and edit the following line:
# example: stop at ratio 1.5 with at least 200 MB uploaded, or else ratio 20.0Stop the torrent after a certain date
schedule = ratio,60,60,"stop_on_ratio=150,200M,2000"
Here we get complicated. RTorrent doesn't have the functionality to stop seeding after a certain time, but we can use the watched directory, find and cron to stop the torrent after a few days. Type
crontab -eand add
55 21 * * * find /home/user/Torrents/TV/EZTV -mtime +2 -type f -exec rm {} \;I run the screen command to get a terminal in SSH that I can disconnect from and run rtorrent inside that because I like to monitor RTorrent every few days, but you could also set RTorrent to run automatically on login. No matter the case, you need to make sure that RTorrent is running as the user the Mythbuntu logs in as.
Set up Podget to bring in the feeds
Now we need to automatically get torrent files for new TV shows and put them in RTorrent's watch directory. I'm going to use Podget because it's designed to download attachments from RSS feeds and can be easily cronned.sudo aptitude install podget
Next, we need to find the RSS feeds for various TV shows. I'll leave that up to you. Podget doesn't handle strange URL characters well, so you'll want to make a tinyurl from them. We need to add these URLs to .podget/serverlist. The following line will put torrent files for every television show on TVRSS.net to the watched directory:
http://tvrss.net/feed/unique/ TV EZTVThe last two parts of the line are the category and subcategory. It's the reason that our .rtorrentrc file includes "load_start=./Torrents/TV/EZTV/" instead of something else. In this setup, all your feeds should be in the same subcategory.
NOTE: We could give our feeds different categories or subcategories and set up RTorrent to move finished torrents from different categories into different final directories and create a nice, ordered structure by, say, program name. I didn't do that, though.Finally, we need to call Podget using cron. You can do it once a day or more, depending on how many programs and feeds you have going. If you have individual feeds, you'll only need to do the cron job once a day. I have a single, busy feed, so I check several times a day. Again,
crontab -eand add
50 15 * * * podget -l Torrents/
Add the shows to the database using RageTV
We now have the torrent files being downloaded by Podget, RTorrent handling the downloading of the shows, the shows being moved to our recordings directory, and the seeding stopping after a few days. Sadly, when we open MythTV, there are still no new programs to watch. We need to import the new programs using RageTVGrab and the -mtime switch of the find command. Againcrontab -ethen add
35 21 * * * cd /var/lib/mythtv/recordings && find . -name '*.avi' \Or you could create a more complicated script and call that instead. As I mentioned in the other section on importing your old TV programs, you need to make sure that you are in base recordings directory when running the script.
-mtime -1 -type f -exec /home/user/ragetvgrab-0.7.pl -import -lv {} \;
DAAP server
Mythbuntu automatically shares several folders using Samba, including /var/lib/mythtv/music, so we should use this to share music with our network. Why not, eh? Let's install Firefly Media Server and configure it.sudo aptitude install mt-daapd
Then we need to log in to the web interface (or manually edit the config file, and tell the server to look into the music directory. In order for the server to work correctly, we need to set the permissions for the folder.
chgrp mt-daapd /var/lib/mythtv/musicand we need to make sure Samba keeps the group permissions for the directory. Edit /etc/smba/smb.conf
[music]
comment = Music
path = /var/lib/mythtv/music
public = yes
writable = yes
create mask = 0660
directory mask = 0770
force user = mythtv
force group = mt-daapd
So you use this primarily for watching TV shows that you've downloaded? Not shows that you've recorded?
ReplyDeleteI don't even HAVE TV to the house because I'm living in Korea and don't really speak the language. It just handles shows via BT. I wanted an easier solution, but nothing that I tried actually worked OOTB.
ReplyDelete