vanilla-music / vanilla

Vanilla Music Player for Android
GNU General Public License v3.0
1.16k stars 291 forks source link

external SD & SAF support #691

Open HI54U opened 6 years ago

HI54U commented 6 years ago

Description

First of all let me say, that your Musicplayer is my absolutely favorite and I hope really to find a solution for getting access to an OTG USB Harddisk for adding music files. I already checked the other issues for Sdcards like #439 an tried unsuccessful the recommended SD Scanner. This issue is a matter of the "new" SAF (Storage Access Framework) to access USB-OTG storage.

Steps to reproduce the issue

I attached a harddisk/USB-Stick via OTG and can see the harddisk in the main Window in the folder Tab in /storage/ and also in mnt/media_rw. If I want to add the drive in the settings to the database I can't see the drive in /storage (only emulated and self Dir) nor in /mnt.

I have access to the harddisk only with the stock file explorer and Total Commander who are capable of using SAF. Maybe there's a chance that you can implement SAF or maybe just adding folders with help of the stock player.

adrian-bl commented 6 years ago

If I want to add the drive in the settings to the database I can't see the drive in /storage (only emulated and self Dir) nor in /mnt.

So you can see (and use) the drive in the media libraries 'Files' tab but not in the settings? That's strange: The code responsible for the file listing (https://github.com/vanilla-music/vanilla/blob/master/src/ch/blinkenlights/android/vanilla/FolderPickerAdapter.java#L194) does a simple readdir - with one small hack: If the directory is NOT readable, it will simulate the default storage directory to be there (But then you wouldn't see 2 entries)

Would you mind uploading a screenshot of the two cases? Also: What does 'adb shell ls -l /storage' show?

HI54U commented 6 years ago

That's not strange at, because SAF aren't supported by most of the media programs. But I found a workaround with this command in a shell: su sm set-force-adoptable true

with this command the harddisk will be mounted as adoptable storage. Tested with FAT32 and NTFS disks and LOS13.1 and 14.1.

Maybe this is helpful also for others which encountered the same problem.

adrian-bl commented 6 years ago

That's not strange at, because SAF aren't supported by most of the media programs.

But you said that you can see the drive in the media library (but not in the settings). This would be very strange as both parts of the code are quite similar (and neither has any special SAF handling). Or did i misunderstand you?

dclaar commented 6 years ago

I would love to see support for SAF/Directory selection, as my pixel doesn't make the SD card available any other way: It's completely invisible to the app. Supposedly, this is "the" new way to access media.

(https://developer.android.com/about/versions/android-5.0.html#Storage)

adrian-bl commented 6 years ago

as my pixel doesn't make the SD card available

As far as i know, the Pixel does not have an SD-Card. Vanilla should totally have read access to the internal media storage. Which paths are listed in the media scanner? (Settings -> Media Library)

I would be very surprised to see any breakage on the Pixel as Vanilla Music works just fine on my Nexus 5X running Android 8.

dclaar commented 6 years ago

Ah, well, I wanted to use OTG and an external SD, like the OP.

On Nov 21, 2017 11:00 AM, "Adrian Ulrich" notifications@github.com wrote:

as my pixel doesn't make the SD card available

As far as i know, the Pixel does not have an SD-Card. Vanilla should totally have read access to the internal media storage. Which paths are listed in the media scanner? (Settings -> Media Library)

I would be very surprised to see any breakage on the Pixel as Vanilla Music works just fine on my Nexus 5X running Android 8.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vanilla-music/vanilla/issues/691#issuecomment-346127089, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYK4kLNgHyyiDMdaihJjMKG0sTJ5au-ks5s4x3IgaJpZM4QKBwe .

SebiderSushi commented 6 years ago

I would welcome SAF support to acquire write access to external media for deleting tracks from my SD card using Vanilla Music.

aario commented 5 years ago

I would welcome SAF support to acquire write access to external media for deleting tracks from my SD card using Vanilla Music. I can even kill a whole weekend develop this myself. The problem is that I don't know how long will it take until I prepare necessary development environment and all dependencies and where in code to start from! So it can take 10 times less effort for developers to fix this issue instead of users forking it. Thanks in advance.

adrian-bl commented 5 years ago

So it can take 10 times less effort for developers to fix this issue instead of users forking it.

I have no idea how SAF works. So you would be as fast as i am.

Building vanilla is just a matter of cloning the repo and launching a gradle build.

Thanks in advance.

https://www.youtube.com/watch?v=pWdd6_ZxX8c

andiandi13 commented 5 years ago

Is that really hard to authorize Vanilla writing to external SD ?

I mean the majority of music player ask for the permission

adrian-bl commented 5 years ago

The problem is that most roms only allow access using SAF, which is a completely different way on how to interact with the filesystem.

With android Q, we most likely will be forced to switch to SAF anyway, which is a pity.

Kaned1as commented 5 years ago

With android Q, we most likely will be forced to switch to SAF anyway, which is a pity.

WHAT?? This abomination!? I'm dead.

adrian-bl commented 5 years ago

Yeah, not happy about that.

My plan is to build a VFS abstraction interface which provides a vfs & saf implementation.

Then all IO in Vanilla would just use that interface, which hopefully should hide lot of the complexity of SAF.