Skip to content

Commit

Permalink
Merging from develop, 3.59.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jaedb committed Oct 2, 2021
2 parents 9acdc95 + ced8a26 commit 07f9b16
Show file tree
Hide file tree
Showing 24 changed files with 373 additions and 314 deletions.
2 changes: 1 addition & 1 deletion IRIS_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.58.3
3.59.0
5 changes: 4 additions & 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.58.3"
__version__ = "3.59.0"

logger = logging.getLogger(__name__)

Expand All @@ -27,6 +27,9 @@ def get_config_schema(self):
schema["enabled"] = config.Boolean()
schema["country"] = config.String()
schema["locale"] = config.String()
schema["snapcast_enabled"] = config.Boolean()
schema["snapcast_host"] = config.String()
schema["snapcast_port"] = config.String()
schema["spotify_authorization_url"] = config.String()
schema["lastfm_authorization_url"] = config.String()
schema["genius_authorization_url"] = config.String()
Expand Down
3 changes: 3 additions & 0 deletions mopidy_iris/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ def get_config(self, *args, **kwargs):
"spotify_username": spotify_username,
"country": self.config["iris"]["country"],
"locale": self.config["iris"]["locale"],
"snapcast_enabled": self.config["iris"]["snapcast_enabled"],
"snapcast_host": self.config["iris"]["snapcast_host"],
"snapcast_port": self.config["iris"]["snapcast_port"],
"spotify_authorization_url": self.config["iris"][
"spotify_authorization_url"
],
Expand Down
3 changes: 3 additions & 0 deletions mopidy_iris/ext.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
enabled = true
country = NZ
locale = en_NZ
snapcast_enabled = true
snapcast_host = localhost
snapcast_port = 1780
spotify_authorization_url = https://jamesbarnsley.co.nz/iris/auth_spotify.php
lastfm_authorization_url = https://jamesbarnsley.co.nz/iris/auth_lastfm.php
genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php
Expand Down
1 change: 1 addition & 0 deletions mopidy_iris/static/app.css

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

2 changes: 1 addition & 1 deletion mopidy_iris/static/app.css.map

Large diffs are not rendered by default.

364 changes: 196 additions & 168 deletions mopidy_iris/static/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mopidy_iris/static/app.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mopidy_iris/static/app.min.css

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions mopidy_iris/static/app.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions mopidy_iris/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@

// Release details
// These are automatically injected to built HTML
var build = "1633136637";
var version = "3.58.3";
var build = "1633137695";
var version = "3.59.0";

// Construct the script tag
var js = document.createElement("script");
Expand Down
2 changes: 1 addition & 1 deletion mopidy_iris/static/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"manifest_version": "3.58.3",
"manifest_version": "3.59.0",
"short_name": "Iris",
"name": "Iris",
"icons": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mopidy-iris",
"version": "3.58.3",
"version": "3.59.0",
"description": "Mopidy HTTP interface",
"repository": "https://github.com/jaedb/iris",
"author": "James Barnsley <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = Mopidy-Iris
version = 3.58.3
version = 3.59.0
url = https://github.com/jaedb/iris
author = James Barnsley
author_email = [email protected]
Expand Down
90 changes: 90 additions & 0 deletions src/js/components/AddedFrom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import React, { useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import URILink from './URILink';
import { I18n, i18n } from '../locale';
import {
getFromUri,
titleCase,
uriType,
} from '../util/helpers';
import {
makeItemSelector,
makeLoadingSelector,
} from '../util/selectors';
import { loadUri } from '../services/core/actions';

export default ({
by,
uri,
className = '',
inline,
}) => {
if (!uri) return null;

const dispatch = useDispatch();
const from = useSelector(makeItemSelector(uri));
const loading = useSelector(makeLoadingSelector([`(.*)${uri}(.*)`]));

useEffect(() => {
if (uri && !from && !loading) {
dispatch(loadUri(uri));
}
}, []);

const type = from?.type || uriType(uri);
let link = null;
switch (type) {
case 'discover':
link = (
<URILink type="recommendations" uri={getFromUri('seeds', uri)}>
<I18n path="discover.title" />
</URILink>
);
break;

case 'browse':
link = (
<URILink type={from?.type} uri={uri}>
<I18n path="library.browse.title" />
</URILink>
);
break;

case 'search':
link = (
<URILink type={from?.type} uri={uri}>
<I18n path="search.title" />
</URILink>
);
break;

case 'radio':
link = <I18n path="modal.edit_radio.title" />;
break;

case 'queue-history':
link = <I18n path="queue_history.title" />;
break;

default:
link = <URILink type={type} uri={uri}>{from?.name || titleCase(type)}</URILink>;
}

if (inline) {
return (
<div className={className}>
{i18n('specs.added_from')}
{link}
</div>
);
}

return (
<div className={`${className} tooltip`}>
{link}
<span className="tooltip__content">
{i18n('specs.added_by', { by })}
</span>
</div>
);
};
58 changes: 15 additions & 43 deletions src/js/components/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
makeProvidersSelector,
makeLibrarySelector,
} from '../util/selectors';
import AddedFrom from './AddedFrom';

