From c09e86f38b1473aaf9a683885bef49cae98d0499 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Thu, 15 Oct 2009 14:25:54 +0200 Subject: [PATCH] invoke mplayer.pl with directory or movie file This will create www/ symlinks also --- bin/mplayer.pl | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/bin/mplayer.pl b/bin/mplayer.pl index f711757..9b0a358 100755 --- a/bin/mplayer.pl +++ b/bin/mplayer.pl @@ -15,7 +15,25 @@ use Imager; my $movie = shift @ARGV || 'www/media/video.ogv'; -# || die "usage: $0 path/to/movie.ogv\n"; +# || die "usage: $0 media/conference-lecture_name/video.ogv\n"; + +my $base_dir = $1 if $movie =~ m{^(.+)/[^/]+$}; + +if ( -d $movie && $movie =~ m{media/} ) { + $base_dir = $movie; + $movie .= '/video.ogv'; +} elsif ( -f $movie && $movie !~ m{video\.ogv} ) { + my $movie_master = $movie; + $movie = "$base_dir/video.ogv"; + symlink $movie_master, $movie unless -e $movie; +} + +die "$movie $! - make symlink or specify path full path to video.ogv" unless -e $movie; + +unlink 'www/media'; + +symlink $base_dir, 'www/media'; +warn "# base_dir $base_dir\n"; my $edl = "/dev/shm/edl"; my $subtitles = $movie; -- 2.20.1