https://github.com/bernhardfritz/pytunes
🎵 Self-hosted music streaming service
https://github.com/bernhardfritz/pytunes
balena music raspberry-pi
Last synced: about 1 month ago
JSON representation
🎵 Self-hosted music streaming service
- Host: GitHub
- URL: https://github.com/bernhardfritz/pytunes
- Owner: bernhardfritz
- License: mit
- Created: 2023-11-05T21:49:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-21T22:08:40.000Z (almost 2 years ago)
- Last Synced: 2025-08-18T03:38:56.677Z (about 2 months ago)
- Topics: balena, music, raspberry-pi
- Language: Python
- Homepage:
- Size: 42 KB
- Stars: 28
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pytunes






## How does it work?
pytunes analyzes [ID3](https://en.wikipedia.org/wiki/ID3) metadata of your MP3 files and generates [M3U](https://en.wikipedia.org/wiki/M3U) playlists so you can stream your music with an [HLS](https://en.wikipedia.org/wiki/HTTP_Live_Streaming)-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](https://docs.balena.io/learn/getting-started/).
- Open a terminal on your local computer and type:```bash
# 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# register another user
# htpasswd .htpasswd# deploy to balenaCloud
balena push
```- 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](https://docs.balena.io/learn/manage/ssh-access/#add-an-ssh-key-to-balenacloud).
- Determine your `balena-username` by typing:
```bash
balena whoami
```
- Determine your `APP ID` by typing:
```bash
balena fleet --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`):
```bash
scp -P 22222 track.mp3 @.local:/var/lib/docker/volumes/_pytunes-data/_data/
```
Alternatively you can also use an SFTP client of your choice like [FileZilla](https://filezilla-project.org/).
- 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](https://docs.balena.io/learn/manage/actions/#public-device-url).
- Install an HLS-compatible media player of your choice like [VLC](https://www.videolan.org/vlc/):[](https://www.videolan.org/vlc/download-windows.html)
[](https://www.videolan.org/vlc/download-macosx.html)
[](https://www.videolan.org/vlc/#download)
[](https://www.videolan.org/vlc/download-android.html)
[](https://www.videolan.org/vlc/download-ios.html)- Open network stream in VLC:
```
https://:@.balena-devices.com/
```
- Enjoy!## License
MIT