Skip to content

Commit

Permalink
Merge branch 'develop' into docker-fully-qualified-image-names
Browse files Browse the repository at this point in the history
  • Loading branch information
jaedb authored Oct 28, 2024
2 parents 7cbe941 + 67adde2 commit 5b722f4
Show file tree
Hide file tree
Showing 54 changed files with 16,977 additions and 11,615 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: '14'
node-version: '18'

- name: Install modules
run: npm ci
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '12'
node-version: '18'

- name: Install JS dependencies
run: npm install
Expand All @@ -106,7 +106,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.11'

- name: "Install Python dependencies"
run: python3 -m pip install build
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14
v18
30 changes: 15 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# --- Build Node ---
FROM docker.io/rust:slim-bullseye AS Builder
FROM docker.io/rust:slim-bookworm AS Builder
LABEL org.opencontainers.image.authors="https://github.com/seppi91"
ARG TARGETPLATFORM
ARG TARGETARCH
Expand All @@ -23,16 +23,16 @@ RUN apt update \
libgstreamer-plugins-base1.0-dev \
libgstreamer1.0-dev \
libcsound64-dev \
libclang-11-dev \
libclang-14-dev \
libpango1.0-dev \
libdav1d-dev \
# libgtk-4-dev \ Only in bookworm
libgtk-4-dev \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/gst-plugins-rs

# Clone source of gst-plugins-rs to workdir
ARG GST_PLUGINS_RS_TAG=0.10.5
ARG GST_PLUGINS_RS_TAG=0.12.2
RUN git clone -c advice.detachedHead=false \
--single-branch --depth 1 \
--branch ${GST_PLUGINS_RS_TAG} \
Expand All @@ -53,7 +53,7 @@ RUN export CSOUND_LIB_DIR="/usr/lib/$(uname -m)-linux-gnu" \


# --- Release Node ---
FROM docker.io/debian:bullseye-slim as Release
FROM docker.io/debian:bookworm-slim as Release

