summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArnold Metselaar <arnold.metselaar@planet.nl>2008-08-13 17:33:05 +0100
committerArnold Metselaar <arnold.metselaar@planet.nl>2008-08-13 17:33:05 +0100
commit2c0dd5e118628a7cb2130ee89f78fe6e85240916 (patch)
treed44e1db2e1304c8dfd33d232e2627baa36a824f7 /src
parent7fa0f0692db43d238700950c62404d0e546883d1 (diff)
downloadxine-lib-2c0dd5e118628a7cb2130ee89f78fe6e85240916.tar.gz
xine-lib-2c0dd5e118628a7cb2130ee89f78fe6e85240916.tar.bz2
Improve parsing of cddb information
Date: Thu, 1 May 2008 21:09:25 +0200 This patch improves the parsing of cddb information: * Disc and track titles can now contain '='. * If a track title is of the form <track-artist> / <track-title> the meta-info will contain the track-artist rather than the disc-artist. I have tested these changes together with my get_dir patch with the sources from debian testing/security and both Amarok and gxine now show the right artists for tracks on a compilation album.
Diffstat (limited to 'src')
-rw-r--r--src/input/input_cdda.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c
index eed7b1593..305ef6381 100644
--- a/src/input/input_cdda.c
+++ b/src/input/input_cdda.c
@@ -1475,7 +1475,7 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) {
if (sscanf(buffer, "DTITLE=%s", &buf[0]) == 1) {
char *pt, *artist, *title;
- pt = strrchr(buffer, '=');
+ pt = strchr(buffer, '=');
if (pt) {
pt++;
@@ -1515,7 +1515,7 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) {
else if (sscanf(buffer, "TTITLE%d=%s", &tnum, &buf[0]) == 2) {
char *pt;
- pt = strrchr(buffer, '=');
+ pt = strchr(buffer, '=');
if (pt)
pt++;
if (this->cddb.track[tnum].title == NULL)
@@ -2465,15 +2465,31 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) {
}
if(this->cddb.track[this->track].title) {
- lprintf("Track %d Title: %s\n", this->track+1, this->cddb.track[this->track].title);
-
- _x_meta_info_set_utf8(this->stream, XINE_META_INFO_TITLE, this->cddb.track[this->track].title);
- }
+ /* Check for track 'titles' of the form <artist> / <title>. */
+ char *pt;
+ pt = strstr(this->cddb.track[this->track].title, " / ");
+ if (pt != NULL) {
+ char *track_artist;
+ track_artist = strdup(this->cddb.track[this->track].title);
+ track_artist[pt - this->cddb.track[this->track].title] = 0;
+ lprintf("Track %d Artist: %s\n", this->track+1, track_artist);
+
+ _x_meta_info_set_utf8(this->stream, XINE_META_INFO_ARTIST, track_artist);
+ free(track_artist);
+ pt += 3;
+ }
+ else {
+ if(this->cddb.disc_artist) {
+ lprintf("Disc Artist: %s\n", this->cddb.disc_artist);
+
+ _x_meta_info_set_utf8(this->stream, XINE_META_INFO_ARTIST, this->cddb.disc_artist);
+ }
- if(this->cddb.disc_artist) {
- lprintf("Disc Artist: %s\n", this->cddb.disc_artist);
+ pt = this->cddb.track[this->track].title;
+ }
+ lprintf("Track %d Title: %s\n", this->track+1, pt);
- _x_meta_info_set_utf8(this->stream, XINE_META_INFO_ARTIST, this->cddb.disc_artist);
+ _x_meta_info_set_utf8(this->stream, XINE_META_INFO_TITLE, pt);
}
if(this->cddb.disc_category) {