diff src/madplug/plugin.c @ 1277:e7cd962732cb

file_name and file_path in a tuple should be unescaped.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Mon, 16 Jul 2007 16:16:41 +0900
parents 08f28756209c
children 1d3b02d1842b
line wrap: on
line diff
--- a/src/madplug/plugin.c	Mon Jul 16 00:24:09 2007 +0200
+++ b/src/madplug/plugin.c	Mon Jul 16 16:16:41 2007 +0900
@@ -601,6 +601,7 @@
 {
     TitleInput *tuple = NULL;
     gchar *string = NULL;
+    gchar *realfn = NULL;
 
     struct id3_file *id3file = NULL;
     struct id3_tag *tag = NULL;
@@ -635,9 +636,12 @@
             g_message("audmad_get_song_tuple: track_name = %s", tuple->track_name);
             g_message("audmad_get_song_tuple: stream_name = %s", tuple->album_name);
 #endif
-            tuple->file_name = g_path_get_basename(filename);
-            tuple->file_path = g_path_get_dirname(filename);
-            tuple->file_ext = extname(filename);
+            realfn = g_filename_from_uri(filename, NULL, NULL);
+            tuple->file_name = g_path_get_basename(realfn ? realfn : filename);
+            tuple->file_path = g_path_get_dirname(realfn ? realfn : filename);
+            tuple->file_ext = extname(realfn ? realfn : filename);
+            g_free(realfn); realfn = NULL;
+
             tuple->length = -1;
             tuple->mtime = 0; // this indicates streaming
 #ifdef DEBUG
@@ -676,10 +680,11 @@
                 g_free(string);
                 string = NULL;
             }
-
-            tuple->file_name = g_path_get_basename(filename);
-            tuple->file_path = g_path_get_dirname(filename);
-            tuple->file_ext = extname(filename);
+            realfn = g_filename_from_uri(filename, NULL, NULL);
+            tuple->file_name = g_path_get_basename(realfn ? realfn : filename);
+            tuple->file_path = g_path_get_dirname(realfn ? realfn : filename);
+            tuple->file_ext = extname(realfn ? realfn : filename);
+            g_free(realfn); realfn = NULL;
 
             // length
             tuple->length = -1;
@@ -720,9 +725,11 @@
         id3_file_close(id3file);
     }
     else { // no id3tag
-        tuple->file_name = g_path_get_basename(filename);
-        tuple->file_path = g_path_get_dirname(filename);
-        tuple->file_ext = extname(filename);
+        realfn = g_filename_from_uri(filename, NULL, NULL);
+        tuple->file_name = g_path_get_basename(realfn ? realfn : filename);
+        tuple->file_path = g_path_get_dirname(realfn ? realfn : filename);
+        tuple->file_ext = extname(realfn ? realfn : filename);
+        g_free(realfn); realfn = NULL;
         // length
         {
             char *dummy = NULL;