comparison src/audacious/playlist.c @ 3784:2c92b8947057

Maybe it works now.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 18 Oct 2007 18:02:10 +0300
parents a3fc112b10f1
children dd5c459c5f2d
comparison
equal deleted inserted replaced
3783:9ae0a88420e5 3784:2c92b8947057
667 Tuple *tuple, 667 Tuple *tuple,
668 InputPlugin * dec) 668 InputPlugin * dec)
669 { 669 {
670 PlaylistEntry *entry; 670 PlaylistEntry *entry;
671 Tuple *parent_tuple = NULL; 671 Tuple *parent_tuple = NULL;
672 gint nsubtunes, subtune; 672 gint nsubtunes = 0, subtune = 0;
673 gboolean add_flag = TRUE; 673 gboolean add_flag = TRUE;
674 674
675 g_return_if_fail(playlist != NULL); 675 g_return_if_fail(playlist != NULL);
676 g_return_if_fail(filename != NULL); 676 g_return_if_fail(filename != NULL);
677 677
678 if (tuple != NULL) { 678 if (tuple != NULL) {
679 nsubtunes = tuple->nsubtunes; 679 nsubtunes = tuple->nsubtunes;
680 if (nsubtunes > 0) 680 if (nsubtunes > 0) {
681 parent_tuple = tuple; 681 parent_tuple = tuple;
682 subtune = 1; 682 subtune = 1;
683 } else { 683 }
684 nsubtunes = 0;
685 subtune = 0;
686 } 684 }
687 685
688 for (; add_flag && subtune <= nsubtunes; subtune++) { 686 for (; add_flag && subtune <= nsubtunes; subtune++) {
689 gchar *filename_entry; 687 gchar *filename_entry;
690 688
704 entry = playlist_entry_new(filename_entry, 702 entry = playlist_entry_new(filename_entry,
705 tuple ? tuple_get_string(tuple, FIELD_TITLE, NULL) : NULL, 703 tuple ? tuple_get_string(tuple, FIELD_TITLE, NULL) : NULL,
706 tuple ? tuple_get_int(tuple, FIELD_LENGTH, NULL) : -1, dec); 704 tuple ? tuple_get_int(tuple, FIELD_LENGTH, NULL) : -1, dec);
707 g_free(filename_entry); 705 g_free(filename_entry);
708 706
707 PLAYLIST_LOCK(playlist);
708
709 if (!playlist->tail) 709 if (!playlist->tail)
710 playlist->tail = g_list_last(playlist->entries); 710 playlist->tail = g_list_last(playlist->entries);
711
712 PLAYLIST_LOCK(playlist);
713 711
714 if (pos == -1) { // the common case 712 if (pos == -1) { // the common case
715 GList *element; 713 GList *element;
716 element = g_list_alloc(); 714 element = g_list_alloc();
717 element->data = entry; 715 element->data = entry;
740 } 738 }
741 739
742 PLAYLIST_UNLOCK(playlist); 740 PLAYLIST_UNLOCK(playlist);
743 } 741 }
744 742
745
746 if (parent_tuple) 743 if (parent_tuple)
747 tuple_free(parent_tuple); 744 tuple_free(parent_tuple);
748 745
749 if (tuple != NULL && tuple_get_int(tuple, FIELD_MTIME, NULL) == -1) { 746 if (tuple != NULL && tuple_get_int(tuple, FIELD_MTIME, NULL) == -1) {
750 // kick the scanner thread only if mtime = -1 (uninitialized) 747 // kick the scanner thread only if mtime = -1 (uninitialized)