Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 156490 Details for
Bug 242226
Albums play in wrong order
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
make it sort when displaying and adding tracks to playlist
gmpc-0.14-track-ordering.patch (text/plain), 9.36 KB, created by
David Woodhouse
on 2007-06-07 17:17:28 UTC
(
hide
)
Description:
make it sort when displaying and adding tracks to playlist
Filename:
MIME Type:
Creator:
David Woodhouse
Created:
2007-06-07 17:17:28 UTC
Size:
9.36 KB
patch
obsolete
>--- gmpc-0.14.0/src/playlist3-artist-browser.c~ 2007-02-18 00:09:47.000000000 +0000 >+++ gmpc-0.14.0/src/playlist3-artist-browser.c 2007-06-07 18:12:37.000000000 +0100 >@@ -270,7 +270,50 @@ static void pl3_artist_browser_cover_art > > } > >+struct pl3_song_list { >+ struct pl3_song_list *next; >+ int tracknr; >+ mpd_Song *song; >+}; > >+static struct pl3_song_list *pl3_sort_track_list(MpdData * data) >+{ >+ struct pl3_song_list *result = NULL, *new, **pos; >+ >+ while (data) { >+ if (data->type == MPD_DATA_TYPE_SONG) { >+ >+ new = g_malloc0(sizeof(*new)); >+ >+ new->song = data->song; >+ if (new->song->track) >+ new->tracknr = atoi(new->song->track); >+ else >+ new->tracknr = 0; >+ >+ for (pos = &result; *pos; pos = &(*pos)->next) { >+ /* Sort on two keys. First album... */ >+ if ((*pos)->song->album && new->song->album && >+ strcmp((*pos)->song->album, new->song->album)) >+ break; >+ /* ... then track number */ >+ if ((*pos)->tracknr > new->tracknr) >+ break; >+ } >+ new->next = *pos; >+ *pos = new; >+ } >+ data = mpd_data_get_next_real(data, FALSE); >+ } >+ return result; >+} >+ >+static struct pl3_song_list *pl3_track_list_next(struct pl3_song_list *list) >+{ >+ struct pl3_song_list *next = list->next; >+ g_free(list); >+ return next; >+} > > static long unsigned pl3_artist_browser_view_folder(GtkTreeIter *iter_cat) > { >@@ -279,6 +322,7 @@ static long unsigned pl3_artist_browser_ > GtkTreePath *path = NULL; > int depth = 0; > long unsigned time =0; >+ struct pl3_song_list *songlist, *prev; > > if(pl3_ab_tree == NULL || pl3_ab_store == NULL) return 0; > if (!mpd_check_connected(connection)) >@@ -392,42 +436,42 @@ static long unsigned pl3_artist_browser_ > > > data = mpd_database_find(connection, MPD_TABLE_ARTIST, artist, TRUE); >- /* artist is selected */ >- while(data != NULL) >+ songlist = pl3_sort_track_list(data); >+ while (songlist) /* artist is selected */ > { >- if(data->type == MPD_DATA_TYPE_SONG) >+ if (songlist->song->album == NULL || strlen (songlist->song->album) == 0) > { >- if (data->song->album == NULL || strlen (data->song->album) == 0) >+ gchar buffer[1024]; >+ GdkPixbuf *pb = gtk_widget_render_icon(pl3_ab_tree, "media-audiofile", GTK_ICON_SIZE_MENU,NULL); >+ char *markdata = cfg_get_single_value_as_string_with_default(config, "playlist", "browser_markup",DEFAULT_MARKUP_BROWSER); >+ mpd_song_markup(buffer, 1024,markdata,songlist->song); >+ cfg_free_string(markdata); >+ if(songlist->song->time != MPD_SONG_NO_TIME) > { >- gchar buffer[1024]; >- GdkPixbuf *pb = gtk_widget_render_icon(pl3_ab_tree, "media-audiofile", GTK_ICON_SIZE_MENU,NULL); >- char *markdata = cfg_get_single_value_as_string_with_default(config, "playlist", "browser_markup",DEFAULT_MARKUP_BROWSER); >- mpd_song_markup(buffer, 1024,markdata,data->song); >- cfg_free_string(markdata); >- if(data->song->time != MPD_SONG_NO_TIME) >- { >- time += data->song->time; >- } >- if(data->song->file == NULL) >- { >- debug_printf(DEBUG_WARNING,"pl3_browser_view_folder: crap mpdSong has no file attribute.\n"); >- } >- gtk_list_store_append (pl3_ab_store, &iter); >- gtk_list_store_set (pl3_ab_store, &iter, >- PL3_AB_TITLE, buffer, >- PL3_AB_ARTIST, data->song->artist, >- PL3_AB_ALBUM, data->song->album, >- PL3_AB_FILE, data->song->file, >- PL3_AB_TYPE, PL3_ENTRY_SONG, >- PL3_AB_ICON, pb, >- -1); >- if(pb)g_object_unref(pb); >+ time += songlist->song->time; >+ } >+ if(songlist->song->file == NULL) >+ { >+ debug_printf(DEBUG_WARNING,"pl3_browser_view_folder: crap mpdSong has no file attribute.\n"); > } >- else albums++; >+ gtk_list_store_append (pl3_ab_store, &iter); >+ gtk_list_store_set (pl3_ab_store, &iter, >+ PL3_AB_TITLE, buffer, >+ PL3_AB_ARTIST, songlist->song->artist, >+ PL3_AB_ALBUM, songlist->song->album, >+ PL3_AB_FILE, songlist->song->file, >+ PL3_AB_TYPE, PL3_ENTRY_SONG, >+ PL3_AB_ICON, pb, >+ -1); >+ if(pb)g_object_unref(pb); > } >- data = mpd_data_get_next(data); >+ else albums++; >+ songlist = pl3_track_list_next(songlist); > } > >+ while(data) >+ data = mpd_data_get_next(data); >+ > if(!albums) > { > if(gtk_tree_model_iter_children(GTK_TREE_MODEL(pl3_tree), &iter, iter_cat)) >@@ -456,33 +500,33 @@ static long unsigned pl3_artist_browser_ > if(pb) g_object_unref(pb); > /* artist and album is selected */ > data = mpd_database_find(connection,MPD_TABLE_ALBUM, string, TRUE); >- while (data != NULL) >+ songlist = pl3_sort_track_list(data); >+ while(songlist) > { >- if(data->type == MPD_DATA_TYPE_SONG) >+ if (songlist->song->artist!= NULL && !g_utf8_collate (songlist->song->artist, artist)) > { >- if (data->song->artist!= NULL && !g_utf8_collate (data->song->artist, artist)) >+ gchar buffer[1024]; >+ pb = gtk_widget_render_icon(pl3_ab_tree, "media-audiofile", GTK_ICON_SIZE_MENU,NULL); >+ mpd_song_markup(buffer, 1024,markdata,songlist->song); >+ if(songlist->song->time != MPD_SONG_NO_TIME) > { >- gchar buffer[1024]; >- pb = gtk_widget_render_icon(pl3_ab_tree, "media-audiofile", GTK_ICON_SIZE_MENU,NULL); >- mpd_song_markup(buffer, 1024,markdata,data->song); >- if(data->song->time != MPD_SONG_NO_TIME) >- { >- time += data->song->time; >- } >- gtk_list_store_append (pl3_ab_store, &iter); >- gtk_list_store_set (pl3_ab_store, &iter, >- PL3_AB_TITLE, buffer, >- PL3_AB_ARTIST, data->song->artist, >- PL3_AB_ALBUM, data->song->album, >- PL3_AB_FILE, data->song->file, >- PL3_AB_TYPE, PL3_ENTRY_SONG, >- PL3_AB_ICON,pb, >- -1); >- if(pb)g_object_unref(pb); >+ time += songlist->song->time; > } >+ gtk_list_store_append (pl3_ab_store, &iter); >+ gtk_list_store_set (pl3_ab_store, &iter, >+ PL3_AB_TITLE, buffer, >+ PL3_AB_ARTIST, songlist->song->artist, >+ PL3_AB_ALBUM, songlist->song->album, >+ PL3_AB_FILE, songlist->song->file, >+ PL3_AB_TYPE, PL3_ENTRY_SONG, >+ PL3_AB_ICON,pb, >+ -1); >+ if(pb)g_object_unref(pb); > } >- data = mpd_data_get_next(data); >+ songlist = pl3_track_list_next(songlist); > } >+ while (data) >+ data = mpd_data_get_next(data); > cfg_free_string(markdata); > > } >@@ -594,14 +638,15 @@ static void pl3_artist_browser_add_folde > /* artist selected */ > gchar *message = g_strdup_printf("Added songs from artist '%s'",artist); > MpdData * data = mpd_database_find(connection, MPD_TABLE_ARTIST, artist, TRUE); >- while (data != NULL) >+ struct pl3_song_list *songlist = pl3_sort_track_list(data); >+ while (songlist) > { >- if(data->type == MPD_DATA_TYPE_SONG) >- { >- mpd_playlist_queue_add(connection, data->song->file); >- } >- data = mpd_data_get_next(data); >+ mpd_playlist_queue_add(connection, songlist->song->file); >+ songlist = pl3_track_list_next(songlist); > } >+ while (data) >+ data = mpd_data_get_next(data); >+ > pl3_push_statusbar_message(message); > q_free(message); > >@@ -612,17 +657,17 @@ static void pl3_artist_browser_add_folde > /* fetch all songs by this album and check if the artist is right. from mpd and add them to the add-list */ > gchar *message = g_strdup_printf("Added songs from album '%s' ",title); > MpdData *data = mpd_database_find(connection, MPD_TABLE_ALBUM, title, TRUE); >- while (data != NULL) >+ struct pl3_song_list *songlist = pl3_sort_track_list(data); >+ while (songlist) > { >- if(data->type == MPD_DATA_TYPE_SONG) >+ if (!g_utf8_collate (songlist->song->artist, artist)) > { >- if (!g_utf8_collate (data->song->artist, artist)) >- { >- mpd_playlist_queue_add(connection,data->song->file); >- } >+ mpd_playlist_queue_add(connection,songlist->song->file); > } >- data = mpd_data_get_next(data); >+ songlist = pl3_track_list_next(songlist); > } >+ while (data) >+ data = mpd_data_get_next(data); > pl3_push_statusbar_message(message); > q_free(message); > >@@ -896,32 +941,30 @@ static void pl3_artist_browser_add_selec > else if (type&PL3_ENTRY_ARTIST) > { > MpdData * data = mpd_database_find(connection, MPD_TABLE_ARTIST, artist, TRUE); >- while (data != NULL) >+ struct pl3_song_list *songlist = pl3_sort_track_list(data); >+ while (songlist) > { >- if(data->type == MPD_DATA_TYPE_SONG) >- { >- mpd_playlist_queue_add(connection, data->song->file); >- } >- data = mpd_data_get_next(data); >+ mpd_playlist_queue_add(connection, songlist->song->file); >+ songlist = pl3_track_list_next(songlist); > } >+ while (data) >+ data = mpd_data_get_next(data); > artists++; > } > else if (type&PL3_ENTRY_ALBUM) > { >- MpdData *data = NULL; >- data = mpd_database_find(connection, MPD_TABLE_ALBUM, album, TRUE); >- while (data != NULL) >+ MpdData *data = mpd_database_find(connection, MPD_TABLE_ALBUM, album, TRUE); >+ struct pl3_song_list *songlist = pl3_sort_track_list(data); >+ while (songlist) > { >- if(data->type == MPD_DATA_TYPE_SONG) >+ if (!g_utf8_collate (songlist->song->artist, artist)) > { >- if (!g_utf8_collate (data->song->artist, artist)) >- { >- >- mpd_playlist_queue_add(connection,data->song->file); >- } >+ mpd_playlist_queue_add(connection,songlist->song->file); >+ songlist = pl3_track_list_next(songlist); > } >- data = mpd_data_get_next(data); > } >+ while (data) >+ data = mpd_data_get_next(data); > albums++; > } > if(artist)q_free(artist);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 242226
:
156490
|
156857
|
156860