Skip to content

Commit 5ef872a

Browse files
committed
Merge branch 'develop'
2 parents e7d19ce + aaae821 commit 5ef872a

28 files changed

+350
-459
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
name: ${{ matrix.name }}
5555
runs-on: ubuntu-20.04
56-
container: ghcr.io/mopidy/ci:latest
56+
container: ghcr.io/mopidy/ci:7
5757
steps:
5858
- name: Checkout code
5959
uses: actions/checkout@v2

Dockerfile

+5-7
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ RUN apt update \
3232
WORKDIR /usr/src/gst-plugins-rs
3333

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

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

10098
# Install mopidy and (optional) DLNA-server dleyna from apt.mopidy.com
10199
# see https://docs.mopidy.com/en/latest/installation/debian/
102-
RUN mkdir -p /usr/local/share/keyrings \
103-
&& wget -q -O /usr/local/share/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg \
104-
&& wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list \
100+
RUN mkdir -p /etc/apt/keyrings \
101+
&& wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg \
102+
&& wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/bullseye.list \
105103
&& apt-get update \
106104
&& apt-get install -y \
107105
mopidy \
@@ -133,7 +131,7 @@ RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/ja
133131

134132
# Install mopidy-spotify-gstspotify (Hack, not released yet!)
135133
# (https://github.com/kingosticks/mopidy-spotify/tree/gstspotifysrc-hack)
136-
RUN git clone --depth 1 -b gstspotifysrc-hack https://github.com/kingosticks/mopidy-spotify.git mopidy-spotify \
134+
RUN git clone --depth 1 https://github.com/mopidy/mopidy-spotify.git mopidy-spotify \
137135
&& cd mopidy-spotify \
138136
&& python3 setup.py install \
139137
&& cd .. \

Dockerfile.alpine

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Use Alpine edge for now as some required dependencies are only in the testing repository
2+
FROM alpine:edge
3+
4+
# Switch to the root user while we do our changes
5+
USER root
6+
WORKDIR /
7+
8+
# Install GStreamer and other required Debian packages
9+
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
10+
&& apk update \
11+
&& apk add \
12+
dumb-init \
13+
shadow \
14+
sudo \
15+
git \
16+
py3-pip \
17+
mopidy \
18+
py3-mopidy-spotify
19+
20+
# Install Node, to build Iris JS application
21+
RUN apk add nodejs npm
22+
23+
# Upgrade Python package manager pip
24+
# https://pypi.org/project/pip/
25+
RUN python3 -m pip install --upgrade pip
26+
27+
# Clone Iris from the repository and install in development mode.
28+
# This allows a binding at "/iris" to map to your local folder for development, rather than
29+
# installing using pip.
30+
# Note: ADD helps prevent RUN caching issues. When HEAD changes in repo, our cache will be invalidated!
31+
ADD https://api.github.com/repos/jaedb/Iris/git/refs/heads/master version.json
32+
ENV IRIS_VERSION=develop
33+
RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/jaedb/Iris.git /iris \
34+
&& cd /iris \
35+
&& npm install \
36+
&& npm run prod \
37+
&& python3 setup.py develop \
38+
&& mkdir -p /var/lib/mopidy/.config \
39+
&& ln -s /config /var/lib/mopidy/.config/mopidy \
40+
# Allow mopidy user to run system commands (restart, local scan, etc)
41+
&& echo "mopidy ALL=NOPASSWD: /iris/mopidy_iris/system.sh" >> /etc/sudoers \
42+
# Enable container mode (disable restart option, etc.)
43+
&& echo "1" >> /IS_CONTAINER \
44+
# Copy Version file
45+
&& cp /iris/VERSION /
46+
47+
# Install additional mopidy extensions and Python dependencies via pip
48+
COPY docker/requirements.txt .
49+
RUN python3 -m pip install -r requirements.txt
50+
51+
# Cleanup
52+
RUN rm -rf /root/.cache \
53+
&& rm -rf /iris/node_modules
54+
55+
# Start helper script.
56+
COPY docker/entrypoint.sh /entrypoint.sh
57+
58+
# Copy Default configuration for mopidy
59+
COPY docker/mopidy/mopidy.example.conf /config/mopidy.conf
60+
61+
# Copy the pulse-client configuratrion
62+
COPY docker/mopidy/pulse-client.conf /etc/pulse/client.conf
63+
64+
# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID.
65+
# RUN useradd -ms /bin/bash mopidy
66+
ENV HOME=/var/lib/mopidy
67+
RUN set -ex \
68+
&& usermod -G audio,wheel mopidy \
69+
&& mkdir /var/lib/mopidy/local \
70+
&& chown mopidy:audio -R $HOME /entrypoint.sh /iris \
71+
&& chmod go+rwx -R $HOME /entrypoint.sh /iris
72+
73+
# Runs as mopidy user by default.
74+
USER mopidy:audio
75+
76+
VOLUME ["/var/lib/mopidy/local"]
77+
78+
EXPOSE 6600 6680 1704 1705 5555/udp
79+
80+
ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint.sh"]
81+
CMD ["mopidy"]

