Changeset 34411
- Timestamp:
- 2020-09-17T17:59:53+12:00 (4 years ago)
- Location:
- gs3-extensions/mars-src/trunk/perllib/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/mars-src/trunk/perllib/plugins/EssentiaPlugin.pm
r34360 r34411 135 135 $mime_type, $top_section); 136 136 137 # HPCP 138 my $hpcp_features_filename = $self->compute_hpcp_features($filename_full_path); 139 my ($hpcp_features_ext) = ($hpcp_features_filename =~ m/\.([^.]+)$/); 140 141 my $hpcp_mime_type = ($hpcp_features_ext eq "json") ? "application/json" : "text/plain"; 142 $doc_obj->associate_file($hpcp_features_filename, "hpcp.$features_ext", 143 $hpcp_mime_type, $top_section); 144 145 146 137 147 } 138 148 -
gs3-extensions/mars-src/trunk/perllib/plugins/pEssentiaExtractor.pm
r34360 r34411 279 279 return ($target_file_path); 280 280 } 281 282 283 sub compute_hpcp_features 284 { 285 my $self = shift(@_); 286 my $source_file_path = shift(@_); 287 my $convert_options = shift(@_) || ""; 288 289 my $outhandle = $self->{'outhandle'}; 290 my $verbosity = $self->{'verbosity'}; 291 292 my $source_file_no_path = &File::Basename::basename($source_file_path); 293 294 # print STDERR "******* Essentia: source_file_path = $source_file_path\n\n\n"; 295 296 $self->init_cache_for_file($source_file_path); 297 298 # Determine the full name and path of the output file 299 my $target_file_path; 300 my $feature_values_file_path; 301 my $feature_descriptions_file_path; 302 303 my $target_file_type="json"; 304 305 if ($self->{'enable_cache'}) { 306 my $cached_dir = $self->{'cached_dir'}; 307 my $file_root = $self->{'cached_file_root'}; 308 309 my $target_file = "$file_root-hpcp.$target_file_type"; 310 311 $target_file_path = &util::filename_cat($cached_dir,$target_file); 312 } 313 else { 314 $target_file_path = &util::get_tmp_filename($target_file_type); 315 } 316 317 my $essentia_output_directory = $self->{'essentia_output_directory'}; 318 319 my $hpcp_cmd = "essentia-hpcp.py $convert_options \"$source_file_path\" \"$target_file_path\""; 320 321 # Test the execution path 322 print("EXECUTION CMD: $hpcp_cmd\n"); 323 324 my $print_info = { 'message_prefix' => "HPCP", 325 'message' => "Extracting HPCP audio features from $source_file_no_path" }; 326 327 my ($regenerated,$result,$had_error) 328 = $self->autorun_general_cmd($hpcp_cmd,$source_file_path,$target_file_path,$print_info); 329 330 331 return ($target_file_path); 332 } 281 333 282 334
Note:
See TracChangeset
for help on using the changeset viewer.