Skip Menu |

This queue is for tickets about the album CPAN distribution.

Report information
The Basics
Id: 22165
Status: resolved
Priority: 0/
Queue: album

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Enable .mov and .avi support (with patch)
The attached patch introduces support for mov and avi files, as found on some cameras. Basically I just set the T_MPG type for all files ending with these suffixes. And while I was at it, I fixed a warning when --medium was not set. Regards, Slaven
Subject: album-mov.patch
# # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -up '../build/Album-1.03/script/album' 'Album-1.03/script/album' Index: ./script/album Prereq: 1.82 --- ./script/album Thu Sep 21 15:42:19 2006 +++ ./script/album Thu Oct 19 00:51:10 2006 @@ -89,7 +89,7 @@ use constant DEFAULTS => { info => my $TMPDIR = $ENV{TMPDIR} || $ENV{TEMP} || '/usr/tmp'; -my $suffixpat = qr{\.(?:jpe?g|png|gif|mpg)}i; +my $suffixpat = qr{\.(?:jpe?g|png|gif|mpg|mov|avi)}i; my %capfun = ('c' => \&c_caption, 'f' => \&f_caption, @@ -350,7 +350,10 @@ sub set_defaults { setopt("icon", DEFAULTS->{icon}); $medium = DEFAULTS->{mediumsize} if defined($medium) && !$medium || $mediumonly; - $medium = 0 if $medium < 0; + { + no warnings 'uninitialized'; + $medium = 0 if $medium < 0; + } # Caption values. setopt("caption", DEFAULTS->{( -s $info_file || $import_dir) ? @@ -468,7 +471,7 @@ sub load_info { $el->description($a) if $a; $el->tag($tag) if $tag; $el->_rotation($rotate) if defined($rotate); - if ( $file =~ /^(.+)\.mpg$/i ) { + if ( $file =~ /^(.+)\.(?:mpg|mov|avi)$/i ) { $el->type(T_MPG); $el->assoc_name($1."s.jpg"); # associates still image } @@ -609,7 +612,7 @@ sub load_info_journal { } $el->_rotation($rotate) if defined($rotate); - if ( $file =~ /^(.+)\.mpg$/i ) { + if ( $file =~ /^(.+)\.(?:mpg|mov|avi)$/i ) { $el->type(T_MPG); $el->assoc_name($1."s.jpg"); # associates still image } @@ -683,7 +686,7 @@ sub load_files { warn(d_large($f).": Changed to VOICE\n") if $verbose; } } - elsif ( $f =~ /^(.+)\.mpg$/ ) { + elsif ( $f =~ /^(.+)\.(?:mpg|mov|avi)$/i ) { $el->type(T_MPG); my $assoc = $1."s.jpg"; $el->assoc_name($assoc); @@ -714,7 +717,7 @@ sub load_import { } else { $el->type(T_JPG); - if ( $f =~ /^(.+)\.mpg$/i ) { + if ( $f =~ /^(.+)\.(?:mpg|mov|avi)$/i ) { $el->type(T_MPG); $el->assoc_name($1."s.jpg"); } #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Thu Oct 19 00:51:31 2006 # Generated by : makepatch 2.03 # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # p 'script/album' 87631 1161211870 0100755 #### End of ApplyPatch data #### #### End of Patch kit [created: Thu Oct 19 00:51:31 2006] #### #### Patch checksum: 96 3177 12188 #### #### Checksum: 114 3801 63724 ####
I see the new version accepts the new extensions. Unfortunately you are using "?-i" instead or "?i" in the regexps, so uppercase extensions are not recognized anymore. Also, AVIs and such are now copied using mencoder. This seems to create broken output with mencoder version 1.0pre7try2-3.4.4, or runs into an endless loop with version 1.0pre8-3.4.4. Maybe you should just copy the movies if no rotation is involved? I attached a patch which does both: fixing the regular expressions and prefer to just copy movies. Regards, Slaven
# # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -up '../build/Album-1.04/script/album' 'Album-1.04/script/album' Index: ./script/album Prereq: 1.84 --- ./script/album Fri Oct 20 16:46:56 2006 +++ ./script/album Fri Oct 20 21:02:18 2006 @@ -89,9 +89,9 @@ use constant DEFAULTS => { info => my $TMPDIR = $ENV{TMPDIR} || $ENV{TEMP} || '/usr/tmp'; -my $picpat = qr{(?-i:jpe?g|png|gif)}; -my $movpat = qr{(?-i:mpe?g|mov|avi)}; -my $xtrpat = qw{(?-i:html?)}; +my $picpat = qr{(?i:jpe?g|png|gif)}; +my $movpat = qr{(?i:mpe?g|mov|avi)}; +my $xtrpat = qw{(?i:html?)}; my $suffixpat = qr{\.$picpat|$movpat}; my $xsuffixpat = qr{\.$picpat|$movpat|$xtrpat}; @@ -2397,19 +2397,24 @@ sub copy { sub copy_mpg { my ($orig, $new, $time, $rotate, $mirror) = @_; - $time = (stat($orig))[9] unless defined($time); - - # I'm not sure what this does. The resultant file is about 10% of - # the original, without missing something... - my $cmd = "$prog_mencoder -of mpeg -oac copy -ovc ". - ($rotate ? "lavc -lavcopts vcodec=mpeg1video -vop rotate=".int($rotate/90)." " : "copy ") . - squote($orig) . " -o ". squote($new); - warn("\n+ $cmd\n") if $verbose > 2; - my $res = `$cmd 2>&1`; - die("${res}Aborted\n") if $?; + if ($rotate) { + $time = (stat($orig))[9] unless defined($time); - utime($time, $time, $new); + # I'm not sure what this does. The resultant file is about 10% of + # the original, without missing something... + my $cmd = "$prog_mencoder -of mpeg -oac copy -ovc ". + "lavc -lavcopts vcodec=mpeg1video -vop rotate=".int($rotate/90)." " . + squote($orig) . " -o ". squote($new); + warn("\n+ $cmd\n") if $verbose > 2; + + my $res = `$cmd 2>&1`; + die("${res}Aborted\n") if $?; + + utime($time, $time, $new); + } else { + copy ($orig, $new, $time); + } } sub still { #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Fri Oct 20 21:10:15 2006 # Generated by : makepatch 2.03 # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # p 'script/album' 88225 1161370938 0100755 #### End of ApplyPatch data #### #### End of Patch kit [created: Fri Oct 20 21:10:15 2006] #### #### Patch checksum: 88 3041 10811 #### #### Checksum: 106 3665 62329 ####
Subject: Re: [rt.cpan.org #22165] Enable .mov and .avi support (with patch)
Date: Fri, 20 Oct 2006 23:04:12 +0200
To: bug-album [...] rt.cpan.org
From: Johan Vromans <jvromans [...] squirrel.nl>
[Quoting Slaven_Rezic via RT, on October 20 2006, 15:21, in "[rt.cpan.org #22165]"] Show quoted text
> I see the new version accepts the new extensions. Unfortunately you are > using "?-i" instead or "?i" in the regexps, so uppercase extensions are > not recognized anymore.
Oops. That's a "last minute" slip of the keyboard. Thanks for finding this. Show quoted text
> Also, AVIs and such are now copied using mencoder. This seems to > create broken output with mencoder version 1.0pre7try2-3.4.4, or > runs into an endless loop with version 1.0pre8-3.4.4. Maybe you > should just copy the movies if no rotation is involved?
In the early days I ran into problems with the MPG files that were created by my camera. Running them through mencoder solved this. I'll rethink this issue. Thanks, Johan