fillplayer.pl
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
fillplayer.pl [2006/11/08 11:55] – old revision restored andi | fillplayer.pl [2006/11/13 13:32] (current) – old revision restored andi | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== fillplayer.pl ====== | ||
+ | This Script takes random mp3 files from '' | ||
+ | |||
+ | <code perl> | ||
+ | # | ||
+ | |||
+ | my $MAXSIZE=3*1024*1024*1024; | ||
+ | my $MP3LIB="/ | ||
+ | my $OUTDIR="/ | ||
+ | |||
+ | use File:: | ||
+ | use File::Copy; | ||
+ | |||
+ | $|=1; | ||
+ | print " | ||
+ | my @LIST = & | ||
+ | print "found $#LIST files.\n"; | ||
+ | |||
+ | print " | ||
+ | system(" | ||
+ | print " | ||
+ | |||
+ | print " | ||
+ | my $s = 0; | ||
+ | while ($s < $MAXSIZE){ | ||
+ | my $file = splice(@LIST, | ||
+ | $s += -s " | ||
+ | mkdirp(" | ||
+ | copy(" | ||
+ | print " | ||
+ | } | ||
+ | print " | ||
+ | |||
+ | sub getlist($$){ | ||
+ | my $path = $_[0]; | ||
+ | my $base = $_[1]; | ||
+ | |||
+ | opendir(DIR," | ||
+ | my @files = readdir(DIR); | ||
+ | closedir(DIR); | ||
+ | my @list; | ||
+ | foreach my $file (@files){ | ||
+ | next if($file =~ /^\./); | ||
+ | my $full = " | ||
+ | if(-d " | ||
+ | push(@list,& | ||
+ | }elsif($file =~ /\.mp3/i){ | ||
+ | push(@list, | ||
+ | } | ||
+ | } | ||
+ | return @list | ||
+ | } | ||
+ | |||
+ | sub dbg(){ | ||
+ | unless ($QUIET){ | ||
+ | print STDERR @_; | ||
+ | print STDERR " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | sub mkdirp(){ | ||
+ | my $dir = shift(); | ||
+ | my @parts = split('/', | ||
+ | my $path = ''; | ||
+ | foreach my $part (@parts){ | ||
+ | $path .= "/ | ||
+ | unless(-d $path){ | ||
+ | my $ok = mkdir($path); | ||
+ | return $ok unless($ok); | ||
+ | } | ||
+ | } | ||
+ | return 1; | ||
+ | } | ||
+ | </ |
fillplayer.pl.txt · Last modified: 2006/11/13 13:32 by andi