From 58a3d45cef416c0f2d1e13f07dc78f53de498870 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Tue, 27 Jan 2004 05:30:06 +0000 Subject: [PATCH] Add track tags --- src/daap.c | 8 ++++++-- src/mp3-scanner.c | 9 +++++++++ src/mp3-scanner.h | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/daap.c b/src/daap.c index 9446bd42..047eaf7f 100644 --- a/src/daap.c +++ b/src/daap.c @@ -302,8 +302,12 @@ DAAP_BLOCK *daap_response_songlist(void) { if(current->song_length) g = g && daap_add_int(mlit,"astm",current->song_length*1000); /* song time */ - // g = g && daap_add_short(mlit,"astc",0); /* track count */ - // g = g && daap_add_short(mlit,"astn",0); /* track number */ + if(current->total_tracks) + g = g && daap_add_short(mlit,"astc",current->total_tracks); /* track count */ + + if(current->track) + g = g && daap_add_short(mlit,"astn",current->track); /* track number */ + // g = g && daap_add_char(mlit,"asur",3); /* rating */ if(current->year) g = g && daap_add_short(mlit,"asyr",current->year); diff --git a/src/mp3-scanner.c b/src/mp3-scanner.c index 034ce156..21b44272 100644 --- a/src/mp3-scanner.c +++ b/src/mp3-scanner.c @@ -401,6 +401,7 @@ int scan_gettags(char *file, MP3FILE *pmp3) { int have_utf8; int have_text; id3_ucs4_t const *native_text; + char *tmp; pid3file=id3_file_open(file,ID3_FILE_MODE_READONLY); if(!pid3file) { @@ -463,6 +464,14 @@ int scan_gettags(char *file, MP3FILE *pmp3) { used=1; pmp3->comment = utf8_text; DPRINTF(ERR_DEBUG," Comment: %s\n",pmp3->comment); + } else if(!strcmp(pid3frame->id,"TRCK")) { + tmp=(char*)utf8_text; + strsep(&tmp,"/"); + if(tmp) { + pmp3->total_tracks=atoi(tmp); + } + pmp3->track=atoi((char*)utf8_text); + DPRINTF(ERR_DEBUG," Track %d of %d\n",pmp3->track,pmp3->total_tracks); } else if(!strcmp(pid3frame->id,"TDRC")) { pmp3->year = atoi(utf8_text); DPRINTF(ERR_DEBUG," Year: %d\n",pmp3->year); diff --git a/src/mp3-scanner.h b/src/mp3-scanner.h index d32633b1..2b3b142c 100644 --- a/src/mp3-scanner.h +++ b/src/mp3-scanner.h @@ -36,6 +36,9 @@ typedef struct tag_mp3file { int song_length; int file_size; int year; + + int track; + int total_tracks; int mtime; int atime;