Skip to content

Commit

Permalink
Merge pull request fluttercommunity#6 from SuaMusica/fill_album_artis…
Browse files Browse the repository at this point in the history
…t_column_on_media_store

Insert artist name on column MediaStore.Audio.Media.ALBUM_ARTIST too
  • Loading branch information
atrope committed Oct 19, 2020
2 parents c62f23b + c4e60a5 commit caf833b
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,17 +635,15 @@ private void addMediaToGallery(String fileName, String filePath, String contentT
values.put(MediaStore.Audio.Media.DATA, filePath);
values.put(MediaStore.Audio.Media.SIZE, file.getTotalSpace());

if (argMusicArtist != null) {
values.put(MediaStore.Audio.Media.ARTIST, argMusicArtist);
}

if (argMusicAlbum != null) {
values.put(MediaStore.Audio.Media.ALBUM, argMusicAlbum);
}

if (argSMExtras != null) {
values.put(MediaStore.Audio.Media.BOOKMARK, argSMExtras);
}
values.put(MediaStore.Audio.Media.ARTIST, argMusicArtist);
values.put(MediaStore.Audio.Media.ALBUM, argMusicAlbum);
values.put(MediaStore.Audio.Media.BOOKMARK, argSMExtras);

// For reasons I could not understand, Android SDK is failing to find the
// constant MediaStore.Audio.Media.ALBUM_ARTIST in pre-compilation time and
// obligated me to reference the column string value.
// However it's working just fine.
values.put("album_artist", argMusicArtist);

values.put(IS_PENDING, 1);
log("insert " + values + " to MediaStore");
Expand Down

0 comments on commit caf833b

Please sign in to comment.