Archive for the ‘linux’ Category

Dishing up videos

Continuing my line of posts about my home media setup, I come to the main reason for putting myself through all this pain – being able to watch my selection of movies and TV shows with (next to) zero effort required.

I’ve posted before about the merits of XBMC, an open-source project to create a digital media hub that is accessible to all. I’ve not had anything better recommended since, so I’m still using this as my main 10-foot UI on my new TV, running off the Mac Mini I bought 18 months ago to start doing some iPhone development work. I didn’t really appreciate the iOS SDK, but the Mac Mini makes a fantastic media centre PC! The box is pretty much silent, the Apple Remote is pretty intuitive for getting around XBMC and similar interfaces, and they’re available on eBay for pretty reasonable prices. I may get fed up of Apple one day and revert to a custom built media box, but for now, the Mini will do!

I’ll post at some point in the future about how I actually store my files (it’s all about to change anyway, I’m running out of space!) but the stuff I’m using for downloading and sorting downloads is pretty neat if I do say so myself! A caveat at this point – I’m not publicly condoning the below, I obey the law when it comes to content – so should you!

First up – iPlayer. This part is only applicable in the UK (currently), so feel free to skip this paragraph if you’re viewing from overseas. There is a fantastic package available called get_iplayer that allows you to set a list of desired programmes, and then run a cron script to download them. For instance, the following will install the package, and add Have I Got News For You to your PVR.


$ sudo apt-get install get-iplayer
$ get-iplayer --pvradd "HIGNFY" "Have I Got News For You"

You’ll then need to add get-iplayer to your crontab (using crontab -e or similar) and fire it off every so often:


0 * * * * /usr/bin/get_iplayer --pvr --modes flashhd,flashvhigh,flashhigh --output /home/matt/DownloadComplete/

Will schedule get-iplayer to run every hour, on the hour, and attempt to download your content in HD, then descend through quality if necessary, and output the files to /home/matt/DownloadComplete/ (change as appropriate).

Next up, fetching non-UK TV shows. There is a fantastic website called ShowRSS that lets you build custom RSS feeds of popular (and unpopular, they cover 267 shows at the time of writing) TV show torrents, which can then be used by most good torrent software to automagically add torrents as they become available. One very good way of achieving this downloading of torrents is Flexget (again, available in Ubuntu and other systems with a simple apt-get install flexget), which is a package for parsing the data returned from feeds such as ShowRSS, and performing the necessary logic to download the actual .torrent file. Once again, we need to add Flexget to our crontab, set to run hourly (in a slightly fancier way!)


@hourly /usr/local/bin/flexget --cron

Flexget uses a configuration file to determine what to do each time it’s run, which can be found in ~/.flexget/config.yml. As you may notice, it uses YAML (pronounced like camel) to store the preferences. YAML confused the hell out of me initially, but it’s all in the spacing! An example of my (truncated) config.yml is below.

feeds:
  tv-shows:
    rss: http://showrss.karmorra.info/rss.php?user_id=[REMOVED]&hd=null&proper=null
    series:
      - ncis
      - ncis:la
      - family guy:
          min_quality: hdtv
      - futurama
    download: ~/watch/

As you can see, this uses the tv-shows rss plugin to get my ShowRSS feed, then scans for the series listed (I believe you can do a catch-all rather than repeating the list), and then downloads the files into ~/watch/ – this will be useful in a minute. You can view Flexgets status on individual series using the following:

$ flexget --series
 Name                          Latest              Status
-------------------------------------------------------------------------------
 Ncis                          S09E11 - 14d 20h    *hdtv
 Ncis:La                       S03E11 - 14d 20h    *hdtv
 Futurama                      S06E26 - 109d 12h   *hdtv
 Family Guy                    S10E09 - 16d 21h    *hdtv
-------------------------------------------------------------------------------

Amazing! Now we’ve got our files downloaded and going into ~/watch/ automatically. Now, to actually download them…

For my torrenting needs, I use rTorrent (again, packages available for Ubuntu in the repositories), which runs quite nicely in a detached screen downloading my files for me! rTorrent uses a file called ~/.rtorrent.rc for its settings, an example exert from mine:


