Skip to content

Commit

Permalink
Merge pull request #918 from jaedb/develop
Browse files Browse the repository at this point in the history
3.68
  • Loading branch information
jaedb authored Aug 12, 2023
2 parents 5ef872a + 06c33e3 commit 43f1cd4
Show file tree
Hide file tree
Showing 16 changed files with 2,714 additions and 1,711 deletions.
6 changes: 3 additions & 3 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

if [ -z "$PULSE_COOKIE_DATA" ]
then
printf '%s' "$(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 --upgrade "$PIP_PACKAGES"
python3 -m pip install --no-cache --upgrade $PIP_PACKAGES
fi

exec "$@"
3 changes: 2 additions & 1 deletion docker/snapserver/snapserver-example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ doc_root = /usr/share/snapserver/snapweb/
# stream URI of the PCM input stream, can be configured multiple times
# Format: TYPE://host/path?name=NAME[&codec=CODEC][&sampleformat=SAMPLEFORMAT]
#stream = pipe:///tmp/snapfifo?name=default
stream = pipe:///tmp/snapfifo?name=Default&sampleformat=48000:16:2&controlscript=meta_mopidy.py
stream = pipe:///tmp/snapfifo?name=Mopidy&sampleformat=48000:16:2&controlscript=meta_mopidy.py
stream = librespot:///librespot?name=Spotify

# Default sample format
#sampleformat = 48000:16:2
Expand Down
56 changes: 37 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"sortablejs": "1.15.0",
"style-loader": "3.3.1",
"url-loader": "4.1.1",
"webpack": "5.73.0",
"webpack": "5.76.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.11.1",
"webpack-strip": "0.1.0",
Expand Down
47 changes: 38 additions & 9 deletions src/js/components/Fields/OutputControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import Thumbnail from '../Thumbnail';
import LinksSentence from '../LinksSentence';
import DropdownField from './DropdownField';
import * as pusherActions from '../../services/pusher/actions';
import * as snapcastActions from '../../services/snapcast/actions';
import {
setGroupStream,
setClientMute,
setClientVolume,
setStreamingEnabled,
controlStream,
} from '../../services/snapcast/actions';
import { sortItems, indexToArray } from '../../util/arrays';
import { titleCase } from '../../util/helpers';
import { I18n, i18n } from '../../locale';
Expand Down Expand Up @@ -38,10 +44,10 @@ const Header = ({
let onClick = null;
switch (playbackStatus) {
case 'playing':
if (canPause) onClick = () => dispatch(snapcastActions.controlStream(id, 'pause'));
if (canPause) onClick = () => dispatch(controlStream(id, 'pause'));
break;
default:
if (canPlay) onClick = () => dispatch(snapcastActions.controlStream(id, 'play'));
if (canPlay) onClick = () => dispatch(controlStream(id, 'play'));
break;
}

Expand Down Expand Up @@ -88,6 +94,7 @@ const Header = ({
};

const Group = ({
setExpanded,
group: {
id: groupId,
name: groupName,
Expand All @@ -111,6 +118,7 @@ const Group = ({
className="text"
to={`/settings/services/snapcast/${groupId}`}
scrollTo="#services-snapcast-groups"
onClick={() => setExpanded(false)}
>
{titleCase(groupName)}
</Link>
Expand All @@ -121,7 +129,7 @@ const Group = ({
options={allStreams.map((s) => ({ value: s.id, label: titleCase(s.id) }))}
noLabel
handleChange={
(value) => dispatch(snapcastActions.setGroupStream(groupId, value))
(value) => dispatch(setGroupStream(groupId, value))
}
/>
</h5>
Expand All @@ -143,14 +151,14 @@ const Group = ({
noTooltip
mute={mute}
onMuteChange={
(value) => dispatch(snapcastActions.setClientMute(clientId, value))
(value) => dispatch(setClientMute(clientId, value))
}
/>
<VolumeControl
volume={volume}
mute={mute}
onVolumeChange={
(value) => dispatch(snapcastActions.setClientVolume(clientId, value))
(value) => dispatch(setClientVolume(clientId, value))
}
/>
</div>
Expand All @@ -162,11 +170,13 @@ const Group = ({
);
};

const Outputs = () => {
const Outputs = ({ setExpanded }) => {
const dispatch = useDispatch();
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');
const { streaming_enabled } = useSelector((state) => state?.snapcast || {});

return (
<ErrorBoundary>
Expand All @@ -180,10 +190,29 @@ const Outputs = () => {
return (
<div className="output-control__stream" key={`stream_${id}`}>
<Header stream={stream} />
{groups.map((group) => <Group group={group} key={`group_${group.id}`} />)}
{
groups.map(
(group) => (
<Group setExpanded={setExpanded} group={group} key={`group_${group.id}`} />
)
)
}
</div>
);
})}
<div className="field checkbox" style={{ paddingLeft: 12 }}>
<label>
<input
type="checkbox"
name="streaming_enabled"
checked={streaming_enabled}
onChange={() => dispatch(setStreamingEnabled(!streaming_enabled))}
/>
<span className="label">
<I18n path="snapcast.stream_on_this_device" />
</span>
</label>
</div>
</ErrorBoundary>
);
}
Expand Down Expand Up @@ -241,7 +270,7 @@ const OutputControl = ({ force_expanded }) => {
</button>
<div className="output-control__inner">
{!isEmpty(commands) && <Commands commands={commands} />}
{snapcastEnabled && <Outputs />}
{snapcastEnabled && <Outputs setExpanded={setExpanded} />}
</div>
</span>
);
Expand Down
12 changes: 0 additions & 12 deletions src/js/components/Snapcast.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ const Snapcast = (props) => {
<I18n path="snapcast.enabled" />
</span>
</label>
<label>
<input
type="checkbox"
name="streaming_enabled"
checked={streaming_enabled}
disabled={!enabled}
onChange={() => actions.setStreamingEnabled(!streaming_enabled)}
/>
<span className="label">
<I18n path="snapcast.streaming_enabled" />
</span>
</label>
<label>
<input
type="checkbox"
Expand Down
Loading

0 comments on commit 43f1cd4

Please sign in to comment.