# Switch to the root user while we do our changes
USER root
Expand All @@ -79,6 +79,7 @@ RUN apt-get update \
python3-gst-1.0 \
python3-setuptools \
python3-pip \
python3-venv \
# GStreamer (Plugins)
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
Expand All @@ -87,12 +88,15 @@ RUN apt-get update \
gstreamer1.0-pulseaudio \
&& rm -rf /var/lib/apt/lists/*

# Allow pip to install over system packages
ENV PIP_BREAK_SYSTEM_PACKAGES 1

# Copy builded target data from Builder DEST_DIR to root
# Note: target directory tree links directly to $GST_PLUGIN_PATH
COPY --from=Builder /target/gst-plugins-rs/ /

# Install Node, to build Iris JS application
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs

# Install mopidy and (optional) DLNA-server dleyna from apt.mopidy.com
Expand All @@ -101,14 +105,9 @@ RUN mkdir -p /etc/apt/keyrings \
&& wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg \
&& wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/bullseye.list \
&& apt-get update \
&& apt-get install -y \
mopidy \
&& apt-get install -y mopidy \
&& rm -rf /var/lib/apt/lists/*

# Upgrade Python package manager pip
# https://pypi.org/project/pip/
RUN python3 -m pip install --upgrade pip

# Clone Iris from the repository and install in development mode.
# This allows a binding at "/iris" to map to your local folder for development, rather than
# installing using pip.
Expand All @@ -129,9 +128,10 @@ RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/ja
# Copy Version file
&& cp /iris/VERSION /

# Install mopidy-spotify-gstspotify (Hack, not released yet!)
# (https://github.com/kingosticks/mopidy-spotify/tree/gstspotifysrc-hack)
RUN git clone --depth 1 https://github.com/mopidy/mopidy-spotify.git mopidy-spotify \
# Install Mopidy Spotify
ARG MOPIDY_SPOTIFY_TAG=v5.0.0a1
RUN git clone --depth 1 --single-branch -b ${MOPIDY_SPOTIFY_TAG} \
&& https://github.com/mopidy/mopidy-spotify.git mopidy-spotify \
&& cd mopidy-spotify \
&& python3 setup.py install \
&& cd .. \
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/reposit
# Install Node, to build Iris JS application
RUN apk add nodejs npm

# Upgrade Python package manager pip
# https://pypi.org/project/pip/
RUN python3 -m pip install --upgrade pip
# Allow pip to install over system packages
ENV PIP_BREAK_SYSTEM_PACKAGES 1

# Clone Iris from the repository and install in development mode.
# This allows a binding at "/iris" to map to your local folder for development, rather than
Expand Down
2 changes: 1 addition & 1 deletion IRIS_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.68.0
3.69.3
2 changes: 1 addition & 1 deletion __tests__/jest-yaml-transformer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const transformer = require("jest-transform-yaml").default
const transformer = require("yaml-jest").default

const newTransformer = {
...transformer,
Expand Down
21 changes: 12 additions & 9 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ version: "3"
services:
snapserver:
image: jaedb/snapserver
depends_on:
mopidy:
condition: service_healthy
ports:
- 1704:1704
- 1705:1705
- 1780:1780
- 1704
- 1705
- 1780
volumes:
- /tmp/snapserver:/tmp
- ./docker/snapserver/snapserver.conf:/etc/snapserver.conf
Expand All @@ -14,13 +17,13 @@ services:
image: jaedb/iris
environment:
- PIP_PACKAGES=Mopidy-YTMusic Mopidy-Tidal Mopidy-SoundCloud Mopidy-MusicBox-Webclient
build:
context: .
depends_on:
- snapserver
ports:
- 6600:6600
- 6680:6680
- 6600
- 6680
healthcheck:
test: curl -f http://localhost:6680/iris/http/get_config || exit 1
timeout: 5s
retries: 5
volumes:
# - ./mopidy/iris:/iris/mopidy/iris # To use a locally-built UI
- ./docker/mopidy/iris:/var/lib/mopidy/iris # Iris-specific storage
Expand Down
2 changes: 1 addition & 1 deletion mopidy_iris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from mopidy import config, ext

__version__ = "3.68.0"
__version__ = "3.69.3"

logger = logging.getLogger(__name__)

Expand Down
26 changes: 13 additions & 13 deletions mopidy_iris/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def load_from_file(self, name):
content = pickle.load(f)
f.close()
return content
except Exception:
except BaseException: # noqa: B036
if name == "pinned":
return []
else:
Expand All @@ -101,7 +101,7 @@ def save_to_file(self, dict, name):
with file_path.open("wb") as f:
pickle.dump(dict, f, pickle.HIGHEST_PROTOCOL)
pickle.close()
except Exception:
except BaseException: # noqa: B036
return False

##
Expand Down Expand Up @@ -139,7 +139,7 @@ def digest_protocol(self, protocol):
generated = False

# invalid, so just create a default connection, and auto-generate an ID
except BaseException:
except BaseException: # noqa: B036
client_id = self.generateGuid()
connection_id = self.generateGuid()
username = "Anonymous"
Expand Down Expand Up @@ -198,7 +198,7 @@ def send_message(self, *args, **kwargs):
callback(response)
else:
return response
except BaseException:
except BaseException: # noqa: B036
error = "Failed to send message to " + data["recipient"]
logger.error(error)

Expand Down Expand Up @@ -331,7 +331,7 @@ def remove_connection(self, connection_id):
"params": {"connection": client},
}
)
except BaseException:
except BaseException: # noqa: B036
logger.error("Failed to close connection to " + connection_id)

def set_username(self, *args, **kwargs):
Expand Down Expand Up @@ -671,7 +671,7 @@ async def load_more_tracks(self, *args, **kwargs):
await self.get_spotify_token()
spotify_token = self.spotify_token
access_token = spotify_token["access_token"]
except BaseException:
except BaseException: # noqa: B036
error = "IrisFrontend: access_token missing or invalid"
logger.error(error)
return False
Expand Down Expand Up @@ -971,7 +971,7 @@ async def run_command(self, *args, **kwargs):
try:
http_client = AsyncHTTPClient()
command_response = await http_client.fetch(request)
except Exception as e:
except Exception as e: # noqa: B036
error = {"message": "Command failed", "description": str(e)}
if callback:
callback(False, error)
Expand All @@ -982,13 +982,13 @@ async def run_command(self, *args, **kwargs):
# Attempt to parse body as JSON
try:
command_response_body = json.loads(command_response.body)
except BaseException:
except BaseException: # noqa: B036
# Perhaps it requires unicode encoding?
try:
command_response_body = tornado.escape.to_unicode(
command_response.body
)
except BaseException:
except BaseException: # noqa: B036
command_response_body = ""

# Finally, return the result
Expand Down Expand Up @@ -1038,7 +1038,7 @@ async def refresh_spotify_token(self, *args, **kwargs):
"client_secret": self.config["spotify"]["client_secret"],
"grant_type": "client_credentials",
}
except (Exception):
except BaseException: # noqa: B036
error = {
"message": "Could not refresh Spotify token: invalid configuration"
}
Expand Down Expand Up @@ -1111,7 +1111,7 @@ async def get_lyrics(self, *args, **kwargs):
try:
path = request.get_argument("path")
url = "https://genius.com" + path
except Exception as e:
except Exception as e: # noqa: B036
logger.error(e)
error = {"message": "Path not valid", "description": str(e)}

Expand All @@ -1126,7 +1126,7 @@ async def get_lyrics(self, *args, **kwargs):
+ " not connected",
}

except Exception as e:
except Exception as e: # noqa: B036
logger.error(e)
error = {
"message": "Unauthorized request",
Expand Down Expand Up @@ -1206,7 +1206,7 @@ async def update_snapcast_meta(self, *args, **kwargs):
"message": "Could not update Snapcast meta",
error: error,
}
except Exception as e:
except Exception as e: # noqa: B036
logger.error(e)
response = {"message": "Could not update Snapcast meta"}

Expand Down
6 changes: 3 additions & 3 deletions mopidy_iris/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def on_message(self, message):
error=error,
),
)
except Exception as e:
except Exception as e: # noqa: B036
logger.error(str(e))

else:
Expand Down Expand Up @@ -222,7 +222,7 @@ async def get(self, slug=None):
id=id, method=slug, response=response, error=error
),
)
except Exception as e:
except Exception as e: # noqa: B036
logger.error(str(e))

else:
Expand All @@ -241,7 +241,7 @@ async def post(self, slug=None):

try:
params = json.loads(self.request.body.decode("utf-8"))
except BaseException:
except BaseException: # noqa: B036
self.handle_result(
id=id,
error={"code": 32700, "message": "Missing or invalid payload"},
Expand Down
2 changes: 1 addition & 1 deletion mopidy_iris/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, path):


class IrisSystemThread(Thread):
_USE_SUDO = True
_USE_SUDO = os.environ.get("IRIS_USE_SUDO", True)

def __init__(self, action, ioloop, callback):
Thread.__init__(self)
Expand Down
6 changes: 5 additions & 1 deletion mopidy_iris/system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ elif [[ $1 = "restart" ]]; then
elif [[ $1 = "local_scan" ]]; then
START=$(date +%s)
if $IS_CONTAINER; then
SCAN=$(mopidy --config /config/mopidy.conf local scan)
if [ -n "$IRIS_CONFIG_LOCATION" ]; then
SCAN=$(mopidy --config $IRIS_CONFIG_LOCATION local scan)
else
SCAN=$(mopidy --config /config/mopidy.conf local scan)
fi
else
SCAN=$(sudo mopidyctl local scan)
fi
Expand Down
Loading

0 comments on commit 5b722f4

Please sign in to comment.