Merge pull request #388 from arkon/filter-genres

Only show genres with songs
This commit is contained in:
Karim Abou Zeid 2017-12-26 21:15:24 +01:00 committed by GitHub
commit 62a8443cb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,10 +64,15 @@ public class GenreLoader {
Genres.NAME
};
// Genres that actually have songs
final String selection = Genres._ID + " IN" +
" (SELECT " + Genres.Members.GENRE_ID + " FROM audio_genres_map WHERE " + Genres.Members.AUDIO_ID + " IN" +
" (SELECT " + Genres._ID + " FROM audio_meta WHERE " + SongLoader.BASE_SELECTION + "))";
try {
return context.getContentResolver().query(
Genres.EXTERNAL_CONTENT_URI,
projection, null, null, PreferenceUtil.getInstance(context).getGenreSortOrder());
projection, selection, null, PreferenceUtil.getInstance(context).getGenreSortOrder());
} catch (SecurityException e) {
return null;
}