Skip to content

Commit

Permalink
Added instructions for audiocontrol2 and some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyTromp committed Feb 2, 2022
1 parent 53997f5 commit adb04c2
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 27 deletions.
14 changes: 6 additions & 8 deletions install_hifiberry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,22 +249,20 @@ echo "MQA_CODEC=${MQA_CODEC}" >> ${ENV_FILE}
echo "PLAYBACK_DEVICE=${PLAYBACK_DEVICE}" >> ${ENV_FILE}
log INFO "Finished creating .env file."

if [ -L "${CONFIG_FILE}" ]; then
log INFO "${CONFIG_FILE} already exists. this file will be replaced with new configuration."
rm "${CONFIG_FILE}"
fi
log INFO "Create config symlink -> ${ENV_FILE}"
[ -e "${CONFIG_FILE}" ]] && rm "${CONFIG_FILE}"
ln -s ${ENV_FILE} ${CONFIG_FILE}

#make sure to use vars as known in file
#not needed anymore
#source ${ENV_FILE}

# Generate docker-compose.yml
log INFO "Generating docker-compose.yml."
eval "echo \"$(cat templates/docker-compose.yml.tpl)\"" > Docker/docker-compose.yml
log INFO "Finished generating docker-compose.yml."

# Enable service
log INFO "Enabling TIDAL Connect Service."
#cp systemd/tidal.service /etc/systemd/system/
eval "echo \"$(cat templates/tidal.service.tpl)\"" >/etc/systemd/system/tidal.service

systemctl enable tidal.service
Expand All @@ -279,7 +277,7 @@ if [ -L "${BEOCREATE_SYMLINK_FOLDER}" ]; then
rm ${BEOCREATE_SYMLINK_FOLDER}
fi

echo "Adding TIDAL Connect Source to Beocreate UI."
log INFO "Adding TIDAL Connect Source to Beocreate UI."
ln -s ${PWD}/beocreate/beo-extensions/tidal ${BEOCREATE_SYMLINK_FOLDER}
log INFO "Finished adding TIDAL Connect Source to Beocreate."

Expand All @@ -294,6 +292,6 @@ log INFO "Starting TIDAL Connect Service."
./start-tidal-service.sh

log INFO "Restarting Beocreate 2 Service."
./restart_beocreate2.sh
./restart_beocreate2

log INFO "Finished, exiting."
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions speaker-controller-service
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# start/stop script for running the Speaker Controller Application
# This application enables controlling Tidal from the mobile device (Volume,Start/Stop,Next/Prev etc)

function start() {
# Stop if already running
if pgrep -f ^/app/ifi-tidal-release/bin/speaker_controller_application >/dev/null 2>&1
then
echo "Already running..."
stop
fi

echo "Starting Speaker Controller Application..."
docker exec -ti tidal_connect /usr/bin/tmux new-session -d -s speaker_controller_application '/app/ifi-tidal-release/bin/speaker_controller_application'
}


function stop() {
echo "Stopping Speaker Controller Application..."
docker exec -ti tidal_connect /usr/bin/tmux kill-session -t speaker_controller_application
}


case "$1" in
start) start ;;
stop) stop ;;
restart) stop; start ;;
*) echo "usage: $0 start|stop|restart" >&2
echo ""
exit 1
;;
esac

12 changes: 0 additions & 12 deletions start-audio-controller.sh

This file was deleted.

5 changes: 0 additions & 5 deletions stop-audio-controller.sh

This file was deleted.

2 changes: 0 additions & 2 deletions work-in-progress/audiocontrol2/README

This file was deleted.

66 changes: 66 additions & 0 deletions work-in-progress/audiocontrol2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

* Note! This modification is work-in-progress
And requires manual editting of the HifiBerryOS files.
If you are not comfortable with editting in Linux environment, wrongly modifying these files can lead to a non-working HifiBerryOS system. Therefore: ALWAYS make a backup of files that you are about to change. You do this modication at your own risk.

* Installation

1. You can either run the ./install.sh script or create the symbolic link manually.

```
# create symbolic link to add TidalController to AudioControl2 daemon
ln -s ${PWD}/tidalcontrol.py /opt/audiocontrol2/ac2/players/tidalcontrol.py
```
2. go and edit the file and initialize the player
```
nano /opt/audiocontrol2/audiocontrol2.py
```

3. Look for the following section and import the TidalControl class
```
from ac2.players.vollibrespot import VollibspotifyControl
from ac2.players.vollibrespot import MYNAME as SPOTIFYNAME
```

and add the following line so it looks like
```
from ac2.players.vollibrespot import VollibspotifyControl
from ac2.players.vollibrespot import MYNAME as SPOTIFYNAME
from ac2.players.tidalcontrol import TidalControl
```

4. Look for the following section and add code to add and initialize the TidalController
```
# Vollibrespot
vlrctl = VollibspotifyControl()
vlrctl.start()
mpris.register_nonmpris_player(SPOTIFYNAME,vlrctl)
```

into
```
# Vollibrespot
vlrctl = VollibspotifyControl()
vlrctl.start()
mpris.register_nonmpris_player(SPOTIFYNAME,vlrctl)
# TidalControl (ADD THIS PART)
tdctl = TidalControl()
tdctl.start()
mpris.register_nonmpris_player(tdctl.playername,tdctl)
```

5. Restart the AudioControl2 Daemon
```
# Stop AudioControl2 Daemon
systemctl stop audiocontrol2
# Start AudioControl2 Daemon
systemctl start audiocontrol2
```

6. Done!!!... Now open your HifiBerryOS webpage and start a song... you should see track metadata in the player. (controls from WEBUI still needs to be implemted. Controls work via Phone.)

* Audio Controll Api Reference
https://github.com/hifiberry/audiocontrol2/blob/master/doc/api.md

2 changes: 2 additions & 0 deletions work-in-progress/audiocontrol2/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ ln -s ${PWD}/tidalcontrol.py ${DST_PLAYER_FILE}
echo "NOTE - THIS IS STILL WORK IN PROGRESS"
echo ""
echo "You will need to manually setup /opt/audiocontrol2/audiocontrol2.py"
echo ""
echo "* PLEASE CHECK THE README FOR FURTHER INSTRUCTIONS *"
8 changes: 8 additions & 0 deletions work-in-progress/audiocontrol2/restart-audiocontrol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo "Stopping audiocontrol2"
systemctl stop audiocontrol2

echo "Starting audiocontrol2"
systemctl start audiocontrol2

0 comments on commit adb04c2

Please sign in to comment.