quote: Originally posted by ice.skillz
Is there a way to make a playlist. Without having to put every file as "favorite". Maybe by editting the "audall.m3u" or "audfav.m3u" we can achieve this? A mp3 player isn't complete without having to make your own playlist. I just want to know if this is possible on the current 442.
I wrote a perl script that would take the audall.m3u, randomize it and rewrite it as the audfav.m3u, that at least gives me a "shuffle all songs" playback.
In the m3u file they use, each MP3 takes 2 lines, the first being the name of the song and the second being the path to the song. I am not sure if this is a standard m3u file.
I have the script saved as random_m3u.pl, and I run:
random_m3u.pl audall.m3u > audfav.m3u
#!/usr/bin/perl
use strict;
use warnings;
my @list;
while (<>) {
my $comment = $_;
my $file = <>;
#print $file, "-",$comment, "\n";
push @list, {
comment => $comment,
file => $file,
};
}
fisher_yates_shuffle(\@list);
foreach (@list) {
print $_->{'comment'}, $_->{'file'};
}
# fisher_yates_shuffle( \@array ) : generate a random permutation
# of @array in place
# from perlfaq4
# http://perldoc.perl.org/perlfaq4.html
sub fisher_yates_shuffle {
my $array = shift;
my $i;
for ($i = @$array; --$i; ) {
my $j = int rand ($i+1);
next if $i == $j;
@$array[$i,$j] = @$array[$j,$i];
}
}
l8rZ |