IRIS_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.66.1
1+
3.67.0

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ include mopidy_iris/ext.conf
77
include mopidy_iris/system.sh
88
include IRIS_VERSION
99
include Dockerfile
10+
include Dockerfile.alpine
1011
include pyproject.toml
1112
include screenshot.jpg
1213
include tox.ini

docker/entrypoint.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

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

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

1414
exec "$@"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
},
9595
"scripts": {
9696
"test": "jest",
97-
"tox": "docker exec -it -u root iris_mopidy_1 bash -c \"cd /iris && tox\"",
97+
"tox": "docker exec -it -u root mopidy bash -c \"cd /iris && tox\"",
9898
"start": "NODE_ENV=development WEBPACK_DEV_SERVER=1 webpack-dev-server",
9999
"lint": "eslint src",
100100
"lint:fix": "eslint src --fix",

src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
</body>
117117
<script type="text/javascript">
118118
if ('serviceWorker' in navigator){
119-
navigator.serviceWorker.register('service-worker.js')
119+
navigator.serviceWorker.register('<%= baseHref %>service-worker.js')
120120
.then(function(registration){
121121
console.log('Service worker registered');
122122
}).catch(function(error){

src/js/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const Content = () => (
5353
<Route path="queue/history" element={<QueueHistory />}/>
5454
<Route path="settings/debug" element={<Debug />} />
5555
<Route path="settings/*" element={<Settings />} />
56-
<Route path="search/" element={<Search />} />
56+
<Route path="search" element={<Search />} />
5757
<Route path="search/:type/:term" element={<Search />} />
5858
<Route path="artist/:uri/*" element={<Artist />} />
5959
<Route path="album/:uri/" element={<Album />} />

src/js/components/ContextMenu/PlaylistSubmenu.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useDispatch } from 'react-redux';
33
import { compact } from 'lodash';
44
import { I18n } from '../../locale';
55
import Link from '../Link';
6+
import Loader from '../Loader';
67
import Icon from '../Icon';
78
import { encodeUri } from '../../util/format';
89
import {

src/js/components/Fields/OutputControl.js

+10-21
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import React, { useState, useEffect } from 'react';
2-
import { connect, useSelector, useDispatch } from 'react-redux';
3-
import { bindActionCreators } from 'redux';
4-
import { find, groupBy, map } from 'lodash';
2+
import { useSelector, useDispatch } from 'react-redux';
3+
import { find, groupBy, map, isEmpty } from 'lodash';
54
import VolumeControl from './VolumeControl';
65
import MuteControl from './MuteControl';
76
import Icon from '../Icon';
87
import Thumbnail from '../Thumbnail';
98
import LinksSentence from '../LinksSentence';
109
import DropdownField from './DropdownField';
11-
import * as coreActions from '../../services/core/actions';
12-
import * as mopidyActions from '../../services/mopidy/actions';
1310
import * as pusherActions from '../../services/pusher/actions';
1411
import * as snapcastActions from '../../services/snapcast/actions';
1512
import { sortItems, indexToArray } from '../../util/arrays';
@@ -166,18 +163,10 @@ const Group = ({
166163
};
167164

168165
const Outputs = () => {
169-
const snapcastEnabled = useSelector((state) => state.snapcast.enabled);
170166
const allGroups = indexToArray(useSelector((state) => state.snapcast.groups || {}));
171167
const allStreams = useSelector((state) => state.snapcast.streams || {});
172168
const allServers = indexToArray(useSelector((state) => state.mopidy.servers || {}));
173169
const groupsByStream = groupBy(allGroups, 'stream_id');
174-
if (!snapcastEnabled) {
175-
return (
176-
<p className="no-results">
177-
<I18n path="playback_controls.snapcast_not_enabled" />
178-
</p>
179-
);
180-
}
181170

182171
return (
183172
<ErrorBoundary>
@@ -199,12 +188,10 @@ const Outputs = () => {
199188
);
200189
}
201190

202-
const Commands = () => {
191+
const Commands = ({ commands }) => {
203192
const dispatch = useDispatch();
204-
const commandsObj = useSelector((state) => state.pusher.commands || {});
205-
if (!commandsObj) return null;
206193

207-
let items = indexToArray(commandsObj);
194+
let items = indexToArray(commands);
208195
if (items.length <= 0) return null;
209196

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

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

235224
useEffect(() => {
@@ -238,9 +227,9 @@ const OutputControl = ({ force_expanded }) => {
238227
}
239228
}, [force_expanded]);
240229

230+
if (!snapcastEnabled && isEmpty(commands)) return null;
231+
241232
if (expanded) {
242-
const outputs = <Outputs />;
243-
const commands = <Commands />;
244233
return (
245234
<span className="output-control">
246235
{!force_expanded && <div className="click-outside" onClick={() => setExpanded(false)} />}
@@ -251,8 +240,8 @@ const OutputControl = ({ force_expanded }) => {
251240
<Icon name="speaker" />
252241
</button>
253242
<div className="output-control__inner">
254-
{commands}
255-
{outputs}
243+
{!isEmpty(commands) && <Commands commands={commands} />}
244+
{snapcastEnabled && <Outputs />}
256245
</div>
257246
</span>
258247
);

0 commit comments

Comments
 (0)