[GUIDE] Install Headphones

Hi All,

This guide is adapted from this one for the MBL by nfodiz (so don’t forget to give him kudus). I mostly changed the location to be relevant to My Cloud and simplified the startup script.

  1. If you don’t have SSH active, log in on the webui and activate it.  Make SSH connection to MC (windows users can use PUTTY)

  2. In SSH, go to the parent folder of where you want the Headphones folder to be. I recommend not to put it on your system partitiion so that it doesn’t get clogged and you can keep your data after firmware updates.
    Personally I created an Apps folder under DataVlume/shares/Apps where I keep all my apps.
    If you want to follow my example do:

    mkdir /DataVolume/shares/Apps
    cd /DataVolume/shares/Apps

  3. Download the latest Headphones from Github:

    wget http://github.com/rembo10/headphones/tarball/master

 4)You now have a file named master  in current folder. Extract it

tar -xzvf master

  5) You will now have a folder named rembo10-headphones-e879af6. Rename it to Headphones

mv rembo10* Headphones
  1. Start Headphones for the first time manually*:

    /usr/bin/python2.7 /shares/Apps/Headphones/Headphones.py

You will get a message asking you to update. go to the webinterface at mycloudip:8181 and click on update pop-up.

  1. Create a startup script for Headphones. Enter:

    nano /etc/init.d/headphones

 and paste the following into it*:

#! /bin/sh

### BEGIN INIT INFO
# Provides: headphones
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Should-Start: $NetworkManager
# Should-Stop: $NetworkManager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of Headphones
# Description: starts instance of Headphones using start-stop-daemon
### END INIT INFO

# Check for existance of defaults file
# and utilze if available
if [-f /etc/default/headphones]; then
    . /etc/default/headphones
else
    echo "/etc/default/headphones not found using default settings.";
fi

# Script name
NAME=headphones

# App name
DESC=Headphones

# Path to app root
HP_APP_PATH=${APP_PATH-/shares/Apps/Headphones}

# User to run CP as
HP_RUN_AS=${RUN_AS-root}

# Path to python bin
HP_DAEMON=${DAEMON_PATH-/usr/bin/python2.7}

# Path to store PID file
HP_PID_FILE=${PID_FILE-/var/run/headphones.pid}

# Other startup args
HP_DAEMON_OPTS=" Headphones.py --quiet --daemon --nolaunch --pid_file=${HP_PID_FILE}"

test -x $HP_DAEMON || exit 0

set -e

case "$1" in
  start)
        echo "Starting $DESC"
        rm -rf $HP_PID_FILE || return 1
        touch $HP_PID_FILE
        chown $HP_RUN_AS $HP_PID_FILE
        start-stop-daemon -d $HP_APP_PATH -c $HP_RUN_AS --start --background --pidfile $HP_PID_FILE --exec $HP_DAEMON -- $HP_DAEMON_OPTS
        ;;
  stop)
        echo "Stopping $DESC"
        start-stop-daemon --stop --pidfile $HP_PID_FILE --retry 15
        ;;

  restart|force-reload)
        echo "Restarting $DESC"
        start-stop-daemon --stop --pidfile $HP_PID_FILE --retry 15
        start-stop-daemon -d $HP_APP_PATH -c $HP_RUN_AS --start --background --pidfile $HP_PID_FILE --exec $HP_DAEMON -- $HP_DAEMON_OPTS
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0

 Save the script ( by pressing ctrl-x, then y, enter)

 * replace “/shares/Apps/” with whichever folder you chose as the parent for Headphones.

 8) Set Headphones to start on reboot:

chmod 755 /etc/init.d/headphones
update-rc.d headphones defaults

 9) Strat Headphones:

/etc/init.d/headphones start

Headphones should be up and running.

 10)  After verifying everything is working oyu can now delete the downloaded archive

rm master

If you have any questions/improvements/suggestion post them below.
Feel free toi press the kudus button if this post helped you.

Enjoy!

1 Like

Hello,

Thank you for sharing this.