X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;ds=sidebyside;f=merge_videos_by_day;h=3fdb42660bd16761e9802507a75557e47f81110a;hb=refs%2Fheads%2Fmaster;hp=193a7bdf32da50c262e3e686a0bab9df9f3621dd;hpb=aea4af9869a2086c5085afb34a1bd790940c8b7d;p=videoscripts%2F.git diff --git a/merge_videos_by_day b/merge_videos_by_day index 193a7bd..3fdb426 100755 --- a/merge_videos_by_day +++ b/merge_videos_by_day @@ -10,7 +10,8 @@ use Time::localtime; use DateTime::Format::Strptime qw( ); # Set our ffmpeg creation_time format -$ffmpeg_time_format = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%dT%H:%M:%S', time_zone => 'UTC', on_error => 'croak'); +$ffmpeg_time_format_utc = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%dT%H:%M:%S', time_zone => 'UTC', on_error => 'croak'); +$ffmpeg_time_format_local = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%dT%H:%M:%S', time_zone => 'local', on_error => 'croak'); $ctime_format = DateTime::Format::Strptime->new(pattern=>'%a %b %d %H:%M:%S %Y', time_zone => 'local', on_error => 'croak'); # Early command line options processing @@ -104,8 +105,12 @@ foreach $file (sort `$find_cmd`) { # Make a note of the month, year, and day this video was taken $creation_time = `$ffmpeg -i "$srcdir/$srcfile" 2>&1 | grep "creation_time" | head -n 1 | awk '{print \$3}'`; + $brands = `$ffmpeg -i "$srcdir/$srcfile" 2>&1 | grep "compatible_brands" | tail -n 1`; chomp($brands); if($creation_time) { - $date_taken = $ffmpeg_time_format->parse_datetime($creation_time); + $date_taken = $ffmpeg_time_format_utc->parse_datetime($creation_time); + if ($brands && $brands =~ /$local_tz_brands/) { + $date_taken = $ffmpeg_time_format_local->parse_datetime($creation_time); + } } else { # From the modification time of the file since we couldn't find it in the video file $date_modified = ctime(stat("$srcdir/$srcfile")->mtime);