Skip to content

Commit

Permalink
Improve Mopidy installer.
Browse files Browse the repository at this point in the history
Fix errors when removing old configs.
Add more required packages (and additional packages for Raspberry Pi OS lite)
Fix Music directory to /home/$MOPIDY_USER/Music
Add groups to $MOPIDY_USER
  • Loading branch information
vinnybad authored and Gadgetoid committed Nov 14, 2024
1 parent 12b97eb commit 4634f17
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions mopidy/install.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ EXISTING_CONFIG=false
PYTHON_MAJOR_VERSION=3
PIP_BIN=pip3
MOPIDY_USER=$(whoami)
MUSIC_DIR="$HOME/Music"

function add_to_config_text {
CONFIG_LINE="$1"
Expand All @@ -35,7 +36,36 @@ warning() {
# Update apt and install dependencies
inform "Updating apt and installing dependencies"
sudo apt update
sudo apt install -y python3-spidev python3-pip python3-pil python3-numpy python3-lgpio python3-virtualenvwrapper virtualenvwrapper libopenjp2-7

# Comment out if you don't want to upgrade
sudo apt upgrade -y

# Install git and vim so the pimoroni pirate-audio repo can be copied (and b/c vim over nano any day :-) )
# sudo apt-get install -y git vim

sudo apt install -y \
python3-spidev \
python3-pip \
python3-pil \
python3-numpy \
python3-lgpio \
python3-virtualenvwrapper \
virtualenvwrapper \
libopenjp2-7 \
python3-gi \
libgstreamer1.0-0 \
libgstreamer1.0-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
gstreamer1.0-tools \
gstreamer1.0-gl \
gstreamer1.0-gtk3

sudo apt install python3-gst-1.0 gir1.2-gstreamer-1.0
sudo apt install gstreamer1.0-pulseaudio gstreamer1.0-alsa

echo

source $(dpkg -L virtualenvwrapper | grep virtualenvwrapper.sh)
Expand Down Expand Up @@ -125,14 +155,17 @@ echo
inform "Configuring Mopidy"
# Reset the config file
rm $MOPIDY_CONFIG
rm $MOPIDY_DEFAULT_CONFIG
rm -f $MOPIDY_CONFIG
rm -f $MOPIDY_DEFAULT_CONFIG
mkdir -p $MOPIDY_CONFIG_DIR
# Store a default fallback config, do we even need this?
mopidy config > $MOPIDY_DEFAULT_CONFIG
# Create a directory to hold local music
mkdir -p $MUSIC_DIR
# Add pirate audio customisations
cat <<EOF > $MOPIDY_CONFIG
Expand All @@ -146,7 +179,7 @@ bcm24 = volume_up,active_low,250
[file]
enabled = true
media_dirs = /home/$MOPIDY_USER/Music
media_dirs = $MUSIC_DIR
show_dotfiles = false
excluded_file_extensions =
.directory
Expand All @@ -162,6 +195,9 @@ excluded_file_extensions =
follow_symlinks = false
metadata_timeout = 1000
[local]
media_dir = $MUSIC_DIR
[pidi]
enabled = true
display = st7789
Expand All @@ -188,7 +224,7 @@ echo
# MAYBE?: Remove the sources.list to avoid any future issues with apt.mopidy.com failing
# rm -f /etc/apt/sources.list.d/mopidy.list
sudo usermod -a -G spi,i2c,gpio,video mopidy
sudo usermod -a -G spi,i2c,gpio,video $MOPIDY_USER
inform "Installing Mopdify VirtualEnv Service"
Expand Down

0 comments on commit 4634f17

Please sign in to comment.