Only load Time from StartTime if it has a value. Parse Path to get LInkPath if no Time.

pull/2077/head
Isaac Connor 2018-01-22 11:09:35 -05:00
parent bfa0a00e67
commit 493a2386c4
1 changed files with 12 additions and 4 deletions

View File

@ -90,9 +90,10 @@ sub Time {
$_[0]{Time} = $_[1]; $_[0]{Time} = $_[1];
} }
if ( ! defined $_[0]{Time} ) { if ( ! defined $_[0]{Time} ) {
if ( $_[0]{StartTime} ) {
$_[0]{Time} = Date::Parse::str2time( $_[0]{StartTime} ); $_[0]{Time} = Date::Parse::str2time( $_[0]{StartTime} );
} }
}
return $_[0]{Time}; return $_[0]{Time};
} }
@ -230,8 +231,15 @@ sub LinkPath {
), ),
'.'.$$event{Id} '.'.$$event{Id}
); );
} elsif ( $$event{Path} ) {
if ( ( $$event{Path} =~ /^(\d+\/\d{4}\/\d{2}\/\d{2})/ ) ) {
$$event{LinkPath} = $1.'/.'.$$event{Id};
} else { } else {
Error("Event $$event{Id} has no value for Time(), unable to determine link path"); Error("Unable to get LinkPath from Path for $$event{Id} $$event{Path}");
$$event{LinkPath} = '';
}
} else {
Error("Event $$event{Id} $$event{Path} has no value for Time(), unable to determine link path");
$$event{LinkPath} = ''; $$event{LinkPath} = '';
} }
} # end if Scheme } # end if Scheme
@ -243,7 +251,7 @@ sub LinkPath {
sub GenerateVideo { sub GenerateVideo {
my ( $self, $rate, $fps, $scale, $size, $overwrite, $format ) = @_; my ( $self, $rate, $fps, $scale, $size, $overwrite, $format ) = @_;
my $event_path = $self->getPath( ); my $event_path = $self->Path( );
chdir( $event_path ); chdir( $event_path );
( my $video_name = $self->{Name} ) =~ s/\s/_/g; ( my $video_name = $self->{Name} ) =~ s/\s/_/g;