Changeset 22441

Show
Ignore:
Timestamp:
19.07.2010 17:55:42 (10 years ago)
Author:
davidb
Message:

Placeholder code that printed out java command changed to actually call the command

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/music-ir/trunk/perllib/plugins/jSongMinerExtractor.pm

    r22439 r22441  
    7272    my $music_ir_home = $ENV{'GEXT_MUSICIR'}; 
    7373 
     74    $self->{'jmir_directory'} = &util::filename_cat($music_ir_home,"lib","java"); # Set the directory holding the jMIR .jar files 
     75 
    7476    return bless $self, $class; 
    7577} 
     
    102104    } 
    103105 
    104     my $jsongminer_cmd = "java -Xmx1024M -jar jSongMinor.jar $convert_options \"$id3_title\" \"$id3_artist\""; 
     106    my $jmir_directory = $self->{'jmir_directory'}; 
     107 
     108 
     109    my $store_cwd = cwd(); 
     110 
     111    if (!-d $jmir_directory) { 
     112    print STDERR "Error: Unable able to find directory '$jmir_directory'\n"; 
     113    print STDERR "       Cannot run jAudio\n"; 
     114    } 
     115    elsif (chdir($jmir_directory)) { 
     116 
     117 
     118    my $jsongminer_cmd = "java -Xmx1024M -jar jSongMiner.jar $convert_options"; 
     119    $jsongminer_cmd .= " -title \"$id3_title\""; 
     120    $jsongminer_cmd .= " -artist \"$id3_artist\""; 
     121    $jsongminer_cmd .= " -file \"$source_file_path\""; 
     122     
     123    if ($verbosity>2) { 
     124        print $outhandle "jSongMinerExtractor: Running ...\n"; 
     125        print $outhandle "jSongMinerExtractor:   $jsongminer_cmd\n"; 
     126    } 
     127     
     128    my $print_info = { 'message_prefix' => "jSongMiner", 
     129               'message' => "Retrieving audio metadata for $source_file_no_path" }; 
     130     
     131    my ($regenerated,$result,$had_error)  
     132        = $self->autorun_general_cmd($jsongminer_cmd,$source_file_path,$target_file_path,$print_info); 
     133     
     134    if ($verbosity>2) { 
     135        print $outhandle "jSongMinerExtractor: ...done\n"; 
     136    } 
     137    } 
     138    else { 
     139    print STDERR "Error: failed to change directory to '$jmir_directory'\n"; 
     140    print STDERR "       Cannot run jAudio\n"; 
     141    } 
     142 
     143    chdir($store_cwd); 
     144 
    105145         
    106     print STDERR "*** cmd: $jsongminer_cmd\n"; 
    107  
    108     my $print_info = { 'message_prefix' => "jSongMiner", 
    109                'message' => "Retrieving audio metadata for $source_file_no_path" }; 
    110      
    111 #    my ($regenerated,$result,$had_error)  
    112 #   = $self->autorun_general_cmd($jsongminer_cmd,$source_file_path,$target_file_path,$print_info); 
    113      
    114146    return ($target_file_path); 
    115147}