Index: firmware/id3.c =================================================================== --- firmware/id3.c (revision 14494) +++ firmware/id3.c (working copy) @@ -351,6 +351,54 @@ return bufferpos; } +/* parse numeric value from rating entry */ +static int parserating( struct mp3entry* entry, char* tag, int bufferpos ) +{ +char* value_str=NULL; +unsigned char value=0; +int desc_len = strlen(tag); + + /* tag is a string with an e-mail address in it, rating is one byte after the (null terminated) e-mail*/ + /* no@email is for mediamonkey ratings*/ + + value_str = tag + desc_len + 1; + value=value_str[0]; + + if (!strcmp(tag, "no@email")) + { + if (value >= 1) + entry->rating=0; + if (value >= 26) + entry->rating=1; + if (value >= 51) + entry->rating=2; + if (value >= 76) + entry->rating=3; + if (value >= 102) + entry->rating=4; + if (value >= 128) + entry->rating=5; + if (value >= 153) + entry->rating=6; + if (value >= 178) + entry->rating=7; + if (value >= 204) + entry->rating=8; + if (value >= 230) + entry->rating=9; + if (value >= 255) + entry->rating=10; + + return bufferpos; /* POPM length after e-mail should this be +5? ie bytes after e-mail?*/ + } + else + { + entry->rating=((value*11)/256); /* rough calculation for other rating schemes */ + return bufferpos; /* POPM length after e-mail should this also be +5?*/ + } + +} + /* parse numeric value from string */ static int parsediscnum( struct mp3entry* entry, char* tag, int bufferpos ) { @@ -496,6 +544,7 @@ { "COMM", 4, offsetof(struct mp3entry, comment), NULL, false }, { "TCON", 4, offsetof(struct mp3entry, genre_string), &parsegenre, false }, { "TCO", 3, offsetof(struct mp3entry, genre_string), &parsegenre, false }, + { "POPM", 4, offsetof(struct mp3entry, rating), &parserating, true }, #if CONFIG_CODEC == SWCODEC { "TXXX", 4, 0, &parseuser, false }, { "RVA2", 4, 0, &parserva2, true },