Wednesday, February 10, 2016

Personal streaming music server

Idea

I would like to have a private Spotify / Google Music / Apple music like setup. For free. As I already have bought the music once in the past.

Music files would be stored at home, but accessible anywhere. This way I could listen to all my favourite songs on the go. And do this with low end smartphones which have limited storage capacity but flat fee 3G/4G network access.

Server

Hardware

Raspberry PI to start with.

Software

  • Both the server and the mobile application keep on crashing
  • Depends on Tondo servers to be available. I can only hope their freemium business model is sustainable forever.
  • Implemented in Java
    • Needs to be configured for low ram from defaults
#MADSONIC_INIT_MEMORY=192
#MADSONIC_MAX_MEMORY=384
MADSONIC_INIT_MEMORY=32
MADSONIC_MAX_MEMORY=128

    • You need patience to start it up on a Raspi model B 
  • Auto start for now
    /etc/rc.local:
    su -c /var/madsonic/standalone/madsonic.sh pi

    Mobile application

    TBD

    General host/network setup

    • Public IP - attach to a VLAN outside the firewall
    • Dynamic DNS from changeip.com
    • Set up DNS update in /lib/dhcpcd/dhcpcd-hooks/60-changeip.com
    #!/bin/sh
    case "$reason" in
    BOUND|RENEW|REBIND|REBOOT)
    curl -u user:pass 'http://nic.ChangeIP.com/nic/update?cmd=update&hostname=hostname.xyz.com'
    ;;
    esac

    • Set up usbmount to automatically mount USB sticks

     sudo aptitude install usbmount

    • Set up NAT from a privileged port to an user process
    /etc/rc.local: 
    iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 4040 


    No comments:

    Post a Comment