RealPlayer Combing

The BBC has a wide range of programmes available in their archives, largely in RealPlayer format. I have written ‘realdump’, which will grab the data from one of these streams, and dump it to a WAV or AIFF file.

Firstly, I’d like to be able to dump it to MP3 or AAC, rather than have to convert them myself.

Secondly, I’d like to be able to grab any of the meta-data that comes with the track.

Thirdly, I’d like to make a script that combs through a site, grabbing all of the data.

Good to see, the ABC has some PodCasts, but not all of the types of programs I’m likely to want. Radio National seems to be doing a fair bit of it though.

Update: http://www.audiocoding.com/ has a CLI AAC encoder.

Rainlight OctaMED module.

Back in the old days (I’m talking 1993), I found an OctaMED module on Aminet, that I really liked, called Rainlight. Since then, I’ve often thought about this track, and today downloaded it again. Finding something that would play, and convert it well was a bit of a struggle. I tried SoundApp, but that would have clicking errors, so I had to look elsewhere. (I later found out these errors were due to it trying to upsample to 22kHz, 11 works okay.) I also tried CocoModX, which would only play the track too fast. I could change the tempo, but this song has tempo marks throughout it, and it kept speeding up again). Finally, I used Sound Trecker, which, like SoundApp, requires classic, but it worked (I was able to change the sample rate), and I was able to export it to AIFF, and then import this into iTunes. So, and important part of my computing/music heritage is now safe in my iTunes library. Yay Rainlight.

MusicMagic Mixer

Found what could be a useful tool today. Predixis MusicMagic Mixer According to the website,

The MusicMagic Mixer is the ultimate music library power tool to create dynamic and interesting playlists, or mixes. MusicMagic automatically analyzes your music collection. Analyzed songs are used to build custom mixes for hours of listening enjoyment.

Basically, it (apparently) looks for songs that are similar in some quality to the one(s) you choose. I don’t know how long it will take to index a 6000 track library, so that might be a nice test for it… I’ll download and test it out tonight.

iTunes "Now Playing" CSS

A while ago, I played around with my site StyleSheet, and set it up so that a paragraph of text with the class iTunes had a little icon placed next to it. This seems to have stopped working. Must look into it. Edit: I fixed it. Originally the code was:

1
2
3
4
    .itunes:before
    {
            content:url('/images/itunes.gif');
    }

I changed it to:

1
2
3
4
5
6
    .itunes
    {
    	background:url('/images/itunes.gif') no-repeat;
            text-indent:16px;
            font-size:0.8em;
    }

How long have you iTunes-d?

I like the bit that appears at the bottom of iTunes, telling you how much music you have in your collection (or in the current playlist). iTunes Library Size I thought it might be fun to see how much music I had listened to. As it turns out: 5883 songs, 17:13:27:05 total time. Here is the script I wrote to find it out.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    #! /usr/bin/env python
    
    import Foundation
    import os
    
    library =  os.path.expanduser('~/Music/iTunes/iTunes Music Library.xml')
    
    db = Foundation.NSDictionary.dictionaryWithContentsOfFile_(library)
    tracks = db[u'Tracks'].itervalues()
    
    timecount = 0
    playcount = 0
    
    for track in tracks:
        try:
            timecount = timecount + track[u'Play Count'] * track[u'Total Time']/1000
            playcount = playcount + track[u'Play Count']
        except KeyError:
            pass
    
    days, timecount = timecount / (60 * 60 * 24), timecount % (60 * 60 * 24)
    hours, timecount = timecount / (60 * 60), timecount % (60 * 60)
    minutes, seconds = timecount / 60, timecount % 60
    
    print '%i songs, %i:%02i:%02i:%02i total time' % (playcount, days, hours, minutes, seconds)

iTunes Library Checker 2.0

I’ve rewritten most of iTunes Library Checker to use some neater import code, it should also be a bit faster. Not quite complete yet, but close to the previous functionality.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    #! /usr/bin/env python
    
    import Foundation
    import os
    import struct
    
    library =  os.path.expanduser('~/Music/iTunes/iTunes Music Library.xml')
    db = Foundation.NSDictionary.dictionaryWithContentsOfFile_(library)
    libpath = Foundation.NSURL.URLWithString_(db[u'Music Folder']).path()
    
    tracks = db[u'Tracks'].itervalues()
    
    findstr = "find '"+libpath+"' -type f -not -name .aacgained -not -name ._* -not -name .DS_Store | sort"
    treedata = os.popen(findstr).readlines()
    
    missing = []
    other = []
    missing_files = []
    other_files = []
    surplus = treedata[:]
    
    for track in tracks:
        location = Foundation.NSURL.URLWithString_(track[u'Location']).path()
        if not os.path.exists(location):
            missing.append(track)
            missing_files.append(str(location))
        else:
            try:
                surplus.remove(str(location)+'\n')
            except ValueError:
                other.append(track)
                other_files.append(str(location))
        
    missing_files.sort()
    other_files.sort()
    surplus.sort()
    
    open('surplus.txt','w').writelines(surplus)
    open('missing.txt','w').writelines(missing_files)
    open('other.txt','w').writelines(other_files)

Simpler iTunes Library Checker

I posted some code exactly a month ago, then I find this. I will rewrite the code so it is simpler, using the MacOS hooks that come with PyObjC.

Deeper iTunes Data

I came across an interesting question today: Why doesn’t iTunes store all of the data about each time a song is played? And also, how much of the song was played? It should be easy to write a daemon that monitors iTunes, and writes this data to a database. This database can then be cross-referenced against the iTunes database for a comprehensive breakdown of when songs are played. You can then find all of the songs that you listen to at a certain time of day, or season, and so on. You can also have a ‘how-often-played’, but cross referencing the Date Added attribute with the Play Count and so on. I’ve already started to write this program, but it will likely be MacOS X only.

How Accurate is the iTunes Counter?

I got a comment to a post that had nothing to do with iTunes. Whilst it wasn’t a particularly helpful or nice comment, I thought maybe I can answer the question I think he’s asking. (Unless he’s talking about the iTunes Music Store counter that shows how many songs have been bought for the latest contest…). Wach time you finish playing a song, the Play Count field is incremented, and the Last Played date is updated. If you skip a song before listening to the entire track, neither of these are updated. There are some scripts around for MacOS AppleScript that will update a Play Count and Last Played if you listen to more than a certain amount of a track. I could also add the same feature to iTunes Rater. But I don’t really use Play Count and Last Played that often, anyway.

Chapter Tool GUI

Apparently, Apple has a new tool for adding Chapter information to AAC files, but it is CLI only. I’ll write a wrapper GUI for it tonight, since Jaq is away, and I don’t need to go to bed tonight. But first, Chicken & Chips.