Rescan media ignores .m3u playlists
Brought to you by:
zc2
If I run "Rescan media" on a directory, .m3u (playlist) files are ignored (although GC includes them in the count of scanned files), i.e. the corresponding playlists in the stock music player are not created/updated (the scan works OK for media files).
The only way I found to update the playlists is to reboot the device.
Expected behaviour: the rescan made by GC should include .m3u playlists files, like the rescan that is done automatically by android at boot time.
(I've heard of some apps to create/manage .m3u files on android, so I guess this is technically feasible)
Samsung cell phone
Android: 4.2.2
GC: 1.54b1 (from f-droid repository)
Maybe this can help?
https://stackoverflow.com/questions/19929827/android-doesnt-see-playlist-m3u-file?rq=1
No, that approach is depricated. We supposed to use the MediaScannerConnection object instead.
Do you know any application (preferable open sourced) which actually ably to add a .m3u file to the medialibrary?
Uhm, I checked the music players available in the f-droid repository but none seems to handle .m3u files the way we need.
BUT, maybe you can have a look at Slight backup
https://f-droid.org/packages/de.shandschuh.slightbackup/
it can dump/restore playlists to/from an XML format (I use it often and never had a problem), so I guess it can somehow update the playlist data in the mediastore.
Ah, another link I found, maybe useful, maybe not...
https://stackoverflow.com/questions/3300137/how-can-i-refresh-mediastore-on-android
Anyway, does GC really have to actually deal with the .m3u file directly? Can't you just tell android "hey rescan this directory" and let the android media scanner deal automatically with all kinds of files it finds in there, as it does at boot (or when the SD card is remounted)?
As far as I know it does. I call the method scanFile() for each file individually, there is no way to scan a directory.
The problem with .m3u file, for some reason, the call back method (onScanCompleted() ) is called with null as the URI, meaning the media store was failed to add the file to the library. I tried to pass different mime type string to the scanFile() method, no avail.
Did you try "audio/x-mpegurl" and "application/x-mpegurl" ? It seems these are expected by android. See: https://github.com/android/platform_frameworks_base/blob/82834baa358f55acb542e17da828b2d497cf8332/media/java/android/media/MediaFile.java
Other types are listed here:
https://en.wikipedia.org/wiki/M3U#Internet_media_types
"audio/x-mpegurl" was originally. I tried "application/x-mpegurl", and onScanCompleted() still passes null as the url, so it fails too.