index albumartist

This commit is contained in:
Adrian Ulrich 2017-02-17 22:29:09 +01:00
parent 7b638550b9
commit 9a36558064
2 changed files with 18 additions and 0 deletions

View File

@ -45,6 +45,7 @@ public class MediaLibrary {
public static final int ROLE_ARTIST = 0;
public static final int ROLE_COMPOSER = 1;
public static final int ROLE_ALBUMARTIST = 2;
private static final String PREF_KEY_FORCE_BASTP = "force_bastp";
private static final String PREF_KEY_GROUP_ALBUMS = "group_albums";

View File

@ -495,6 +495,23 @@ public class MediaScanner implements Handler.Callback {
mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS_SONGS, null, v);
}
// Same as with composer: albumartist is an optional tag
String albumartist = tags.getFirst(MediaMetadataExtractor.ALBUMARTIST);
if (albumartist != null) {
long albumartistId = MediaLibrary.hash63(albumartist);
v.clear();
v.put(MediaLibrary.ContributorColumns._ID, albumartistId);
v.put(MediaLibrary.ContributorColumns._CONTRIBUTOR, albumartist);
v.put(MediaLibrary.ContributorColumns._CONTRIBUTOR_SORT, MediaLibrary.keyFor(albumartist));
mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS, null, v);
v.clear();
v.put(MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID, albumartistId);
v.put(MediaLibrary.ContributorSongColumns.SONG_ID, songId);
v.put(MediaLibrary.ContributorSongColumns.ROLE, MediaLibrary.ROLE_ALBUMARTIST);
mBackend.insert(MediaLibrary.TABLE_CONTRIBUTORS_SONGS, null, v);
}
// A song might be in multiple genres
if (tags.containsKey(MediaMetadataExtractor.GENRE)) {
ArrayList<String> genres = tags.get(MediaMetadataExtractor.GENRE);