Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidhampgonsalves/music-server
Music streaming server on a Android Galaxy S7
https://github.com/davidhampgonsalves/music-server
android featured termux
Last synced: 5 days ago
JSON representation
Music streaming server on a Android Galaxy S7
- Host: GitHub
- URL: https://github.com/davidhampgonsalves/music-server
- Owner: davidhampgonsalves
- Created: 2022-03-14T11:25:42.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-12T19:32:21.000Z (5 months ago)
- Last Synced: 2024-08-01T16:46:19.278Z (3 months ago)
- Topics: android, featured, termux
- Language: Shell
- Homepage: https://davidhampgonsalves.com/junk-drawer-phone-as-a-music-streaming-server/
- Size: 11.7 KB
- Stars: 75
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Setup for my personal [Navidrome](https://github.com/navidrome/navidrome) based music streaming server running on a Samsung Galaxy S7 using [Termux](https://termux.dev/en/).
## features
* Uses [Termux:Boot](https://wiki.termux.com/wiki/Termux:Boot) & [Termux-Services](https://wiki.termux.com/wiki/Termux-services) to automatically start everything on boot.
* Automatically removes songs with ☆☆☆☆★ reviews.
* Uses Cloudflare for dynamic DNS updates.## Add Music
I transfer music using SFTP after converting to OPUS. The S7 only has about 20GB of usable storage and this makes a big difference.IOS doesn't do OPUS except in a CAF and Navidrome doesn't like the CAF container.
```
mkdir mp3
find . -iname '*.mp3' -exec bash -c 'F=$(cat /dev/urandom | gtr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1); ffmpeg -i "{}" -codec:a libmp3lame -qscale:a 6 "../mp3/$F.mp3"' \;
```## Install
* Install [F-Droid](https://f-droid.org/en/) and then Termux + Termux:Boot.
* Launch Termux:Boot and then exit.
* send this to your phone and paste into termux terminal.
```
pkg update && pkg upgrade && pkg add openssh -y
passwd "password" --stdin
ifconfig
whoami
sshd
```
* SSH into phone from computer.
ssh [email protected] -p 8022
```
pkg add git wget neovim -y
git clone https://github.com/davidhampgonsalves/music-server.git
```### Navidrome
Termux can't run binaries, even if they are built for arm64. As such we will build navidrome.
```
pkg add golang taglib build-essential
git clone https://github.com/navidrome/navidrome 8b93962
// might want to checkout a specfic commit that matches a release
mkdir music
cd navidrome
cp ../music-server/navidrome.toml ./
make setup// building the navidrone UI OOM's on my Samsung Galaxy S7
// so build it on a PC (via cd ui ; npm install ; npm run build) and
// then transfer the ui/build contents to the same folder under navidrome via sftp
// This has to be done before `go build` or else it won't be included in binarygo mod download
go build// setup sshd and navidrome as services
pkg install termux-services
// restart so that daemon starts
mkdir -p $PREFIX/var/service/navidrome/log
ln -s $PREFIX/share/termux-services/svlogger $PREFIX/var/service/navidrome/log/run
chmod u+x $PREFIX/var/service/navidrome/runmkdir -p $PREFIX/var/service/navidrome
mv ~/music-server/navidrome.runit.sh $PREFIX/var/service/navidrome/run
chmod ugo+x $PREFIX/var/service/navidrome/run
mkdir -p $PREFIX/var/service/navidrome/log
mkdir -p $PREFIX/var/log/sv/navidrome
ln -sf $PREFIX/share/termux-services/svlogger $PREFIX/var/service/navidrome/log/run
// Logs are at `cat $PREFIX/var/log/sv/navidrome/current` but do not seem to work
// sv up/down/status navidrome`
sv-enable sshd
sv-enable navidrome
```### Termux Boot
```
mkdir ./termux/boot
mv music-server/boot/start-services .termux/boot/
chmod ugo+x .termux/boot/start-services
```# DDNS
python venv creation(happening in start-sync.sh) was hanging so after installing the requirements from start-sync.sh I commented out everything except `cd ... ; python ...`.
```
git clone https://github.com/timothymiller/cloudflare-ddns.git
chmod +x /data/data/com.termux/files/home/cloudflare-ddns/start-sync.sh
chmod +x /data/data/com.termux/files/home/music-server/remove-starred-tracks.sh
ln -s /data/data/com.termux/files/home/music-server/cloudflare-ddns.config.json /data/data/com.termux/files/home/cloudflare-ddns/config.jsonpkg install cronie termux-services python sqlite
sv-enable crond
crontab /data/data/com.termux/files/home/music-server/crontab
```