#!/usr/bin/perl -swl # pudge@pobox.com 2001.03.13 # convert artist names to pig latin: run only once, else you get # double-pig-latin or something # use -remove tag to remove ID3v2 tags (we don't edit those, and they # will continue to have the old name in them) # this script can be considered VERY DANGEROUS; it will # change your MP3 data, and if you use -remove, delete large chunks # of it # this script won't change the filenames; gotta do that yourself use File::Find; use MP3::Info; use strict; use vars '$remove'; find(sub { return unless -f $_; get_mp3info($_) or return; my $tag = get_mp3tag($_); print $tag->{ARTIST}; print my $artist = igpay($tag->{ARTIST}); if ($artist ne "") { $tag->{ARTIST} = $artist; set_mp3tag($_, $tag); } remove_mp3tag($_, 2) if $remove; }, @ARGV); # from http://language.perl.com/ppt/src/pig/pig.feinberg # Dr. Bronner's top secret pig-latin algorithm! # ALL-ONE! ALL-ONE! ALL-ONE! sub igpay { local $_ = shift; my $ordway; my $initcaps = /^[A-Z]/; my $allcaps = /^[A-Z]+$/; if (/^[aeiou]/i) { $ordway = $_ . ($allcaps ? 'WAY' : 'way'); } else { /([^aieou]+)(.*)/i; $ordway = ($2 || '') . lcfirst $1 . 'ay'; $ordway = ucfirst $ordway if $initcaps; $ordway = uc $ordway if $allcaps; } return $ordway; } __END__