1:
2:
3:
4:
6: use File::Basename;
8: my $skipNext = 0;
9: my $doRand = 0;
10: my $where = 0;
11: my $quiet = 0;
12: my @fileList;
14: foreach (@ARGV) {
15: if ($skipNext) { $skipNext = 0; $where++; next;}
17: if (/\.[Oo][Gg][Gg]$/) {
18: push ( @fileList, $_ );
19: }
20: elsif (/\.[Mm][Pp][23]$/) {
21: push ( @fileList, $_ );
22: }
23: elsif (/\.[Ww][Aa][Vv]$/) {
24: push ( @fileList, $_ );
25: }
26: elsif ($_ eq "-@") {
27: $path_to_list = dirname($ARGV[$where+1]);
28: open (LISTFILE, $ARGV[$where+1]) or die "Cannot open listfile: $ARGV[$where+1]";
29: while (<LISTFILE>)
30: {
31: chomp;
32: if ( /^#/ ) {
33: }
34: elsif ( /^\// ) {
35: push ( @fileList, $_ );
36: }
37: else {
38: my $curName = $path_to_list . "/" . $_;
39: push ( @fileList, $curName );
40: }
41: }
42: close LISTFILE;
43: $skipNext = 1;
44: }
45: elsif ($_ eq "-z") {
46: $doRand = 1;
47: }
48: elsif ($_ eq "-q") {
49: $quiet = 1;
50: }
51: else {
52:
53: }
54: $where++;
55: }
57: for (my $i = 0; $fileList[$i]; $i++ ) {
58: $fileList[$i] =~ s/\$/\\\$/g;
59: $fileList[$i] =~ s/\"/\\\"/g;
60: $fileList[$i] =~ s/\`/\\\`/g;
61: }
63: if ($doRand) {
64: srand;
65: @randList = ();
66: for (@fileList)
67: {
68: my $r = rand @randList+1;
69: push(@randList,$randList[$r]);
70: $randList[$r] = $_;
71: }
73: @fileList = @randList;
74: }
76: foreach (@fileList)
77: {
78: if (/\.[Oo][Gg][Gg]$/) {
79:
80: if ($quiet) {
81: print ( "Playing: $_\n" );
82: system ( "ogg123 -q \"$_\"" );
83: }
84: else {
85: system ( "ogg123 \"$_\"" );
86: }
87: sleep 1;
88: }
89: elsif (/\.[Mm][Pp][23]$/) {
90:
91: if ($quiet) {
92: print ( "Playing: $_\n" );
93: system ( "mpg123 -q \"$_\"" );
94: }
95: else {
96: system ( "mpg123 \"$_\"" );
97: }
98: sleep 1;
99: }
100: elsif (/\.[Ww][Aa][Vv]$/) {
101:
102: if ($quiet) {
103: print ( "Playing: $_\n" );
104: system ( "play --silent \"$_\"" );
105: }
106: else {
107: system ( "play \"$_\"" );
108: }
109: sleep 1;
110: }
111: else {
112: }
113: }