Index: /gs2-extensions/music-ir/trunk/perllib/plugins/MusicIRPlugin.pm
===================================================================
--- /gs2-extensions/music-ir/trunk/perllib/plugins/MusicIRPlugin.pm	(revision 22467)
+++ /gs2-extensions/music-ir/trunk/perllib/plugins/MusicIRPlugin.pm	(revision 22468)
@@ -156,5 +156,12 @@
 	my $id3_artist = shift @$id3_artists || "Unkown";
 
-	my $metadata_txt_filename = $self->retrieve_metadata($filename_full_path,$id3_title,$id3_artist);
+	my ($metadata_acexml_filename,$metadata_txt_filename) 
+	    = $self->retrieve_metadata($filename_full_path,$id3_title,$id3_artist);
+	
+	if (-e $metadata_txt_filename) {
+	    $self->parse_txt_metadata($doc_obj,$metadata_txt_filename);
+	}
+
+
     }
 
Index: /gs2-extensions/music-ir/trunk/perllib/plugins/jSongMinerExtractor.pm
===================================================================
--- /gs2-extensions/music-ir/trunk/perllib/plugins/jSongMinerExtractor.pm	(revision 22467)
+++ /gs2-extensions/music-ir/trunk/perllib/plugins/jSongMinerExtractor.pm	(revision 22468)
@@ -31,4 +31,5 @@
 
 use Cwd;
+use URI::Escape;
 
 use strict;
@@ -77,4 +78,57 @@
 }
 
+sub urlEncode{
+	# ARG 1: $to_encode is the string to URL encode
+	my ($to_encode) = @_;
+	return uri_escape($to_encode);
+}
+
+# URL Decode the given string
+sub urlDecode{
+	# ARG 1: $to_decode is the string to URL decode
+	my ($to_decode) = @_;
+	return uri_unescape($to_decode);
+}
+
+sub parse_txt_metadata
+{
+    my $self = shift @_;
+    my ($doc_obj,$target_txt_file_path) = @_;
+
+    if (open(MIN,"<$target_txt_file_path")) {
+
+	my ($md_name, $md_value);
+
+	while (defined($md_name=<MIN>) && defined($md_value=<MIN>)) {
+
+	    chomp $md_name;
+	    chomp $md_value;
+
+	    my $top_section=$doc_obj->get_top_section();
+
+	    $md_name =~ s/\+//g;
+	    $md_value =~ s/\+//g;
+	    
+	    $md_name = urlDecode($md_name);
+	    $md_value = urlDecode($md_value);
+
+	    # $md_name =~ s/\s+//g;
+	    $md_name =~ s/\(.*?\)$//;
+	    $md_name =~ s/Last\.FM/LastFM/g;
+	    $md_name =~ s/:/^/g;
+	    $md_name =~ s/(API)?\^/./;
+
+	    $doc_obj->add_metadata($top_section,$md_name,$md_value);
+	}
+
+	close(MIN);
+    }
+    else {
+	print STDERR "Error: Failed to open $target_txt_file_path\n";
+	print STDERR "       !$\n";
+    }
+}
+
+
 sub retrieve_metadata
 {
@@ -91,15 +145,20 @@
     $self->init_cache_for_file($source_file_path);
 
-    my $target_file_path;
+    my $target_txt_file_path;
+    my $target_acexml_file_path;
+
     if ($self->{'enable_cache'}) {
 	my $cached_dir = $self->{'cached_dir'};
 	my $file_root = $self->{'cached_file_root'};
 
-	my $target_file = "${file_root}_metadata.txt";
-
-	$target_file_path = &util::filename_cat($cached_dir,$target_file);
+	my $target_txt_file = "${file_root}_metadata.txt";
+	my $target_acexml_file = "${file_root}.xml";
+
+	$target_txt_file_path = &util::filename_cat($cached_dir,$target_txt_file);
+	$target_acexml_file_path = &util::filename_cat($cached_dir,$target_acexml_file);
     }
     else {
-	$target_file_path = &util::get_tmp_filename("_metadata.txt");
+	$target_txt_file_path = &util::get_tmp_filename("_metadata.txt");
+	$target_acexml_file_path = &util::get_tmp_filename(".xml");
     }
 
@@ -119,5 +178,7 @@
 	$jsongminer_cmd .= " -title \"$id3_title\"";
 	$jsongminer_cmd .= " -artist \"$id3_artist\"";
-	$jsongminer_cmd .= " -file \"$source_file_path\"";
+	$jsongminer_cmd .= " -audio \"$source_file_path\"";
+	$jsongminer_cmd .= " -savefile \"$target_txt_file_path\"";
+##	$jsongminer_cmd .= " -saveacefile \"$target_acexml_file_path\"";
 	
 	if ($verbosity>2) {
@@ -127,8 +188,8 @@
 	
 	my $print_info = { 'message_prefix' => "jSongMiner",
-			   'message' => "Retrieving audio metadata for $source_file_no_path" };
+			   'message' => "jSongMinerExtractor: Retrieving audio metadata for $source_file_no_path" };
 	
 	my ($regenerated,$result,$had_error) 
-	    = $self->autorun_general_cmd($jsongminer_cmd,$source_file_path,$target_file_path,$print_info);
+	    = $self->autorun_general_cmd($jsongminer_cmd,$source_file_path,$target_txt_file_path,$print_info);
 	
 	if ($verbosity>2) {
@@ -143,6 +204,5 @@
     chdir($store_cwd);
 
-		
-    return ($target_file_path);
+    return ($target_acexml_file_path,$target_txt_file_path);
 }
     
