Rather than an 'early' adopter, I prefer to think of myself as an 'absent-minded' adopter. That said, I've just switched to WinAmp3 and along the way solved a small problem with a short perl script. WinAmp (3 and before...) keeps its bookmarks in a text file called 'Winamp.bm'. Something like:
\\HSM1000\MP3\Clancy Brothers.m3u Clancy Brothers \\HSM1000\MP3\David Massengill.m3u David Massengill \\HSM1000\MP3\Eileen McGann.m3u Eileen McGann . . . http://211.58.56.250:8700 [R]Blues On Air http://205.188.234.38:8040 [R]CelticGrove http://64.246.34.89:8060 [R]Dogtown Saloon http://216.237.145.19:8810
Pretty clear, URL followed by name, line by line. Trouble is the list grows like topsy and it becomes hard to find what you are looking for in an unordered list. No problem! This:
#!/usr/bin/perl # SortBM.pl -- sort WinAmp Bookmark file. use strict; use warnings; use diagnostics; my %list; my $url = ''; while (<>) { chomp; if ($url) { $list{$_}=$url; $url = ''; } else { $url = $_; } } if ($url) { $list{$_}=$url; } for (sort keys %list) { print "$list{$_}\n$_\n"; }
does the trick quite nicely. Note that I've annotated my soundcast URLs with 'R' so that they sort but do so seperately.

--hsm

"Never try to teach a pig to sing...it wastes your time and it annoys the pig."

Replies are listed 'Best First'.
Re: WinAmp, Bookmarks and Implicate Order
by halley (Prior) on May 14, 2003 at 19:30 UTC

    Nice script for a quick job.

    Where did you find the soundcast URLs? Are they streaming mp3? The SLIMP3 perl server can stream from those, but I haven't found many valid (free) sources yet.

    --
    [ e d @ h a l l e y . c c ]

Re: WinAmp, Bookmarks and Implicate Order
by Aristotle (Chancellor) on May 21, 2003 at 13:16 UTC
    So long as you can be sure there's always pairs of lines, there's no need to be that verbose and longwinded.
    #!/usr/bin/perl -wl use strict; my %bookmark; while (<>) { my $name = <>; $url{$name} = $_; } for (sort keys %bookmark) { print $bookmark{$_}; print $_; }

    Makeshifts last the longest.