changeset 2241:a5c96af75300

make use of aud_uri_to_display_*()
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Mon, 17 Dec 2007 22:04:37 +0900
parents 240bdf781ad0
children e8de4c4a3cac
files src/madplug/plugin.c
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/madplug/plugin.c	Mon Dec 17 18:04:53 2007 +0900
+++ b/src/madplug/plugin.c	Mon Dec 17 22:04:37 2007 +0900
@@ -610,7 +610,6 @@
 {
     Tuple *tuple = NULL;
     gchar *string = NULL;
-    gchar *realfn = NULL;
 
     struct id3_file *id3file = NULL;
     struct id3_tag *tag = NULL;
@@ -709,11 +708,10 @@
                 g_free(string);
                 string = NULL;
             }
-            realfn = g_filename_from_uri(filename, NULL, NULL);
-            __set_and_free(tuple, FIELD_FILE_NAME, NULL, g_path_get_basename(realfn ? realfn : filename));
-            __set_and_free(tuple, FIELD_FILE_PATH, NULL, g_path_get_dirname(realfn ? realfn : filename));
-            aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(realfn ? realfn : filename));
-            g_free(realfn); realfn = NULL;
+
+            __set_and_free(tuple, FIELD_FILE_NAME, NULL, aud_uri_to_display_basename(filename));
+            __set_and_free(tuple, FIELD_FILE_PATH, NULL, aud_uri_to_display_dirname(filename));
+            aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(filename));
 
             // length
             length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS);
@@ -734,11 +732,9 @@
         id3_file_close(id3file);
     } // id3file
     else { // no id3tag
-        realfn = g_filename_from_uri(filename, NULL, NULL);
-        __set_and_free(tuple, FIELD_FILE_NAME, NULL, g_path_get_basename(realfn ? realfn : filename));
-        __set_and_free(tuple, FIELD_FILE_PATH, NULL, g_path_get_dirname(realfn ? realfn : filename));
-        aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(realfn ? realfn : filename));
-        g_free(realfn); realfn = NULL;
+        __set_and_free(tuple, FIELD_FILE_NAME, NULL, aud_uri_to_display_basename(filename));
+        __set_and_free(tuple, FIELD_FILE_PATH, NULL, aud_uri_to_display_dirname(filename));
+        aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(filename));
         // length
         length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS);
         aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length);