Add track tags

This commit is contained in:
Ron Pedde 2004-01-27 05:30:06 +00:00
parent 469ab2d6a9
commit 58a3d45cef
3 changed files with 18 additions and 2 deletions

View File

@ -302,8 +302,12 @@ DAAP_BLOCK *daap_response_songlist(void) {
if(current->song_length) if(current->song_length)
g = g && daap_add_int(mlit,"astm",current->song_length*1000); /* song time */ g = g && daap_add_int(mlit,"astm",current->song_length*1000); /* song time */
// g = g && daap_add_short(mlit,"astc",0); /* track count */ if(current->total_tracks)
// g = g && daap_add_short(mlit,"astn",0); /* track number */ 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 */ // g = g && daap_add_char(mlit,"asur",3); /* rating */
if(current->year) if(current->year)
g = g && daap_add_short(mlit,"asyr",current->year); g = g && daap_add_short(mlit,"asyr",current->year);

View File

@ -401,6 +401,7 @@ int scan_gettags(char *file, MP3FILE *pmp3) {
int have_utf8; int have_utf8;
int have_text; int have_text;
id3_ucs4_t const *native_text; id3_ucs4_t const *native_text;
char *tmp;
pid3file=id3_file_open(file,ID3_FILE_MODE_READONLY); pid3file=id3_file_open(file,ID3_FILE_MODE_READONLY);
if(!pid3file) { if(!pid3file) {
@ -463,6 +464,14 @@ int scan_gettags(char *file, MP3FILE *pmp3) {
used=1; used=1;
pmp3->comment = utf8_text; pmp3->comment = utf8_text;
DPRINTF(ERR_DEBUG," Comment: %s\n",pmp3->comment); 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")) { } else if(!strcmp(pid3frame->id,"TDRC")) {
pmp3->year = atoi(utf8_text); pmp3->year = atoi(utf8_text);
DPRINTF(ERR_DEBUG," Year: %d\n",pmp3->year); DPRINTF(ERR_DEBUG," Year: %d\n",pmp3->year);

View File

@ -36,6 +36,9 @@ typedef struct tag_mp3file {
int song_length; int song_length;
int file_size; int file_size;
int year; int year;
int track;
int total_tracks;
int mtime; int mtime;
int atime; int atime;