Changeset 27527


Ignore:
Timestamp:
2013-06-04T09:45:11+12:00 (11 years ago)
Author:
jmt12
Message:

Calling the isHDFS() in FileUtils rather than the non-existant one in utils

File:
1 edited

Legend:

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

    r27426 r27527  
    3333use MetadataRead;
    3434use util;
     35use FileUtils;
    3536
    3637use strict;
     
    156157  # to be run on it.
    157158  my $separate_io = $self->{'separateIO'};
    158   if (&util::isHDFS($file))
     159  if (&FileUtils::isHDFS($file))
    159160  {
    160161    $separate_io = 'true';
     
    166167  if ($separate_io eq 'true')
    167168  {
    168     $process_dir = &util::filename_cat('/tmp', 'gsimport-' . $filename);
    169     if (!&util::dir_exists($process_dir))
     169    $process_dir = &FileUtils::filenameConcatenate('/tmp', 'gsimport-' . $filename);
     170    if (!&FileUtils::directoryExists($process_dir))
    170171    {
    171172      mkdir($process_dir, 0775);
    172173    }
    173174  }
    174   my $logs_dir = &util::filename_cat($process_dir, "logs");
    175   if (!&util::dir_exists($logs_dir))
     175  my $logs_dir = &FileUtils::filenameConcatenate($process_dir, "logs");
     176  if (!&FileUtils::directoryExists($logs_dir))
    176177  {
    177178    mkdir($logs_dir, 0775);
    178179  }
    179   my $convert_log_path = &util::filename_cat($logs_dir, 'convert-' . $filename . '.log');
    180   my $pass_log_path = &util::filename_cat($logs_dir, 'convert-' . $filename . '-pass');
    181   my $tmp_dir = &util::filename_cat($process_dir, "cached");
    182   if (!&util::dir_exists($tmp_dir))
     180  my $convert_log_path = &FileUtils::filenameConcatenate($logs_dir, 'convert-' . $filename . '.log');
     181  my $pass_log_path = &FileUtils::filenameConcatenate($logs_dir, 'convert-' . $filename . '-pass');
     182  my $tmp_dir = &FileUtils::filenameConcatenate($process_dir, "cached");
     183  if (!&FileUtils::directoryExists($tmp_dir))
    183184  {
    184185    mkdir($tmp_dir, 0775);
    185186  }
    186   $tmp_dir = &util::filename_cat($tmp_dir, $filename);
    187   if (!&util::dir_exists($tmp_dir))
     187  $tmp_dir = &FileUtils::filenameConcatenate($tmp_dir, $filename);
     188  if (!&FileUtils::directoryExists($tmp_dir))
    188189  {
    189190    mkdir($tmp_dir, 0775);
     
    192193  # If we are separating IO, then we also start by copying the file to
    193194  # the process directory (local tmp) as well
    194   my $ivideo_path = &util::filename_cat($base_dir, $file);
     195  my $ivideo_path = $file;
     196  if (!&FileUtils::isFilenameAbsolute($file) && $base_dir ne '')
     197  {
     198    $ivideo_path = &FileUtils::filenameConcatenate($base_dir, $file);
     199  }
    195200  if ($separate_io eq 'true')
    196201  {
    197     print STDERR "[B1:" . time() . "] Creating local copy of file\n";
    198     my $local_ivideo_path = &util::filename_cat($process_dir, $filename . ".ts");
    199     &util::cp($ivideo_path, $local_ivideo_path);
     202    print STDERR "[B1:" . time() . "] Creating local copy of file: " . $ivideo_path . "\n";
     203    my $local_ivideo_path = &FileUtils::filenameConcatenate($process_dir, $filename . ".ts");
     204    &FileUtils::copyFiles($ivideo_path, $local_ivideo_path);
    200205    $ivideo_path = $local_ivideo_path;
    201206    print STDERR "[B2:" . time() . "] Complete\n";
     
    224229  # - generate a path for our temporary converted video file
    225230  print STDERR "[D1:" . time() . "] Converting video to streamble format\n";
    226   my $ovideo_path = &util::filename_cat($tmp_dir, 'gsv.mp4');
    227   if (&util::file_exists($ovideo_path))
     231  my $ovideo_path = &FileUtils::filenameConcatenate($tmp_dir, 'gsv.mp4');
     232  if (&FileUtils::fileExists($ovideo_path))
    228233  {
    229234    print " - Found existing converted video in cache\n";
     
    281286      `$cmd`;
    282287    }
    283     while ($attempt_count < 5 && !&util::file_exists($ovideo_path))
    284   }
    285   if (!&util::file_exists($ovideo_path))
     288    while ($attempt_count < 5 && !&FileUtils::fileExists($ovideo_path))
     289  }
     290  if (!&FileUtils::fileExists($ovideo_path))
    286291  {
    287292    die("Fatal Error! Failed to convert video: " . $ovideo_path . "\nReason:" . $! . "\n");
     
    291296  # 3. Extract keyframes using hive
    292297  print STDERR "[E1:" . time() . "] Extract keyframes\n";
    293   my $oshots_path = &util::filename_cat($tmp_dir, 'shots.xml');
    294   if (&util::file_exists($oshots_path))
     298  my $oshots_path = &FileUtils::filenameConcatenate($tmp_dir, 'shots.xml');
     299  if (&FileUtils::fileExists($oshots_path))
    295300  {
    296301    print " - Found existing keyframe images in cache\n";
     
    303308    `$cmd`;
    304309  }
    305   if (!&util::file_exists($oshots_path))
     310  if (!&FileUtils::fileExists($oshots_path))
    306311  {
    307312    die("Fatal Error! Failed to extract keyframe images: " . $oshots_path . "\nReason:" . $! . "\n");
     
    321326  foreach my $shot (sort @shots)
    322327  {
    323     my $shot_path = &util::filename_cat($tmp_dir, $shot);
     328    my $shot_path = &FileUtils::filenameConcatenate($tmp_dir, $shot);
    324329    if ($shot =~ /.jpg$/)
    325330    {
Note: See TracChangeset for help on using the changeset viewer.