Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jaedb committed May 20, 2023
2 parents e7d19ce + aaae821 commit 5ef872a
Show file tree
Hide file tree
Showing 28 changed files with 350 additions and 459 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

name: ${{ matrix.name }}
runs-on: ubuntu-20.04
container: ghcr.io/mopidy/ci:latest
container: ghcr.io/mopidy/ci:7
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ RUN apt update \
WORKDIR /usr/src/gst-plugins-rs

# Clone source of gst-plugins-rs to workdir
ARG GST_PLUGINS_RS_TAG=main
ARG GST_PLUGINS_RS_TAG=0.10.5
RUN git clone -c advice.detachedHead=false \
--single-branch --depth 1 \
--branch ${GST_PLUGINS_RS_TAG} \
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git ./
# EXPERIMENTAL: For gstreamer-spotify set upgraded version number of dependency librespot to 0.4.2
RUN sed -i 's/librespot = { version = "0.4", default-features = false }/librespot = { version = "0.4.2", default-features = false }/g' audio/spotify/Cargo.toml

# Build GStreamer plugins written in Rust (optional with --no-default-features)
ENV DEST_DIR /target/gst-plugins-rs
Expand Down Expand Up @@ -99,9 +97,9 @@ RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \

# Install mopidy and (optional) DLNA-server dleyna from apt.mopidy.com
# see https://docs.mopidy.com/en/latest/installation/debian/
RUN mkdir -p /usr/local/share/keyrings \
&& wget -q -O /usr/local/share/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/buster.list \
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 \
Expand Down Expand Up @@ -133,7 +131,7 @@ RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/ja

# Install mopidy-spotify-gstspotify (Hack, not released yet!)
# (https://github.com/kingosticks/mopidy-spotify/tree/gstspotifysrc-hack)
RUN git clone --depth 1 -b gstspotifysrc-hack https://github.com/kingosticks/mopidy-spotify.git mopidy-spotify \
RUN git clone --depth 1 https://github.com/mopidy/mopidy-spotify.git mopidy-spotify \
&& cd mopidy-spotify \
&& python3 setup.py install \
&& cd .. \
Expand Down
81 changes: 81 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Use Alpine edge for now as some required dependencies are only in the testing repository
FROM alpine:edge

# Switch to the root user while we do our changes
USER root
WORKDIR /

# Install GStreamer and other required Debian packages
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk update \
&& apk add \
dumb-init \
shadow \
sudo \
git \
py3-pip \
mopidy \
py3-mopidy-spotify

# 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

# 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.
# Note: ADD helps prevent RUN caching issues. When HEAD changes in repo, our cache will be invalidated!
ADD https://api.github.com/repos/jaedb/Iris/git/refs/heads/master version.json
ENV IRIS_VERSION=develop
RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/jaedb/Iris.git /iris \
&& cd /iris \
&& npm install \
&& npm run prod \
&& python3 setup.py develop \
&& mkdir -p /var/lib/mopidy/.config \
&& ln -s /config /var/lib/mopidy/.config/mopidy \
# Allow mopidy user to run system commands (restart, local scan, etc)
&& echo "mopidy ALL=NOPASSWD: /iris/mopidy_iris/system.sh" >> /etc/sudoers \
# Enable container mode (disable restart option, etc.)
&& echo "1" >> /IS_CONTAINER \
# Copy Version file
&& cp /iris/VERSION /

# Install additional mopidy extensions and Python dependencies via pip
COPY docker/requirements.txt .
RUN python3 -m pip install -r requirements.txt

# Cleanup
RUN rm -rf /root/.cache \
&& rm -rf /iris/node_modules

# Start helper script.
COPY docker/entrypoint.sh /entrypoint.sh

# Copy Default configuration for mopidy
COPY docker/mopidy/mopidy.example.conf /config/mopidy.conf

# Copy the pulse-client configuratrion
COPY docker/mopidy/pulse-client.conf /etc/pulse/client.conf

# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID.
# RUN useradd -ms /bin/bash mopidy
ENV HOME=/var/lib/mopidy
RUN set -ex \
&& usermod -G audio,wheel mopidy \
&& mkdir /var/lib/mopidy/local \
&& chown mopidy:audio -R $HOME /entrypoint.sh /iris \
&& chmod go+rwx -R $HOME /entrypoint.sh /iris

# Runs as mopidy user by default.
USER mopidy:audio

VOLUME ["/var/lib/mopidy/local"]

EXPOSE 6600 6680 1704 1705 5555/udp

ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint.sh"]
CMD ["mopidy"]
2 changes: 1 addition & 1 deletion IRIS_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.66.1
3.67.0
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include mopidy_iris/ext.conf
include mopidy_iris/system.sh
include IRIS_VERSION
include Dockerfile
include Dockerfile.alpine
include pyproject.toml
include screenshot.jpg
include tox.ini
Expand Down
8 changes: 4 additions & 4 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
#!/bin/sh

if [ -z "$PULSE_COOKIE_DATA" ]
then
echo -ne $(echo $PULSE_COOKIE_DATA | sed -e 's/../\\x&/g') >$HOME/pulse.cookie
export PULSE_COOKIE=$HOME/pulse.cookie
printf '%s' "$(echo "$PULSE_COOKIE_DATA" | sed -e 's/../\\x&/g')" >"$HOME"/pulse.cookie
export PULSE_COOKIE="$HOME"/pulse.cookie
fi

