Commit fb7a3fde authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

audio_list_song: Display the track number

parent a91a0fec
......@@ -101,6 +101,7 @@ fileToMediaItem( MediaPtr file )
mi->psz_snapshot = strdup( artwork.c_str() + strlen( "file://" ) );
}
}
mi->i_track_number = albumTrack->trackNumber();
}
auto artist = file->artist();
if (artist.length() > 0)
......
......@@ -55,6 +55,7 @@ media_item_copy(const media_item* p_item)
p_new->i_duration = p_item->i_duration;
p_new->i_w = p_item->i_w;
p_new->i_h = p_item->i_h;
p_new->i_track_number = p_item->i_track_number;
for (unsigned int i = 0; i < MEDIA_ITEM_META_COUNT; ++i)
{
if (p_item->psz_metas[i] != NULL)
......
......@@ -66,6 +66,7 @@ typedef struct media_item {
char* psz_snapshot; /* Path to a snapshot file */
uint32_t i_id; /* Opaque file type specific ID, provided by the media library */
uint16_t i_track_number; /* Track number, or 0 if unknown or not part of an album */
} media_item;
media_item *
......
......@@ -67,7 +67,10 @@ genlist_text_get_cb(void *data, Evas_Object *obj, const char *part)
/* Then put this string as the genlist item label */
if (itc->item_style && !strcmp(itc->item_style, "2line.top.3")) {
if (part && !strcmp(part, "elm.text.main.left.top")) {
asprintf(&buf, "<b>%s</b>", media_item_title(ali->p_media_item));
if (ali->p_media_item->i_track_number > 0)
asprintf(&buf, "%d - <b>%s</b>", ali->p_media_item->i_track_number, media_item_title(ali->p_media_item));
else
asprintf(&buf, "<b>%s</b>", media_item_title(ali->p_media_item));
return buf;
}
else if (!strcmp(part, "elm.text.sub.left.bottom")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment