Sharing iTunes Songs

I finally got around to downloading the 10.3.4 OS X update, SharePoints, and Xbox Media Centre (XBMC). My aim for some time has been to share my iTunes library to my Xbox, which is connected up to the TV and Stereo in the lounge.

The MacOS X update provided (apparently) updated Samba sharing, but I still couldn’t get XMP (Xbox Media Player - the previous incarnation of XBMC) to connect to the SMB share I had set up, with all of my MP3s on it. SharePoints fixed that - all I had to do was create a publicly available share.

Setting up XBMC was a breeze, and it even has a cool interface! UnleashX is (almost) banished from my system, and XBMC is my main Dash.

Then I discovered that XCMC can play AAC files! So, I started (and have not yet finished) converting all of my MP3s to AAC. And not just converting, but re-importing, at a bitrate of 128 (small file size, but apparently equivalent to 256 in MP3). See this hint for some tips (and my comments).

I also wanted to re-jig how I had set up sharing my iTunes songs between users - I had a couple of links to the relevant files in each user’s ~/Music/iTunes, and all files were located in ~shared/Music (which all of admin can RW, and all of the world can R). I needed to have seperate Library files, so that we can have our own ratings (I hate Abba, and she isn’t that big a fan of Paul Kelly, for instance). So, I knocked up a script that scanned the ~shared/Music folder and compared any files found to the iTunes LIbrary. If they weren’t in it, it added them.

Here we go:

 1set _tracks to “”
 2tell application iTunes
 3    set sel to tracks of playlist 1
 4    set sel to get a reference to selection
 5    repeat with t in sel
 6        set _tracks to _tracks & 
 7 & (location of t as string)
 8    end repeat
 9end tell
11tell application Finder
12    set _files to “”
13    set _library to Macintosh HD:Users:Shared:Music
14    set _artists to folders of folder _library
15    repeat with _artist in _artists
16        set _albums to folders of _artist
17        repeat with _album in _albums
18            set temp to files of _album
19            repeat with _file in temp
20                set _files to _files & 
21 & _file
22            end repeat
23        end repeat
24    end repeat
25end tell
26set _missing to “”
27repeat with para in paragraphs of _files
28    set para to para as string
29    if para is not in _tracks then
30        set _missing to _missing & 
31 & para
32    end if
33end repeat
35tell application iTunes
36    repeat with para in paragraphs of _missing
37        set para to para as string
38        if para is not “” then
39            set _file to para
40            add _file
41        end if
42    end repeat
43end tell

Which worked, but was a bit slow. So I came up with the following system instead:

Create a file called ~/.last_check

Enter the following into a script, and then run it. (I’ve had to modify some lines to get it to look good - particularly the fp=os.popen… line).

 1#! /usr/bin/env python 
 2# Check for songs newer than ~/.last_check, and add them to iTunes
 4import os
 5import sys
 7fp = os.popen(
 8"find ~shared/Music -name *.m?? -newer ~/.last_check")
