1385
|
1 #!/usr/bin/perl -w
|
|
2 use strict;
|
|
3 # Filename: mp.pl
|
|
4 # Date : created 2001-07-24
|
|
5 # Author : Felix Buenemann <atmosfear at users.sourceforge.net>
|
|
6 # Idea by : David Chan <prometheus at theendofthetunnel.org>
|
|
7 # License : GNU General Public License (GPL)
|
|
8 # (refer to: http://www.fsf.org/licenses/gpl.txt)
|
|
9 #
|
|
10 # Description:
|
|
11 # Small Perl helper script that allows to play multiple files with MPlayer.
|
|
12 # Wildcards are supported (eg. "mp.pl -vo x11 /data/*.avi").
|
|
13 #
|
|
14 # Configuration:
|
|
15 # If MPlayer is not in your path, give the full
|
|
16 # path to mplayer binary in the line below.
|
|
17 # (example: "/usr/local/bin/mplayer")
|
|
18 use constant MPLAYER => "mplayer";
|
|
19
|
|
20 my (@parms, @files);
|
|
21
|
|
22 die
|
|
23 "mp.pl: No parameters given!
|
|
24
|
|
25 MPlayer multifile playback helper script 0.9
|
|
26 Copyleft 2001 by Felix Buenemann
|
|
27
|
|
28 Syntax: mp.pl <parameters> <files>
|
|
29
|
|
30 Where <parameters> are all possible commandline switches for mplayer and
|
|
31 <files> can be either a list of files, like file1 file2 file3 and/or a
|
|
32 wildcard definition, like *.avi.
|
|
33
|
|
34 Example: mp.pl -vo x11 /dvd/VIDEO_TS/VTS_05_*.VOB movie.asf
|
|
35 \n"
|
|
36 if ($#ARGV < 0) || ($ARGV[0] =~ m/^--*(h|help)/);
|
|
37
|
|
38 foreach (@ARGV) {
|
|
39 if(m/^-\w+/) { push @parms, $_ }
|
|
40 elsif(-f $_ && -r _ && -B _) { push @files, $_ }
|
|
41 else { push @parms, $_ }
|
|
42 }
|
|
43 die "No valid files to process!\n" unless @files;
|
|
44 foreach (@files) {
|
|
45 print "Invoking MPlayer for '$_'...\n";
|
|
46 system(MPLAYER, @parms, $_)
|
|
47 or die "Couldn't execute MPlayer: $!\n";
|
|
48 ($? >> 8) != 1
|
|
49 and die "Couldn't properly execute MPlayer, aborting!\n";
|
|
50 }
|
|
51 # EOF
|