const processKeys = [
'MOPIDY_GET_LIBRARY_PLAYLISTS',
Expand Down Expand Up @@ -696,49 +697,20 @@ class ContextMenu extends React.Component {

if (context.items_count === 1 && context.name === 'queue-track' && context.item !== undefined) {
if (queue_metadata[`tlid_${context.item.tlid}`] !== undefined) {
const metadata = queue_metadata[`tlid_${context.item.tlid}`];

if (metadata.added_from && metadata.added_by) {
const type = (metadata.added_from ? uriType(metadata.added_from) : null);

switch (type) {
case 'discover':
var link = (
<URILink type="recommendations" uri={getFromUri('seeds', metadata.added_from)}>
<I18n path="discover.title" transform="lower" />
</URILink>
);
break;

case 'browse':
var link = (
<URILink type="browse" uri={metadata.added_from.replace('iris:browse:', '')}>
<I18n path="library.browse.title" transform="lower" />
</URILink>
);
break;

case 'search':
var link = (
<URILink type="search" uri={metadata.added_from.replace('iris:', '')}>
<I18n path="search.title" transform="lower" />
</URILink>
);
break;

default:
var link = <URILink type={type} uri={metadata.added_from}>{type}</URILink>;
}

return (
<div className="context-menu__title">
<div className="context-menu__title__text">
{`${metadata.added_by} added from `}
{link}
</div>
</div>
);
}
const {
added_from,
added_by,
} = queue_metadata[`tlid_${context.item.tlid}`] || {};
return (
<div className="context-menu__title">
<AddedFrom
uri={added_from}
by={added_by}
className="context-menu__title__text"
inline
/>
</div>
);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/components/GridItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const GridItem = ({
to = `/${item.type}/${encodeUri(item.uri)}`;
if (item.name && item.type !== 'artist') {
// Strip out "%"; this causes conflicts with our uri decoder
to += `/${item.name.replace('%','')}`;
to += `/${encodeURIComponent(item.name.replace('%', ''))}`;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/components/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const ListItem = ({
to = item.link;
} else {
to = `/${item.type}/${encodeUri(item.uri)}`;
if (item.name && item.type !== 'artist') to += `/${item.name}`;
if (item.name && item.type !== 'artist') to += `/${encodeURIComponent(item.name)}`;
}

if (e.target.tagName.toLowerCase() !== 'a') {
Expand Down
17 changes: 17 additions & 0 deletions src/js/components/Snapcast.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import SnapcastGroups from './SnapcastGroups';
import * as uiActions from '../services/ui/actions';
import * as actions from '../services/snapcast/actions';
import { I18n } from '../locale';
import Button from './Button';

const Snapcast = (props) => {
const {
Expand All @@ -14,6 +15,7 @@ const Snapcast = (props) => {
uiActions,
match,
history,
config,
snapcast: {
host,
port,
Expand All @@ -23,6 +25,17 @@ const Snapcast = (props) => {
},
} = props;

const restoreDefaults = () => {
const {
snapcast_enabled = false,
snapcast_host = 'localhost',
snapcast_port = '1780',
} = config || {};

actions.setEnabled(snapcast_enabled);
actions.setConnection({ host: snapcast_host, port: snapcast_port });
}

return (
<div className="snapcast">

Expand Down Expand Up @@ -65,6 +78,9 @@ const Snapcast = (props) => {
<I18n path="snapcast.show_disconnected_clients" />
</span>
</label>
<Button onClick={restoreDefaults} size="small" className="no-margin">
<I18n path="services.restore_defaults" />
</Button>
</div>
</div>

Expand Down Expand Up @@ -102,6 +118,7 @@ const Snapcast = (props) => {

const mapStateToProps = (state) => ({
snapcast: state.snapcast,
config: state.pusher.config,
show_disconnected_clients: (
state.ui.snapcast_show_disconnected_clients !== undefined
? state.ui.snapcast_show_disconnected_clients
Expand Down
Loading

0 comments on commit 07f9b16

Please sign in to comment.