# HG changeset patch # User William Pitcock # Date 1190138283 18000 # Node ID e840c5086a157837c2e6181ac4509f7da5861094 # Parent d4f9e45c1e2724eb54485b08a4aff0345d78003c# Parent 6b0be1d088e6c66a9bae3aa168d118f04a85eb0f Automated merge with ssh://hg.atheme.org//hg/audacious diff -r d4f9e45c1e27 -r e840c5086a15 src/audacious/playlist.c --- a/src/audacious/playlist.c Tue Sep 18 12:57:50 2007 -0500 +++ b/src/audacious/playlist.c Tue Sep 18 12:58:03 2007 -0500 @@ -668,48 +668,81 @@ InputPlugin * dec) { PlaylistEntry *entry; + gint subtunes_num = 0, i = 0; g_return_if_fail(playlist != NULL); g_return_if_fail(filename != NULL); - entry = playlist_entry_new(filename, - tuple ? tuple_get_string(tuple, FIELD_TITLE, NULL) : NULL, - tuple ? tuple_get_int(tuple, FIELD_LENGTH, NULL) : -1, dec); - - if(!playlist->tail) - playlist->tail = g_list_last(playlist->entries); - - PLAYLIST_LOCK(playlist); - - if(pos == -1) { // the common case - GList *element; - element = g_list_alloc(); - element->data = entry; - element->prev = playlist->tail; // NULL is allowed here. - element->next = NULL; - - if(!playlist->entries) { // this is the first element - playlist->entries = element; - playlist->tail = element; - } - else { // the rests - g_return_if_fail(playlist->tail != NULL); - playlist->tail->next = element; - playlist->tail = element; + if (tuple != NULL) + { + subtunes_num = tuple_get_int(tuple, FIELD_SUBSONG_NUM, NULL); + if ( subtunes_num > 0 ) + { + i = 1; + tuple_free(tuple); /* will be replaced by subtune tuples */ } } - else { - playlist->entries = g_list_insert(playlist->entries, entry, pos); - } - - PLAYLIST_UNLOCK(playlist); - - if (tuple != NULL) { - const gchar *formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); - entry->title = tuple_formatter_make_title_string(tuple, formatter ? - formatter : get_gentitle_format()); - entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); - entry->tuple = tuple; + + for ( ; i <= subtunes_num ; i++ ) + { + gchar *filename_entry; + if ( subtunes_num > 0 ) + { + GString *tmpstr = g_string_new(filename); + g_string_append_printf(tmpstr, "?%i", i); + filename_entry = tmpstr->str; + g_string_free(tmpstr, FALSE); + + /* we're dealing with subtune, let's ask again tuple information + to plugin, by passing the ?subsong suffix; this way we may get + specific subtune information in the tuple, if available */ + tuple = dec->get_song_tuple(filename_entry); + } + else + { + filename_entry = g_strdup(filename); + } + + entry = playlist_entry_new(filename_entry, + tuple ? tuple_get_string(tuple, FIELD_TITLE, NULL) : NULL, + tuple ? tuple_get_int(tuple, FIELD_LENGTH, NULL) : -1, dec); + g_free(filename_entry); + + if(!playlist->tail) + playlist->tail = g_list_last(playlist->entries); + + PLAYLIST_LOCK(playlist); + + if ((pos == -1) && (i < 2)) { // the common case + GList *element; + element = g_list_alloc(); + element->data = entry; + element->prev = playlist->tail; // NULL is allowed here. + element->next = NULL; + + if(!playlist->entries) { // this is the first element + playlist->entries = element; + playlist->tail = element; + } + else { // the rests + g_return_if_fail(playlist->tail != NULL); + playlist->tail->next = element; + playlist->tail = element; + } + } + else { + playlist->entries = g_list_insert(playlist->entries, entry, pos); + } + + PLAYLIST_UNLOCK(playlist); + + if (tuple != NULL) { + const gchar *formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); + entry->title = tuple_formatter_make_title_string(tuple, formatter ? + formatter : get_gentitle_format()); + entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); + entry->tuple = tuple; + } } if(tuple != NULL && tuple_get_int(tuple, FIELD_MTIME, NULL) == -1) { // kick the scanner thread only if mtime = -1 (uninitialized). diff -r d4f9e45c1e27 -r e840c5086a15 src/audacious/tuple.c --- a/src/audacious/tuple.c Tue Sep 18 12:57:50 2007 -0500 +++ b/src/audacious/tuple.c Tue Sep 18 12:58:03 2007 -0500 @@ -47,6 +47,9 @@ { "performer", TUPLE_STRING }, { "copyright", TUPLE_STRING }, { "date", TUPLE_STRING }, + + { "subsong-id", TUPLE_INT }, + { "subsong-num", TUPLE_INT }, }; static mowgli_heap_t *tuple_heap = NULL; diff -r d4f9e45c1e27 -r e840c5086a15 src/audacious/tuple.h --- a/src/audacious/tuple.h Tue Sep 18 12:57:50 2007 -0500 +++ b/src/audacious/tuple.h Tue Sep 18 12:58:03 2007 -0500 @@ -50,6 +50,9 @@ FIELD_COPYRIGHT, FIELD_DATE, + FIELD_SUBSONG_ID, + FIELD_SUBSONG_NUM, + /* special field, must always be last */ FIELD_LAST };