Wednesday, March 28, 2012

[android-developers] mediascannerconnection.scanFile does not update album_art

I have spent 2 entire days on this but havent been able to figure out,
if someone has any ideas, please please share.

I am basically trying to update the album_art on a user's music
collection. So, when a user is playing a track, he/she can make a "get
art" request. I fetch art from an external source and then actually
write the art and metadata to the mp3 file. All this is working great,
the file is accurately written with the new art.

My problem however is this, since the player uses the android
medialibrary to display metadata and art (MedisStore.Audio.Media),
this database does not seem to reflect the new art even after a
mediascannerconnection.scanFile. I found out that behind the content
provider for media, there is a sqlite database which has 3 tables of
interest, a "audio_meta" table, an "albums" table and yet another
"album_art". This never seems to get refreshed after the new art is
written to the file, even with a scanFile.

So, thinking I have to somehow flush the media cache, I issed a
follwing delete query into the activity, So, this code runs, and it
cleans up the tables accurately (blows the entry from audio_meta,
albums),

Here's the delete code

WinampApp.getInstance().getContentResolver().delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
String.[); and this works great

The code that exercises the oceancily

Thread thread = new Thread() {
@Override
public void run() {
// set the appropriate flags based on checkbox selection in the
UI
NError replicantSaveResult = AutoTagAlbum.save(mResultMetadata,
true, true);
if (replicantSaveResult == NError.Success) {
Log.i(TAG, "Successfully applied the metadata to the file");
setResult( FetcherActivity.RESULTS_APPLIED_SUCCESSFULLY );
if (mTrackUris != null && !mTrackUris.isEmpty()) {
// explicitly write the media library database
// not to rely solely on the mediascanner
final Iterator iter = mTrackUris.iterator();

SingleMediaScanner singleFileScanner = new
SingleMediaScanner(FetchResultDetailActivity.this, mTrackUris.size());

}
}

Please help ! The old art is no matter what '

Thanks
ego

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate