comparison src/madplug/plugin.c @ 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 9a869d4bb0d3
children d25cd7e7eddb
comparison
equal deleted inserted replaced
2238:240bdf781ad0 2241:a5c96af75300
608 // tuple stuff 608 // tuple stuff
609 static Tuple *__audmad_get_song_tuple(char *filename, VFSFile *fd) 609 static Tuple *__audmad_get_song_tuple(char *filename, VFSFile *fd)
610 { 610 {
611 Tuple *tuple = NULL; 611 Tuple *tuple = NULL;
612 gchar *string = NULL; 612 gchar *string = NULL;
613 gchar *realfn = NULL;
614 613
615 struct id3_file *id3file = NULL; 614 struct id3_file *id3file = NULL;
616 struct id3_tag *tag = NULL; 615 struct id3_tag *tag = NULL;
617 616
618 struct mad_info_t myinfo; 617 struct mad_info_t myinfo;
707 if (string) { 706 if (string) {
708 aud_tuple_associate_int(tuple, FIELD_YEAR, NULL, atoi(string)); 707 aud_tuple_associate_int(tuple, FIELD_YEAR, NULL, atoi(string));
709 g_free(string); 708 g_free(string);
710 string = NULL; 709 string = NULL;
711 } 710 }
712 realfn = g_filename_from_uri(filename, NULL, NULL); 711
713 __set_and_free(tuple, FIELD_FILE_NAME, NULL, g_path_get_basename(realfn ? realfn : filename)); 712 __set_and_free(tuple, FIELD_FILE_NAME, NULL, aud_uri_to_display_basename(filename));
714 __set_and_free(tuple, FIELD_FILE_PATH, NULL, g_path_get_dirname(realfn ? realfn : filename)); 713 __set_and_free(tuple, FIELD_FILE_PATH, NULL, aud_uri_to_display_dirname(filename));
715 aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(realfn ? realfn : filename)); 714 aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(filename));
716 g_free(realfn); realfn = NULL;
717 715
718 // length 716 // length
719 length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS); 717 length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS);
720 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); 718 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length);
721 719
732 AUDDBG("genre = %s", aud_tuple_get_string(tuple, FIELD_GENRE, NULL)); 730 AUDDBG("genre = %s", aud_tuple_get_string(tuple, FIELD_GENRE, NULL));
733 } 731 }
734 id3_file_close(id3file); 732 id3_file_close(id3file);
735 } // id3file 733 } // id3file
736 else { // no id3tag 734 else { // no id3tag
737 realfn = g_filename_from_uri(filename, NULL, NULL); 735 __set_and_free(tuple, FIELD_FILE_NAME, NULL, aud_uri_to_display_basename(filename));
738 __set_and_free(tuple, FIELD_FILE_NAME, NULL, g_path_get_basename(realfn ? realfn : filename)); 736 __set_and_free(tuple, FIELD_FILE_PATH, NULL, aud_uri_to_display_dirname(filename));
739 __set_and_free(tuple, FIELD_FILE_PATH, NULL, g_path_get_dirname(realfn ? realfn : filename)); 737 aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(filename));
740 aud_tuple_associate_string(tuple, FIELD_FILE_EXT, NULL, extname(realfn ? realfn : filename));
741 g_free(realfn); realfn = NULL;
742 // length 738 // length
743 length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS); 739 length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS);
744 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length); 740 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, length);
745 } 741 }
746 742