using mpd to upload music to your android

I own an android smartphone and I’m a mpd user.

Using mpddroid, sshdroid and ubunturemote app I found a way to upload playlists from my mpd to my android. This way you can use your mpd to organize music on your android

I’m using Ubuntu Remote Control to admin my NAS. Ubuntu Remote Control is actually not limited to Ubuntu. You can use it to control every very Linux machine. So far this is the only app I found which has wake on LAN functionality included. Another aspect of the app I like is the ability to define custom commands and bin icons to them.

You can find Ubuntu Remote Control here

Ubuntu Remote Control on google play store

For my scripts to work you also need sshdroid. sshdroid is app which alows you to connect via ssh on your android. Even it is (like mine) not rooted. You can find sshdroid here:

sshdroid on google play store

For sshdroid to work you need to enable login via ssh-keys.

So ssh on your nas and run:

ssh-keygen

ssh-copy-id “root@192.168.178.26 -p 2222”

where 192.168.178.26 is the IP of your android device. I configured “static” IP for my android via my router as I don’t know any other way to do that on an none rooted android. You can also use your router to find out the local IP of your device.

once you did that you can test the setup via:

ssh root@192.168.178.36 -p 2222

if that works you can go on writing some scripts.

This scripts copys the current played track to your android device

#!/bin/bash
# copy current played track on mpd to android device
# simple shortcut to copy files to an android device running sshdroid
# sshdroid needs to be configured with ssh-key authentification
# username is root
file=`mpc -f %file% | head -n 1`
path=”/var/lib/mpd/music/media/$file”
scp -P 2222 “$path” root@192.168.178.26:/mnt/sdcard/music/
echo “finished transfering files to android device”

And Here is a script to copy a playlist to your android device

#!/bin/bash

PLAYLIST=/var/lib/mpd/android.m3u
while read line
do
scp -P 2222 “$line” root@192.168.178.26:/mnt/sdcard/music/
done </var/lib/mpd/playlists/android.m3u

Advertisements