10data = fp.readlines()
12if len(data) == 0:
13    print "No New Songs."
14    sys.exit(0)
16for line in data:
17    filename = "Macintosh HD"+line[:-1]
18    filename = filename.replace("/",":")
19    print "Adding", filename
20    os.system('''osascript < <END
21tell application "iTunes"
22add "'''+filename+'''"
23end tell

Should be pretty quick - I only tested it with a few files, but seems to work okay. iTunes is even smart enough to not re-add files that are already there (I think!), so it won’t add duplicates!

My library lives in ~shared/Music, yours may vary!

You will, however, need to use something like Super Remove Dead Tracks if you update one library with a new encoder!

I accept no responsibility if it screws up your iTunes Library file!

Choose My Music

Just surfing around, I found this site. Some guy has set up his computer so that you can choose songs to cue up on his system. I might just have to try something similar with my Xbox…

Tiger DVD Burning

Something is either wrong with Tiger’s Finder DVD burning, or Xbox Media Centre’s DVD reading. Any DVDs I burn from a Burn Folder in Tiger will not work properly on the Xbox. The disc name is reported fine by Xbmc, and the first track will play if the disc is inserted (and autoplay is turned on), but no tracks are reported as being there by the browser. Toast-burned DVDs work fine, and all burned DVDs work on the iMac itself, or on a PC. Very frustrating in that I don’t do this often enough to remember, so I keep having to re-burn discs so I can watch them on the Xbox. I can’t wait to finish the house and have my home network all hooked up again. Having to burn a movie back to CD/DVD just to watch it is very frustrating… (All of my DVDs are packed away in storage, and I cannot be bothered opening up boxes to try and find the one I’m looking for).

New Apple Kit

So, Apple has released a couple of new bits and pieces. I’m not going to mention the Apple iPhone, as it is unlikely to be available where I live, and the other two are a bit more interesting for me. The first one I noticed was the Apple TV. This is an AU$449 device that hooks up to (only widescreen) televisions, and allows you to watch video, view pictures and listen to audio that is stored on your Mac or PC. Which is exactly what I currently use XboxMediaCentre for. However, from a couple of things I’ve read on the Apple website, I won’t be getting one soon. I think it acts like an iPod, and requires syncing. This because that ‘s’ word is mentioned, and because it also talks about ‘up to 8750 songs,’ and since it has a 40GB hard drive, that sounds about how many tracks you could store on it. I don’t store any media on the Xbox - it’s all stored on a seperate media server. Why waste space by having duplicates of large files? It gets even worse if you look at Movies and TV programs. It may stream movies, I do recall seeing that somewhere. Plus, I may have to re-encode some video files, as AppleTV might not play everything, like VLC and XBMC do. The other feature that I think is missing is recording from TV. This makes it a deal-breaker for me. That’s the only functionality I don’t have with XBMC, and is the reason I’m going to consider getting a Mac Mini to replace it. If Apple don’t come up with something better. Admittedly, it looks much nicer than an Xbox, but it won’t play all of my Xbox games, either. Resolution-wise, the Apple TV might be a step ahead of the Xbox. I’m not sure what resolution XBMC can output, it may be 1080i, I’m not sure. (Note: after research, you can output this res with even a standard Xbox, but you need to get a special hi-res cable). • The other product Apple released is somewhat interesting. Airport Extreme. Basically, it’s an 802.11a/b/g/n wireless router. It has a couple of other key features, however. It also has a USB port, but it’s not a device-side port. Instead, it allows Hard Disk drives, Printers and the like to be plugged in. This would mean that the one device could replace (and upgrade!) my router, and my NSLU2 file server. The bonus is that it can easily handle multiple hard drives, unlike the NSLU2, which I’m probably going to have to install a different OS onto to get this functionality. At AU$259, (IIRC: $229 educational), it appears pricey, but replaces a NAS device, Print Server, and a wireless router. And beefs up the speed to 802.11n, which is 10x faster than my current router. Disadvantages of this over my current setup? I currently use my NSLU2 as a torrent client, and this functionality is unlikely to be built into the Airport Extreme! • What’s next? I’m hoping to see what happens when some real users get their hands on these devices. I’d suggest they might be running a cut-down OSX, or perhaps Linux/BSD or something, in which case they should be eminently hackable. For instance, it might be possible to use the AppleTV hardware, plug in an EyeTV, and bingo, PVR. Much cheaper than a Mac Mini, but with all of the desired functionality. And, turn off Syncing of iTunes library, and instead just look for files on a Server, and stream audio as well as video. As for Airport Extreme, it’s likely that this is a less powerful beast, but might provide better performance than my old NSLU2, which chugs along a bit when trying to grab more than one torrent at a time. (Don’t mention that you should queue torrents, this is for low-rate torrents, and the software I use doesn’t queue).

xbmc download details

Note to self: here are the FTP details for xbmc downloading… Host = Port = 21 Username = xbins Password = homebrew