Using local Database on Android but files on a webdav server.

General Discussion about MPD – anything that doesn't fit in the other MPD forums.
Post Reply
jdark
Posts: 7
Joined: March 22nd, 2019, 1:15 pm

Using local Database on Android but files on a webdav server.

Post by jdark » March 22nd, 2019, 1:32 pm

Hello,

first, my english is not native language, so tell me please when i have to rephrase something :)

i'm not sure if this case is possible with mpd:

i would like to search, filter by genre etc on Android device but play the results (files) from a webdav server. Did i understand correctly that it is possible to generate the database on the same machine where the webdav server is running and then using this database on an Android device to play tracks from the webdav machine over internet?

I have big music collection on my webdav server (webdav is the only possible connection protocol) and it takes too long to scan all files from webdav over internet. So i can only browse folders and never can filter by genre. Is there a solution for my problem?

max
Forum team
Posts: 884
Joined: January 15th, 2013, 3:43 pm

Re: Using local Database on Android but files on a webdav server.

Post by max » March 22nd, 2019, 3:07 pm

Yes, you can install MPD on the file server, and let it scan the music on its local hard disk; and then on Android, configure a "proxy" database: https://www.musicpd.org/doc/html/user.html#satellite

jdark
Posts: 7
Joined: March 22nd, 2019, 1:15 pm

Re: Using local Database on Android but files on a webdav server.

Post by jdark » March 25th, 2019, 7:26 am

Thanks.

As i understand the proxy function works in local network. I need to get it work outside my home network without the possibility to forward a port.
My file server is a nextcloud server which allows to access files through the webdav protocol from outside local network.

I've install Termux app on android and also the mpd server then. Basically the mpd runs.
It is possible to use a generated database from the file server on mpd instance running on Android and use a webdav url as music_directory?

I tried it in mpd.conf on android like this:

Code: Select all

music_directory "https://mywebdav.url/files/Music"

database {
 path "absolute path to the database copied from the file server"
}
But then mpd throws an expection: Unrecognized storage URI: https://mywebdav.url/files/Music

So im not sure what i made wrong.

max
Forum team
Posts: 884
Joined: January 15th, 2013, 3:43 pm

Re: Using local Database on Android but files on a webdav server.

Post by max » March 25th, 2019, 7:46 am


jdark
Posts: 7
Joined: March 22nd, 2019, 1:15 pm

Re: Using local Database on Android but files on a webdav server.

Post by jdark » March 25th, 2019, 9:01 am

mpd.conf:

Code: Select all

music_directory "https://user:pass@lukashome.ddns.net/remote.php/dav/files/admin/Musik"

log_level "verbose"
log_file "/data/data/com.termux/files/home/.mpd/log"


database {
	path "/data/data/com.termux/files/home/.mpd/mpd.db"
} 



--version:

Code: Select all

Music Player Daemon 0.21.5 (0.21.5)

Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2018 Max Kellermann <max.kellermann@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
 simple proxy

Storage plugins:
 local

Decoders plugins:
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [opus] opus ogg oga
 [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
 [dsdiff] dff
 [dsf] dsf
 [hybrid_dsd] m4a
 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve
 [pcm]

Filters:
 soxr

Tag plugins:


Output plugins:
 null sles fifo pipe openal pulse httpd recorder

Encoder plugins:
 null vorbis opus lame wave flac

Archive plugins:
 [bz2] bz2

Input plugins:
 file archive curl ffmpeg

Playlist plugins:
 extm3u m3u pls flac cue embcue

Protocols:
 file:// http:// https:// gopher:// rtp:// rtsp:// rtmp:// rtmpt:// rtmps://

Other features:
 ipv6 tcp un 


--verbose log

Code: Select all

config_file: loading file /data/data/com.termux/files/home/.mpd/mpd.conf
Mar 25 09:44 : exception: bind to '0.0.0.0:6600' failed (continuing anyway, because binding to '[::]:6600' succeeded): Failed to bind socket: Address already in use
Mar 25 09:44 : soxr: soxr converter 'high'
Mar 25 09:44 : vorbis: Xiph.Org libVorbis 1.3.6
Mar 25 09:44 : opus: libopus 1.3
Mar 25 09:44 : sndfile: libsndfile-1.0.29pre1
Mar 25 09:44 : exception: Unrecognized storage URI: https://user:pass@lukashome.ddns.net/remote.php/dav/files/admin/Musik 
user and pass are of course modified. The webdav url works.

max
Forum team
Posts: 884
Joined: January 15th, 2013, 3:43 pm

Re: Using local Database on Android but files on a webdav server.

Post by max » March 25th, 2019, 9:10 am

Your MPD build has no "curl" (WebDAV) storage plugin. It was disabled at compile time.

jdark
Posts: 7
Joined: March 22nd, 2019, 1:15 pm

Re: Using local Database on Android but files on a webdav server.

Post by jdark » March 25th, 2019, 10:02 am

Oh ye, i see. Thats not good. This build is from the package source of Termux.

Just saw, there is a MPD app at play store of you? Is this build/version usable for my usecase? Where to put the config file?


jdark
Posts: 7
Joined: March 22nd, 2019, 1:15 pm

Re: Using local Database on Android but files on a webdav server.

Post by jdark » March 25th, 2019, 2:53 pm

Ups. That was easy, sry.
But now there comes some tricky things. I need to use the pre-generated database from the webdav server.

I've copy the database file from my file-server into same directory as mpd.conf.
Added this to the conf:

Code: Select all

database {
	path "/storage/emulated/0/database"
}
Got an exception permission denied for reading/writing on that file.

I guess because without the database setting the app stores the database file in the private user directory.
Also the app doesn't want to have the WRITE_EXTERNAL_STORAGE permission in system settings. Only for reading.

Is there maybe an another location i can put the database file, which can be read by the MPD app?

jdark
Posts: 7
Joined: March 22nd, 2019, 1:15 pm

Re: Using local Database on Android but files on a webdav server.

Post by jdark » March 26th, 2019, 7:08 am

MPD Version from Playstore: 0.21

MPD Log:
Image

conf file like described above.

jdark
Posts: 7
Joined: March 22nd, 2019, 1:15 pm

Re: Using local Database on Android but files on a webdav server.

Post by jdark » March 28th, 2019, 2:12 pm

Hello, could you help me? I'm not able to compile the android source, i'm not used to all these tools.
I tried some quick and dirty solution:
Using apktool i did decompile the apk and added the permission:

Code: Select all

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

to the AndroidManifest.xml. Then rebuild and signed the apk.

MPD can write now to the data folder now but it seems that there are another problems:

Image

The database (generated on the fileserver) is not accepted. It is empty now.
Also https to webdav looks like not supported?
I guess this needs some more work to get it run. How long would it take?

Post Reply