Я начну.
Оригинальный и давольно редкий скрипт для переиминования mp3 в по их тэгам
Код:
use strict; my ($d) = @ARGV; $d = './' unless $d; my @l= (); die unless opendir(my $h, $d); foreach(readdir $h) { next if /^\.+$/; push @l, $_ if /\.mp3$/i; } closedir $h; my $c = 0; foreach my $f (@l) { next unless open my $h, "<$d/$f"; binmode $h; read $h, my $t, 3; my($a,$n) = ('',''); if($t eq 'ID3') { read $h, $t, 1000; if($t =~ /TIT2...(.)...(.*)/s) { $n = substr $2, 0, -1+ord $1; } if($t =~ /TPE1...(.)...(.*)/s) { $a = substr $2, 0, -1+ord $1; } } else { seek $h, -128, 2; read $h, $t, 3; if($t eq 'TAG') { read $h, $t, 128; ($n,$a) = unpack "a30a30", $t; } } close $h; $n =~ s/[\0\s\r\n]+$//s; $a =~ s/[\0\s\r\n]+$//s; next if $a eq ''; next if $n eq ''; my $r = "$a - $n"; $r =~ s/http:\/\///ig; $r =~ s/[\0-\39]//g; $r =~ s/[\\\/\:\*\?\"\<\>\|]/_/g; while($r =~ /\s\s/) { $r =~ s/\s\s/ /; } my $s = $r; $s =~ tr/\300-\377\260\261/\200-\257\340-\357\360\361/; printf "%s\n", $s; $r .= '.mp3'; next if $r eq $f; while(-e "$d/$r") { $r =~ s/\.mp3$/_\.mp3/; } if(rename "$d/$f", "$d/$r") { $c++; } else { print "$f $!\n"; } } printf "renamed %d of %d\n", $c, scalar @l;