Skip to content

Instantly share code, notes, and snippets.

@lucaspiller
Created October 24, 2010 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucaspiller/643342 to your computer and use it in GitHub Desktop.
Save lucaspiller/643342 to your computer and use it in GitHub Desktop.
Set ID3 tags from filename
require 'rubygems'
require 'id3lib'
file=ARGV.join
filename=File.basename(file, '.mp3')
parts = filename.split('-')
artist = parts[1].strip
title = parts[2].strip
puts artist + " - " + title
track = ID3Lib::Tag.new(file)
track.title = title
track.artist = artist
track.update!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment