Changeset 27529

Show
Ignore:
Timestamp:
04.06.2013 11:07:21 (6 years ago)
Author:
jmt12
Message:

Fixing a bug (HDFS drivers not being recognized due to sometimes being relative) and some tidy up stuff

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/video-and-audio/trunk/src/perllib/plugins/SimpleVideoPlugin.pm

    r27527 r27529  
    133133  my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_; 
    134134 
     135  if (!&FileUtils::isFilenameAbsolute($file) && $base_dir ne '') 
     136  { 
     137    $file = &FileUtils::filenameConcatenate($base_dir, $file); 
     138  } 
     139 
    135140  print STDERR "[A:" . time() . "] SimpleVideoPlugin processing: " . $file . "\n"; 
    136141 
     
    161166    $separate_io = 'true'; 
    162167  } 
     168  ###rint STDERR "[DEBUG] separate_io:" . $separate_io . "\n"; 
    163169 
    164170  my $process_dir = $ENV{'GSDLCOLLECTDIR'}; 
     
    206212    print STDERR "[B2:" . time() . "] Complete\n"; 
    207213  } 
     214  else 
     215  { 
     216    print "Not gonna work!\n"; 
     217    exit; 
     218  } 
    208219 
    209220  # 1. Use MediaInfo to extract important metadata 
     
    212223  my $mi_metadata = $self->getMetadata($ivideo_path); 
    213224  $doc_obj->add_utf8_metadata($topsection,"Format", 'multimedia (' . $mi_metadata->{'General'}->{'Format'} . ')'); 
    214   $doc_obj->set_metadata_element($topsection,"FileSize",$mi_metadata->{'General'}->{'File_size'}); 
     225  if (defined $mi_metadata->{'General'}->{'File_size'}) 
     226  { 
     227    $doc_obj->set_metadata_element($topsection, "FileSize", $mi_metadata->{'General'}->{'File_size'}); 
     228  } 
     229  else 
     230  { 
     231    $doc_obj->set_metadata_element($topsection, "FileSize", &FileUtils::fileSize($ivideo_path)); 
     232  } 
    215233  $doc_obj->add_utf8_metadata($topsection,"Duration",$mi_metadata->{'General'}->{'Duration'}); 
    216234  if (defined $mi_metadata->{'Video'}->{'Format_Info'} && defined $mi_metadata->{'Video'}->{'Format'}) 
     
    283301    { 
    284302      $attempt_count++; 
    285       print "[DEBUG: Video conversion attempt #" . $attempt_count . ": |" . $cmd . "|]\n"; 
     303      ###rint "[DEBUG: Video conversion attempt #" . $attempt_count . ": |" . $cmd . "|]\n"; 
    286304      `$cmd`; 
    287305    } 
     
    349367  my ($self, $ivideo_path) = @_; 
    350368  my $cmd = 'mediainfo --Output=XML "' . $ivideo_path . '" 2>&1'; 
    351   ###print "Cmd: " . $cmd . "\n"; 
     369  ###rint "[DEBUG] command: " . $cmd . "\n"; 
    352370  my $metadata_xml = `$cmd`; 
     371  ###rint "[DEBUG] result: " . $metadata_xml . "\n\n"; 
    353372  my @lines = split(/\r?\n/, $metadata_xml); 
    354373  my $metadata = {'Unknown'=>{}};