schedule = watch_directory,5,5,load_start=./watch/*.torrent
schedule = untied_directory,5,5,stop_untied=
directory = ./Download/
system.method.set_key = event.download.finished,move_complete,"execute=mv,-u,$d.get_base_path=,~/DownloadComplete/;d.set_directory=~/DownloadComplete/"

dht=on
dht_port=6881
peer_exchange=yes
port_range = 7000-7500

This makes rTorrent keep an eye on the ~/watch directory for any files with the .torrent extension, and will add them to the active downloads if a new one is discovered, and remove any that are deleted. All torrents are downloaded into ~/Download/, but moved to ~/DownloadComplete/ when finished, for reasons that will be evident soon. DHT is enabled, and rTorrent will choose a random port between 7000 and 7500 on load.

So that’s all of our media downloading (you can add music/movies manually, or do some other clever scripts – I have an IRC bot that I’ll blog about in future do it for me!), but how do we sort that off into the right places for XMBC to find? It would be terribly inelegant just to make XBMC look in ~/DownloadComplete for it’s files… Well, that’s a question for a future post!!

Dishing up music

I’ve been meaning for a long time to continue my line of posts about my home media set up. Anyone who vaguely knows me (or stalks this blog) will know that I recently moved down to London, into a flat I can (sort of) call my own, so for the first time I’ve been able to play about with AV equipment in my way!

In this first post, I’m going to talk a bit about how I’m currently using the set up to serve my music collection around the flat, to work, and to my phone for on-the-go listening. It’s worth noting at this point that everything here relies on an old machine running Ubuntu server that’s currently sat in my cupboard, a solution that won’t work for everyone…

I’ve mentioned previously that I was looking into using DAAP to get at my music. This ended pretty quickly when I realised the clients available for listening are fairly crap. The actual configuration is fiddly, and I was after a nice functional GUI to access my music through. DAAP failed at pretty much all of this, so I went in search of another solution. After trying many different software packages (commercial and otherwise), I struck upon Subsonic, which seemed at first glance to do everything I was after. Essentially, it requires a server (available for all platforms) with access to your music collection, and will then spit the content back out to its own web UI (accessible through a personal URL if you’re not like me and running some kind of dynamic DNS service) plus it has a number of native players available for different platforms (including mobile). Best of all – it’s free! They withhold some features until you’ve given a small donation, but it’s entirely usable as a free package!

The web UI is basic, but skinnable (I’m still working with the basic skin – works well), and gives you access at a glance to all your artists, albums and playlists (although I’ve not done much with playlists yet, that part does seem a bit tricky). This UI also lets you play with the ID3 tags on your music, including the grabbing of album artwork off the internet, so if you’re as OCD as me about music tagging, your needs are well catered for! Within the web application your play queue appears at the bottom, with the current playing song in a lovely flash player. From the main window you can add things onto the end of the play queue, or change the playing song entirely. It’s basic, but functional, and if you want anything more advanced there are a number of native players available for all operating systems.

What interested me most was the quality of the iOS native applications. I’ve tried all of the ones recommended on Subsonics App page, and a couple that are in the app store but not endorsed officially, but I have now struck upon iSub as a favourite. It allows the caching of songs on your phone for playback when no data signal is available (although you have to have played the song for it to be cached – I’d like a feature where you could pre-cache songs to the phone), plus it integrates nicely with the iOS player API (play/pause whilst locked etc).

One other massive bonus was my discovery of a XMBC plugin for Subsonic (XMBC is what I use to browse media on my TV, as I’ve mentioned previously, more in a future post). This lets me listen to songs through my TV in the flat without having to bother turning a computer on – a massive bonus, and much more sociable if you have company!

The only downside of Subsonic is the reliance on a stable internet connection to an always-on music server. There are commercially hosted solutions available, but since I already had a machine running 24/7, and have recently splashed out on Virgin Media’s 30Mb fibre connection, it made sense to run the package from home.

So there it is – a whole-hearted recommendation for Subsonic (they’re honestly not paying me for this!) and it’s associated other applications. Tune in soon for a peek into the world of my TV/Movie system!

Dishing up media

As my latest project for ‘what to do when incredibly bored in the evening’ is to find a way of creating a central server for all of my media (starting with music, the rest is pretty easy) and then being able to play it off any device, preferably with some kind of specialised app for iPhone that would let me download tracks and playlists for local playback. If anyone has undertaken a similar project, I’d love to hear about it!

So – the task list so far:

  • Stable running media server
  • Automatic feed-in of new content (from download server – will blog about that one some other time!)
  • Automatic tagging (ID3 etc) of new content (this may be a step too far!)
  • Playlist viewing/editing
  • Access over the network
  • Access over the internet
  • Access from the iPhone (including local playback)
  • Front end media player (using XBMC or similar) for video/picture

Sounds like another one of those pipe-dreams, but I’m off to a pretty good start it seems! I’ve struck upon using some sort of DAAP server (currently running forked-daapd, will probably end up with the original daapd as it seems a bit more stable) off a dedicated test machine (so I don’t bork up my other running server, I’ve got plenty of old machines lying around the house at the moment!) which can then be connected to anywhere off the internal network, and some simple port forwarding should sort that for the wider world.

The only gripe at the moment is the lack of playlist support – the DAAP protocol isn’t designed to have anything to do with playlist editing, and that’s a pretty major feature I want to have! I may end up with some kind of web interface to the server that’ll let me edit playlists directly – not ideal, but I guess it’ll do the trick.

I’m currently struggling with the iPhone access part – I’ve found a single DAAP client (Simple DAAP Client), but that doesn’t support any caching, and is very basic (but free). I may have to resort back to some kind of manual syncing to get the iPod functionality, which would be a shame, but not an insurmountable problem.

The automatic tagging is definitely a big problem – what I’m envisaging at the moment is a daemon running on the server that uses Musicbrainz or something similar to update ID3 tags on MP3s as they are added on to the server, however such a thing may be slightly beyond the realms of possibility at the moment unfortunately. One day maybe…

I’ll try and keep this post up to date with my progress, but it’s likely to be slow work as my entire ‘server farm’ is being uprooted and moved to London in a few weeks. Flat hunting later this week, better make sure it’s got plenty of cupboard space for all these machines!

Linux Adventure #2: Networking

Well, we all know that the main uses of a computer are:

  • MSN
  • Wikipedia
  • Porn

All of which require the internet. So obviously, my new Linux box (mLinux – I’ll explain some other time) must be connected to the internet! "No problem", thought I, "I’ll slap in that USB dongle I got ages ago and never use!"

So in went the Belkin Wireless G Adaptor (F5D7050), and up popped the "dysonHub" network! Score! Not quite…

Enter the password, and Ubuntu will connect fine, but absolutely nothing happens. No internet = no MSN, Wikipedia or Porn! Damn!

The adventure must be halted at this point – I must have internet to continue!

Linux Adventure #1: Installation

Step number one in my adventure on the road down Linux Lane went surprisingly easy!

Slapped in the shiny new Ubuntu 7.10 disk, and installed it with no problems. Probably is a good point to mention that the PC I’m using is an old machine with a 20.5Gb HDD that was liberated from a local primary school when they chucked it out. What a waste!

Anyway, the only error I got was the lack of internet connection for a system update, and something about commenting a line in a file :S Didn’t really understand that, I’m more of a GUI guy if I’m honest!

Next came the peripherals… Mouse and keyboard worked (obviously), and then I realised I only have 2 USB ports on the computer! Enter my trusty old Belkin Hub, which worked out of the box (read: dusty cupboard) and gladly accepted the mouse, my pen drive and the USB Network Card (discussed later)

Everything working so far, played a few games… everything’s hunky-dory!

Until the time came to start on t’internet…

One man and a Linux distro

Here beginneth my journey with Ubuntu 7.10, my voyage of discovery into the world of Linux!

You may remember from previous posts that I have dabbled in the ‘dark arts’ before, but this time I’m going for it hard and strong!

First task… installing the damn thing!

How do you say it?

Just thought earlier, I have no clue how people actually say “Linux”. I pronounce it “Leenux”, but a load of people say “Lienux”.

How do you say it?