# HG changeset patch # User Yoshiki Yazawa # Date 1195039280 -32400 # Node ID 9fa5a78845141c53e478238d4ed906e1c98f2dbe # Parent 624eb07fe59127d5e71fb52ac0e23159885538cb unescape uri before write into tuple. diff -r 624eb07fe591 -r 9fa5a7884514 src/xspf/xspf.c --- a/src/xspf/xspf.c Tue Nov 13 05:25:42 2007 +0900 +++ b/src/xspf/xspf.c Wed Nov 14 20:21:20 2007 +0900 @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -77,9 +78,10 @@ static const gint xspf_nentries = (sizeof(xspf_entries) / sizeof(xspf_entry_t)); - +/* we need encoding conversion */ #ifdef DEBUG -# define XSDEBUG(...) { fprintf(stderr, "xspf[%s:%d]: ", __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); } +//# define XSDEBUG(...) { fprintf(stderr, "xspf[%s:%d]: ", __FUNCTION__, (int) __LINE__); fprintf(stderr, __VA_ARGS__); } +# define XSDEBUG(...) { g_print("xspf[%s:%d]: ", __FUNCTION__, (int) __LINE__); g_print(__VA_ARGS__); } #else # define XSDEBUG(...) /* stub */ #endif @@ -185,27 +187,30 @@ } if (location) { - gchar *uri = NULL; - gchar *scratch; + gchar *uri = NULL, *realfn = NULL, *scratch = NULL; - scratch = g_path_get_basename(location); + /* filename and path in tuple must be unescaped. */ + scratch = g_filename_from_uri(location, NULL, NULL); + realfn = aud_str_to_utf8(scratch ? scratch : location); + uri = aud_str_to_utf8(scratch ? location : scratch); + g_free(scratch); + + scratch = g_path_get_basename(realfn); aud_tuple_associate_string(tuple, FIELD_FILE_NAME, NULL, scratch); g_free(scratch); - scratch = g_path_get_dirname(location); + scratch = g_path_get_dirname(realfn); aud_tuple_associate_string(tuple, FIELD_FILE_PATH, NULL, scratch); g_free(scratch); - aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, strrchr(location, '.')); + aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, strrchr(realfn, '.')); XSDEBUG("tuple->file_name = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); XSDEBUG("tuple->file_path = %s\n", aud_tuple_get_string(tuple, FIELD_FILE_PATH, NULL)); - // add file to playlist - uri = g_filename_to_uri(location, NULL, NULL); - // uri would be NULL if location is already uri. --yaz - aud_playlist_load_ins_file_tuple(playlist, uri ? uri: location, filename, pos, tuple); - g_free(uri); + /* add file to playlist */ + aud_playlist_load_ins_file_tuple(playlist, uri, filename, pos, tuple); + g_free(realfn); g_free(uri); pos++; }