comparison 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
comparison
equal deleted inserted replaced
1276:504c0dc36c0a 1277:e7cd962732cb
599 // tuple stuff 599 // tuple stuff
600 static TitleInput *audmad_get_song_tuple(char *filename) 600 static TitleInput *audmad_get_song_tuple(char *filename)
601 { 601 {
602 TitleInput *tuple = NULL; 602 TitleInput *tuple = NULL;
603 gchar *string = NULL; 603 gchar *string = NULL;
604 gchar *realfn = NULL;
604 605
605 struct id3_file *id3file = NULL; 606 struct id3_file *id3file = NULL;
606 struct id3_tag *tag = NULL; 607 struct id3_tag *tag = NULL;
607 608
608 #ifdef DEBUG 609 #ifdef DEBUG
633 } 634 }
634 #ifdef DEBUG 635 #ifdef DEBUG
635 g_message("audmad_get_song_tuple: track_name = %s", tuple->track_name); 636 g_message("audmad_get_song_tuple: track_name = %s", tuple->track_name);
636 g_message("audmad_get_song_tuple: stream_name = %s", tuple->album_name); 637 g_message("audmad_get_song_tuple: stream_name = %s", tuple->album_name);
637 #endif 638 #endif
638 tuple->file_name = g_path_get_basename(filename); 639 realfn = g_filename_from_uri(filename, NULL, NULL);
639 tuple->file_path = g_path_get_dirname(filename); 640 tuple->file_name = g_path_get_basename(realfn ? realfn : filename);
640 tuple->file_ext = extname(filename); 641 tuple->file_path = g_path_get_dirname(realfn ? realfn : filename);
642 tuple->file_ext = extname(realfn ? realfn : filename);
643 g_free(realfn); realfn = NULL;
644
641 tuple->length = -1; 645 tuple->length = -1;
642 tuple->mtime = 0; // this indicates streaming 646 tuple->mtime = 0; // this indicates streaming
643 #ifdef DEBUG 647 #ifdef DEBUG
644 g_message("get_song_tuple: remote: tuple"); 648 g_message("get_song_tuple: remote: tuple");
645 #endif 649 #endif
674 if (string) { 678 if (string) {
675 tuple->year = atoi(string); 679 tuple->year = atoi(string);
676 g_free(string); 680 g_free(string);
677 string = NULL; 681 string = NULL;
678 } 682 }
679 683 realfn = g_filename_from_uri(filename, NULL, NULL);
680 tuple->file_name = g_path_get_basename(filename); 684 tuple->file_name = g_path_get_basename(realfn ? realfn : filename);
681 tuple->file_path = g_path_get_dirname(filename); 685 tuple->file_path = g_path_get_dirname(realfn ? realfn : filename);
682 tuple->file_ext = extname(filename); 686 tuple->file_ext = extname(realfn ? realfn : filename);
687 g_free(realfn); realfn = NULL;
683 688
684 // length 689 // length
685 tuple->length = -1; 690 tuple->length = -1;
686 string = input_id3_get_string(tag, "TLEN"); 691 string = input_id3_get_string(tag, "TLEN");
687 if (string) { 692 if (string) {
718 723
719 } 724 }
720 id3_file_close(id3file); 725 id3_file_close(id3file);
721 } 726 }
722 else { // no id3tag 727 else { // no id3tag
723 tuple->file_name = g_path_get_basename(filename); 728 realfn = g_filename_from_uri(filename, NULL, NULL);
724 tuple->file_path = g_path_get_dirname(filename); 729 tuple->file_name = g_path_get_basename(realfn ? realfn : filename);
725 tuple->file_ext = extname(filename); 730 tuple->file_path = g_path_get_dirname(realfn ? realfn : filename);
731 tuple->file_ext = extname(realfn ? realfn : filename);
732 g_free(realfn); realfn = NULL;
726 // length 733 // length
727 { 734 {
728 char *dummy = NULL; 735 char *dummy = NULL;
729 int length = 0; 736 int length = 0;
730 if(tuple->length == -1) { 737 if(tuple->length == -1) {