Changeset 26276


Ignore:
Timestamp:
2012-10-02T05:43:31+13:00 (9 years ago)
Author:
davidb
Message:

Some mods that resulted from testing under Cygwin

Location:
gs2-extensions/music-ir-src/trunk/perllib/plugins
Files:
4 edited

Legend:

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

    r24433 r26276  
    107107
    108108
    109 # do plugin specific processing of doc_obj
    110 sub process {
     109
     110sub process_features {
    111111    my $self = shift (@_);
    112     my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
     112    my ($base_dir, $file, $doc_obj) = @_;
    113113
    114114    my $outhandle = $self->{'outhandle'};
     
    132132    }
    133133
     134}
     135
     136# do plugin specific processing of doc_obj
     137sub process {
     138    my $self = shift (@_);
     139    my ($pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
     140
     141    my $top_section = $doc_obj->get_top_section();
     142
     143    $self->process_features($base_dir,$file,$doc_obj);
    134144   
    135145    #we have no text - adds dummy text and NoText metadata
    136146    $self->add_dummy_text($doc_obj, $doc_obj->get_top_section());
    137147
     148    my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file);
    138149    $doc_obj->associate_file($filename_full_path, "audio.mp3", "audio/mpeg", $top_section);
    139150
     
    151162    if ($self->{'retrieve_mir_metadata'} eq "true") {
    152163    my $top_section = $doc_obj->get_top_section();
     164
    153165    my $id3_titles = $doc_obj->get_metadata($top_section,"ex.ID3.Title");
    154 
    155     my $id3_title = shift @$id3_titles || "Unknown";
     166    # my $id3_title = shift @$id3_titles || "Unknown";
     167    my $id3_title = shift @$id3_titles || undef;
    156168
    157169    my $id3_artists = $doc_obj->get_metadata($top_section,"ex.ID3.Artist");
    158     my $id3_artist = shift @$id3_artists || "Unkown";
     170    # my $id3_artist = shift @$id3_artists || "Unknown";
     171    my $id3_artist = shift @$id3_artists || undef;
    159172
    160173    my ($metadata_acexml_filename,$metadata_txt_filename)
  • gs2-extensions/music-ir-src/trunk/perllib/plugins/jAudioExtractor.pm

    r22439 r26276  
    102102    my $music_ir_home = $ENV{'GEXT_MUSICIR'};
    103103
    104     $self->{'ace_xml_output_directory'} = &util::filename_cat($gsdl_home,"tmp"); # Set the directory to save the the ACE XML output files in
     104    my $ace_xml_output_directory = &util::filename_cat($gsdl_home,"tmp"); # Set the directory to save the the ACE XML output files in
     105    if (!util::dir_exists($ace_xml_output_directory)) {
     106    util::mk_dir($ace_xml_output_directory);
     107    }
     108    $self->{'ace_xml_output_directory'} = $ace_xml_output_directory;
     109
    105110    $self->{'jmir_directory'} = &util::filename_cat($music_ir_home,"lib","java"); # Set the directory holding the jMIR .jar files
     111
    106112
    107113
     
    137143
    138144    # Set the input file name in the file tag in the temporary file
     145    if ($^O eq "cygwin") {
     146    $input_music_file_path = `cygpath -m "$input_music_file_path"`;
     147    $input_music_file_path=~ s/\s+$//;
     148    }
    139149    $batch_file_contents =~ s/<file><\/file>/<file>$input_music_file_path<\/file>/;
    140150
    141151    # Set the feature vales save path in the temporary file
     152    if ($^O eq "cygwin") {
     153    $feature_descriptions_file_path = `cygpath -m "$feature_descriptions_file_path"`;
     154    $feature_descriptions_file_path=~ s/\s+$//;
     155    }
     156
    142157    $batch_file_contents =~ s/<destination><\/destination>/<destination>$feature_descriptions_file_path<\/destination>/;
    143158
    144159    # Set the feature vales save path in the temporary file
     160    if ($^O eq "cygwin") {
     161    $feature_values_file_path = `cygpath -m "$feature_values_file_path"`;
     162    $feature_values_file_path=~ s/\s+$//;
     163    }
    145164    $batch_file_contents =~ s/<destination><\/destination>/<destination>$feature_values_file_path<\/destination>/;
    146165
     
    228247   
    229248    # Input and Output files to use are stored in the batch_file
    230     my $jaudio_cmd = "java -Xmx1024M -jar jAudio.jar $convert_options -b \"$batch_file_path\"";
     249    my $batch_file_path_os = $batch_file_path;
     250
     251    if ($^O eq "cygwin") {
     252        $batch_file_path_os = `cygpath -w "$batch_file_path"`;
     253        $batch_file_path_os =~ s/\s+$//;
     254    }
     255
     256    my $jaudio_cmd = "java -Xmx1024M -jar jAudio.jar $convert_options -b \"$batch_file_path_os\"";
    231257       
    232258    # Test the execution path
  • gs2-extensions/music-ir-src/trunk/perllib/plugins/jSongMinerExtractor.pm

    r24432 r26276  
    176176    elsif (chdir($jmir_directory)) {
    177177
     178    my $source_file_path_os = $source_file_path;
     179    if ($^O eq "cygwin") {
     180        $source_file_path_os = `cygpath -w "$source_file_path"`;
     181        $source_file_path_os =~ s/\s+$//;
     182    }
     183    my $target_txt_file_path_os = $target_txt_file_path;
     184    if ($^O eq "cygwin") {
     185        $target_txt_file_path_os = `cygpath -w "$target_txt_file_path"`;
     186        $target_txt_file_path_os =~ s/\s+$//;
     187    }
     188    my $target_acexml_file_path_os = $target_acexml_file_path;
     189    if ($^O eq "cygwin") {
     190        $target_acexml_file_path_os = `cygpath -w "$target_acexml_file_path"`;
     191        $target_acexml_file_path_os =~ s/\s+$//;
     192    }
    178193
    179194    my $jsongminer_cmd = "java -Xmx1024M -jar jSongMiner.jar $convert_options";
    180     $jsongminer_cmd .= " -title \"$id3_title\"";
    181     $jsongminer_cmd .= " -artist \"$id3_artist\"";
    182     $jsongminer_cmd .= " -audio \"$source_file_path\"";
    183     $jsongminer_cmd .= " -savetxtfile \"$target_txt_file_path\"";
    184     $jsongminer_cmd .= " -saveacexmlfile \"$target_acexml_file_path\"";
     195    $jsongminer_cmd .= " -title \"$id3_title\"" if defined $id3_title;
     196    $jsongminer_cmd .= " -artist \"$id3_artist\"" if defined $id3_artist;
     197    $jsongminer_cmd .= " -audio \"$source_file_path_os\"";
     198    $jsongminer_cmd .= " -savetxtfile \"$target_txt_file_path_os\"";
     199    $jsongminer_cmd .= " -saveacexmlfile \"$target_acexml_file_path_os\"";
    185200   
    186201    if ($verbosity>2) {
  • gs2-extensions/music-ir-src/trunk/perllib/plugins/jSongMinerMetadata.pm

    r22439 r26276  
    228228   
    229229    # Input and Output files to use are stored in the batch_file
    230     my $jaudio_cmd = "java -Xmx1024M -jar jAudio.jar $convert_options -b \"$batch_file_path\"";
     230    my $batch_file_path_os = $batch_file_path;
     231
     232    if ($^O eq "cygwin") {
     233        $batch_file_path_os = `cygpath -w "$batch_file_path"`;
     234        $batch_file_path_os =~ s/\s+$//;
     235    }
     236
     237    my $jaudio_cmd = "java -Xmx1024M -jar jAudio.jar $convert_options -b \"$batch_file_path_os\"";
    231238       
    232239    # Test the execution path
Note: See TracChangeset for help on using the changeset viewer.