if [ ${PIP_PACKAGES:+x} ]; then
echo "-- INSTALLING PIP PACKAGES $PIP_PACKAGES --"
python3 -m pip install --no-cache $PIP_PACKAGES
python3 -m pip install --no-cache --upgrade "$PIP_PACKAGES"
fi

exec "$@"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
},
"scripts": {
"test": "jest",
"tox": "docker exec -it -u root iris_mopidy_1 bash -c \"cd /iris && tox\"",
"tox": "docker exec -it -u root mopidy bash -c \"cd /iris && tox\"",
"start": "NODE_ENV=development WEBPACK_DEV_SERVER=1 webpack-dev-server",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</body>
<script type="text/javascript">
if ('serviceWorker' in navigator){
navigator.serviceWorker.register('service-worker.js')
navigator.serviceWorker.register('<%= baseHref %>service-worker.js')
.then(function(registration){
console.log('Service worker registered');
}).catch(function(error){
Expand Down
2 changes: 1 addition & 1 deletion src/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Content = () => (
<Route path="queue/history" element={<QueueHistory />}/>
<Route path="settings/debug" element={<Debug />} />
<Route path="settings/*" element={<Settings />} />
<Route path="search/" element={<Search />} />
<Route path="search" element={<Search />} />
<Route path="search/:type/:term" element={<Search />} />
<Route path="artist/:uri/*" element={<Artist />} />
<Route path="album/:uri/" element={<Album />} />
Expand Down
1 change: 1 addition & 0 deletions src/js/components/ContextMenu/PlaylistSubmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useDispatch } from 'react-redux';
import { compact } from 'lodash';
import { I18n } from '../../locale';
import Link from '../Link';
import Loader from '../Loader';
import Icon from '../Icon';
import { encodeUri } from '../../util/format';
import {
Expand Down
31 changes: 10 additions & 21 deletions src/js/components/Fields/OutputControl.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import React, { useState, useEffect } from 'react';
import { connect, useSelector, useDispatch } from 'react-redux';
import { bindActionCreators } from 'redux';
import { find, groupBy, map } from 'lodash';
import { useSelector, useDispatch } from 'react-redux';
import { find, groupBy, map, isEmpty } from 'lodash';
import VolumeControl from './VolumeControl';
import MuteControl from './MuteControl';
import Icon from '../Icon';
import Thumbnail from '../Thumbnail';
import LinksSentence from '../LinksSentence';
import DropdownField from './DropdownField';
import * as coreActions from '../../services/core/actions';
import * as mopidyActions from '../../services/mopidy/actions';
import * as pusherActions from '../../services/pusher/actions';
import * as snapcastActions from '../../services/snapcast/actions';
import { sortItems, indexToArray } from '../../util/arrays';
Expand Down Expand Up @@ -166,18 +163,10 @@ const Group = ({
};

const Outputs = () => {
const snapcastEnabled = useSelector((state) => state.snapcast.enabled);
const allGroups = indexToArray(useSelector((state) => state.snapcast.groups || {}));
const allStreams = useSelector((state) => state.snapcast.streams || {});
const allServers = indexToArray(useSelector((state) => state.mopidy.servers || {}));
const groupsByStream = groupBy(allGroups, 'stream_id');
if (!snapcastEnabled) {
return (
<p className="no-results">
<I18n path="playback_controls.snapcast_not_enabled" />
</p>
);
}

return (
<ErrorBoundary>
Expand All @@ -199,12 +188,10 @@ const Outputs = () => {
);
}

const Commands = () => {
const Commands = ({ commands }) => {
const dispatch = useDispatch();
const commandsObj = useSelector((state) => state.pusher.commands || {});
if (!commandsObj) return null;

let items = indexToArray(commandsObj);
let items = indexToArray(commands);
if (items.length <= 0) return null;

items = sortItems(items, 'sort_order');
Expand All @@ -230,6 +217,8 @@ const Commands = () => {
};

const OutputControl = ({ force_expanded }) => {
const snapcastEnabled = useSelector((state) => state.snapcast.enabled);
const commands = useSelector((state) => state.pusher.commands);
const [expanded, setExpanded] = useState(false);

useEffect(() => {
Expand All @@ -238,9 +227,9 @@ const OutputControl = ({ force_expanded }) => {
}
}, [force_expanded]);

if (!snapcastEnabled && isEmpty(commands)) return null;

if (expanded) {
const outputs = <Outputs />;
const commands = <Commands />;
return (
<span className="output-control">
{!force_expanded && <div className="click-outside" onClick={() => setExpanded(false)} />}
Expand All @@ -251,8 +240,8 @@ const OutputControl = ({ force_expanded }) => {
<Icon name="speaker" />
</button>
<div className="output-control__inner">
{commands}
{outputs}
{!isEmpty(commands) && <Commands commands={commands} />}
{snapcastEnabled && <Outputs />}
</div>
</span>
);
Expand Down
Loading

0 comments on commit 5ef872a

Please sign in to comment.