MPD icon indicating copy to clipboard operation
MPD copied to clipboard

Android: Now that mpd.conf is in dedicated folder, how do I get access to it?

Open roiz-git opened this issue 3 years ago • 2 comments

Question

Describe the bug

0.23.9 overcame the Android restriction for file permissions, ok so mpd.conf is now located under Android/data/org.musicpd/files but how can I access this folder file manager/terminal/adb do not have access to it While I am not an expert, wouldn't it be more practical to store the file under shared storage? (https://developer.android.com/training/data-storage/app-specific)

roiz-git avatar Aug 20 '22 14:08 roiz-git

Shared storage is only accessible with Java APIs, i.e. all file accesses need to be rewritten to be routed through JNI instead of using good old POSIX file APIs. And all this just to circumvent Google's stupid Android API design. My time is too precious for shit like that. (Sorry for the language. These Android "improvements" have been annoying me a lot.)

MaxKellermann avatar Sep 06 '22 19:09 MaxKellermann

no worries, just trying to ignite some ideas...i appreciate your hard work on MPD over the years

roiz-git avatar Sep 11 '22 19:09 roiz-git

I encountered the same issue after just discovering the new expected location for mpd.conf. It seems without root permission I'm not able to create a file in that folder or move an existing file into it. I'll update if I find any possible way to create the file there.

olliejm avatar Jan 08 '23 16:01 olliejm

I found a way to do this. As follows:

  1. Enable Android developer mode (usually by repeatedly tapping on the build number in Settings -> About Phone)
  2. In developer options, enable USB debugging
  3. On a PC (either Linux/Windows/Mac) install Android Debug Bridge (adb)
  4. Plug the phone into the PC via USB and allow debugging on the phone when it prompts
  5. Run adb devices and make sure the device is detected/attached
  6. Run adb -d shell to get a shell into your phone
  7. cd your way to the Android/data/org.musicpd/files directory (the full path to Android might differ per phone)
  8. Echo the desired mpd.conf content into a new file, e.g. for me it was:

echo 'music_directory "nfs://my-nfs-host/path/to/music" database { plugin "proxy" host "my-nfs-host" }' > mpd.conf

I was then able to run MPD as before.

olliejm avatar Jan 08 '23 17:01 olliejm