Podcast Tagging
I love writing little bitty programs that do so much for me. I use Happy Fish to manage my subscriptions to podcasts. The problem though is that podcasts are notoriously bad at tagging their files consitantly. This leads to a mess when I’m trying to find them on my mp3 player (creative zen). What I want is to be able to go to the genre “podcasts” then find a list of all the ones I have there then listen to the latest one. How come this is so hard? because no tags in a standard way. If you look at the happy fish blog in the next version he is going to add a way to address this but for now I created a simple ruby script that run nightly to do this for me. This script simply looks at every dowloaded podcast and assigns it a genre of podcasts then assigns the artist to the name of the podcast which happens to the be the name of the directory they reside in. It uses the excellent id3lib library to accomplish this. I have this in job that runs nightly so that my podcasts are always usable by my mp3 player
require 'find'
require 'fileutils'
require 'rubygems'
require 'id3lib'
basedir = 'D:\Audio\podcasts'
Find.find(basedir) do |path|
if FileTest.directory?(path)
next
else
lastdir, filename = File.split(path)
if File.extname(filename) == '.mp3'
tag = ID3Lib::Tag.new(path)
tag.genre = 'podcasts'
tag.artist = File.basename(lastdir)
tag.update!
end
end
end
results in
