Skip to content

bernhardfritz/pytunes

Repository files navigation

pytunes

Docker FastAPI Nginx Postgres Python Raspberry Pi Redis

How does it work?

pytunes analyzes ID3 metadata of your MP3 files and generates M3U playlists so you can stream your music with an HLS-compatible media player over the internet.

Instructions

  • Set up your Raspberry Pi device with balenaOS in production mode and bring it online on the balenaCloud dashboard by following the getting started guide.

  • Open a terminal on your local computer and type:

    # clone repository
    git clone https://github.com/bernhardfritz/pytunes.git
    
    # change directory
    cd pytunes
    
    # generate database password
    cp .env.template .env && echo "$(date | md5sum | head -c 32)" >> .env
    
    # register first user
    htpasswd -c .htpasswd <username>
    
    # register another user
    # htpasswd .htpasswd <another username>
    
    # deploy to balenaCloud
    balena push <fleet name>
  • Please be patient. It might take a couple of minutes until deployment is complete.

  • You should see a log line in your balenaCloud dashboard once pytunes has started successfully:

    INFO:     Application startup complete.
    
  • Add your public SSH key to balenaCloud by following the SSH access guide.

  • Determine your balena-username by typing:

    balena whoami
  • Determine your APP ID by typing:

    balena fleet <fleet name> --fields=id
  • Copy an MP3 file from your local computer to your Raspberry Pi (short-uuid refers to the first 7 characters of your BALENA_DEVICE_UUID):

    scp -P 22222 track.mp3 <balena-username>@<short-uuid>.local:/var/lib/docker/volumes/<APP ID>_pytunes-data/_data/

    Alternatively you can also use an SFTP client of your choice like FileZilla.

  • pytunes will automatically start processing MP3 files as soon as they have been received.

  • You should see a log line in your balenaCloud dashboard once an MP3 file has been processed successfully:

    21:01:35 default: Job OK (a9e5765b-f1f8-4dc6-8ecd-166a2e21f6d1)
    
  • Expose your Raspberry Pi to the internet by switching on public device URL.

  • Install an HLS-compatible media player of your choice like VLC:

    Windows macOS Linux Android iOS

  • Open network stream in VLC:

    https://<username>:<password>@<BALENA_DEVICE_UUID>.balena-devices.com/
    
  • Enjoy!

License

MIT

About

🎵 Self-hosted music streaming service

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published