Permalink
Browse files

cue, cdaudio-ng: Read album and album artist from CD-Text.

  • Loading branch information...
1 parent 10e7153 commit 4a8ece834d72be78c229638c5968d887e32ac363 @jlindgren90 jlindgren90 committed Dec 29, 2015
Showing with 16 additions and 0 deletions.
  1. +2 −0 src/cdaudio-ng/cdaudio-ng.cc
  2. +14 −0 src/cue/cue.cc
@@ -434,6 +434,8 @@ Tuple CDAudio::read_tuple (const char * filename, VFSFile & file)
tuple.set_str (Tuple::Artist, trackinfo[trackno].performer);
if (trackinfo[0].name)
tuple.set_str (Tuple::Album, trackinfo[0].name);
+ if (trackinfo[0].performer)
+ tuple.set_str (Tuple::AlbumArtist, trackinfo[0].performer);
if (trackinfo[trackno].genre)
tuple.set_str (Tuple::Genre, trackinfo[trackno].genre);
}
View
@@ -75,6 +75,20 @@ bool CueLoader::load (const char * cue_filename, VFSFile & file, String & title,
filename = String (uri_construct (cur_name, cue_filename));
decoder = filename ? aud_file_find_decoder (filename, false) : nullptr;
base_tuple = decoder ? aud_file_read_tuple (filename, decoder) : Tuple ();
+
+ if (base_tuple)
+ {
+ Cdtext * cdtext = cd_get_cdtext (cd);
+
+ if (cdtext)
+ {
+ const char * s;
+ if ((s = cdtext_get (PTI_PERFORMER, cdtext)))
+ base_tuple.set_str (Tuple::AlbumArtist, s);
+ if ((s = cdtext_get (PTI_TITLE, cdtext)))
+ base_tuple.set_str (Tuple::Album, s);
+ }
+ }
}
Track * next = (track + 1 <= tracks) ? cd_get_track (cd, track + 1) : nullptr;

0 comments on commit 4a8ece8

Please sign in to comment.