diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2007-03-04 19:54:49 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2007-03-04 19:54:49 +0000 |
commit | 74e572c9d600247ee795b206da3715f6af442a25 (patch) | |
tree | 752b406365e6361a083fd1a210b1781bf6fff33d /apps | |
parent | 416218660aee3df058b8f6d7dbd49b79adddd020 (diff) | |
download | rockbox-74e572c9d600247ee795b206da3715f6af442a25.tar.gz rockbox-74e572c9d600247ee795b206da3715f6af442a25.zip |
Do the '<Untagged>' check in a more compact way.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12600 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/tagcache.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 7e614aa882..a6a0168353 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -1458,11 +1458,16 @@ static long get_tag_numeric(const struct index_entry *entry, int tag) | |||
1458 | return entry->tag_seek[tag]; | 1458 | return entry->tag_seek[tag]; |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | static char* get_tag_string(const struct index_entry *entry, int tag) | ||
1462 | { | ||
1463 | char* s = get_tag(entry, tag)->tag_data; | ||
1464 | return strcmp(s, UNTAGGED) ? s : NULL; | ||
1465 | } | ||
1466 | |||
1461 | bool tagcache_fill_tags(struct mp3entry *id3, const char *filename) | 1467 | bool tagcache_fill_tags(struct mp3entry *id3, const char *filename) |
1462 | { | 1468 | { |
1463 | struct index_entry *entry; | 1469 | struct index_entry *entry; |
1464 | int idx_id; | 1470 | int idx_id; |
1465 | char *tmp; | ||
1466 | 1471 | ||
1467 | if (!tc_stat.ready) | 1472 | if (!tc_stat.ready) |
1468 | return false; | 1473 | return false; |
@@ -1474,26 +1479,13 @@ bool tagcache_fill_tags(struct mp3entry *id3, const char *filename) | |||
1474 | 1479 | ||
1475 | entry = &hdr->indices[idx_id]; | 1480 | entry = &hdr->indices[idx_id]; |
1476 | 1481 | ||
1477 | tmp = get_tag(entry, tag_title)->tag_data; | 1482 | id3->title = get_tag_string(entry, tag_title); |
1478 | id3->title = strcmp(tmp, UNTAGGED) ? tmp : NULL; | 1483 | id3->artist = get_tag_string(entry, tag_artist); |
1479 | 1484 | id3->album = get_tag_string(entry, tag_album); | |
1480 | tmp = get_tag(entry, tag_artist)->tag_data; | 1485 | id3->genre_string = get_tag_string(entry, tag_genre); |
1481 | id3->artist = strcmp(tmp, UNTAGGED) ? tmp : NULL; | 1486 | id3->composer = get_tag_string(entry, tag_composer); |
1482 | 1487 | id3->comment = get_tag_string(entry, tag_comment); | |
1483 | tmp = get_tag(entry, tag_album)->tag_data; | 1488 | id3->albumartist = get_tag_string(entry, tag_albumartist); |
1484 | id3->album = strcmp(tmp, UNTAGGED) ? tmp : NULL; | ||
1485 | |||
1486 | tmp = get_tag(entry, tag_genre)->tag_data; | ||
1487 | id3->genre_string = strcmp(tmp, UNTAGGED) ? tmp : NULL; | ||
1488 | |||
1489 | tmp = get_tag(entry, tag_composer)->tag_data; | ||
1490 | id3->composer = strcmp(tmp, UNTAGGED) ? tmp : NULL; | ||
1491 | |||
1492 | tmp = get_tag(entry, tag_comment)->tag_data; | ||
1493 | id3->comment = strcmp(tmp, UNTAGGED) ? tmp : NULL; | ||
1494 | |||
1495 | tmp = get_tag(entry, tag_albumartist)->tag_data; | ||
1496 | id3->albumartist = strcmp(tmp, UNTAGGED) ? tmp : NULL; | ||
1497 | 1489 | ||
1498 | id3->playcount = get_tag_numeric(entry, tag_playcount); | 1490 | id3->playcount = get_tag_numeric(entry, tag_playcount); |
1499 | id3->lastplayed = get_tag_numeric(entry, tag_lastplayed); | 1491 | id3->lastplayed = get_tag_numeric(entry, tag_lastplayed); |