Madison gets WiFi HTML is not statically typed. It scales ok?
Oct 24

Pruning past iTunes podcast content

Ruby, Tech Add comments

I keep running across the same feature that I wish I had in my applications. As someone who subsribes to a lot of content, I really need to be able to cap the amount in some feeds.

E.g. I want to say “This planet feeds gets a ton of traffic, so just keep a rolling max of 100 so I don’t turn around and see it full with 4000 entries”

This problem is even more important when subscribing to content such as pod/vidcasts. Before I look around, my hard drive is screaming about my podcast directory.

Since iTunes didn’t seem to help me out, I ended up writing a tiny Ruby script that would allow me to nuke any content longer than X weeks. This is far from perfect, as I would like to set it up on a podcast basis. Some podcasts I like to keep around. Others, I don’t really care about, and I only listen to when on long trips and I have exhausted the rest :)

The bulk of the script is simply:

Find.find(PODCAST_DIRECTORY) do |path|
if FileTest.file?(path) && older_than_given_weeks?(path)
puts "Deleting '#{path}' which had the mod time of '#{File.mtime(path)}'"
File.delete(path)
end
end

iTunes, aggregators, please let me setup queue maximums :)

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'ajax'