genres
This commit is contained in:
parent
f6c094046b
commit
d28cc59d08
3 changed files with 18 additions and 6 deletions
12
app/cyp.js
12
app/cyp.js
|
@ -1513,7 +1513,8 @@ customElements.define("cyp-yt", YT);
|
||||||
|
|
||||||
const ICONS$1 = {
|
const ICONS$1 = {
|
||||||
"AlbumArtist": "artist",
|
"AlbumArtist": "artist",
|
||||||
"Album": "album"
|
"Album": "album",
|
||||||
|
"Genre": "music"
|
||||||
};
|
};
|
||||||
|
|
||||||
class Tag extends Item {
|
class Tag extends Item {
|
||||||
|
@ -1626,7 +1627,8 @@ customElements.define("cyp-filter", Filter);
|
||||||
|
|
||||||
const TAGS$1 = {
|
const TAGS$1 = {
|
||||||
"Album": "Albums",
|
"Album": "Albums",
|
||||||
"AlbumArtist": "Artists"
|
"AlbumArtist": "Artists",
|
||||||
|
"Genre": "Genres"
|
||||||
};
|
};
|
||||||
|
|
||||||
function nonempty(str) { return (str.length > 0); }
|
function nonempty(str) { return (str.length > 0); }
|
||||||
|
@ -1693,6 +1695,9 @@ class Library extends Component {
|
||||||
button({icon:"artist"}, "Artists and albums", nav)
|
button({icon:"artist"}, "Artists and albums", nav)
|
||||||
.addEventListener("click", _ => this._pushState({type:"tags", tag:"AlbumArtist"}));
|
.addEventListener("click", _ => this._pushState({type:"tags", tag:"AlbumArtist"}));
|
||||||
|
|
||||||
|
button({icon:"music"}, "Genres", nav)
|
||||||
|
.addEventListener("click", _ => this._pushState({type:"tags", tag:"Genre"}));
|
||||||
|
|
||||||
button({icon:"folder"}, "Files and directories", nav)
|
button({icon:"folder"}, "Files and directories", nav)
|
||||||
.addEventListener("click", _ => this._pushState({type:"path", path:""}));
|
.addEventListener("click", _ => this._pushState({type:"path", path:""}));
|
||||||
|
|
||||||
|
@ -1720,7 +1725,7 @@ class Library extends Component {
|
||||||
const values = (await this._mpd.listTags(tag, filter)).filter(nonempty);
|
const values = (await this._mpd.listTags(tag, filter)).filter(nonempty);
|
||||||
clear(this);
|
clear(this);
|
||||||
|
|
||||||
if ("AlbumArtist" in filter) { this._buildBack(); }
|
if ("AlbumArtist" in filter || "Genre" in filter) { this._buildBack(); }
|
||||||
(values.length > 0) && this._addFilter();
|
(values.length > 0) && this._addFilter();
|
||||||
values.forEach(value => this._buildTag(tag, value, filter));
|
values.forEach(value => this._buildTag(tag, value, filter));
|
||||||
}
|
}
|
||||||
|
@ -1795,6 +1800,7 @@ class Library extends Component {
|
||||||
let node;
|
let node;
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case "AlbumArtist":
|
case "AlbumArtist":
|
||||||
|
case "Genre":
|
||||||
node = new Tag(tag, value, filter);
|
node = new Tag(tag, value, filter);
|
||||||
this.appendChild(node);
|
this.appendChild(node);
|
||||||
node.onClick = () => this._pushState({type:"tags", tag:"Album", filter:node.createChildFilter()});
|
node.onClick = () => this._pushState({type:"tags", tag:"Album", filter:node.createChildFilter()});
|
||||||
|
|
|
@ -12,7 +12,8 @@ import { escape, serializeFilter } from "../mpd.js";
|
||||||
const SORT = "-Track";
|
const SORT = "-Track";
|
||||||
const TAGS = {
|
const TAGS = {
|
||||||
"Album": "Albums",
|
"Album": "Albums",
|
||||||
"AlbumArtist": "Artists"
|
"AlbumArtist": "Artists",
|
||||||
|
"Genre": "Genres"
|
||||||
}
|
}
|
||||||
|
|
||||||
function nonempty(str) { return (str.length > 0); }
|
function nonempty(str) { return (str.length > 0); }
|
||||||
|
@ -79,6 +80,9 @@ class Library extends Component {
|
||||||
html.button({icon:"artist"}, "Artists and albums", nav)
|
html.button({icon:"artist"}, "Artists and albums", nav)
|
||||||
.addEventListener("click", _ => this._pushState({type:"tags", tag:"AlbumArtist"}));
|
.addEventListener("click", _ => this._pushState({type:"tags", tag:"AlbumArtist"}));
|
||||||
|
|
||||||
|
html.button({icon:"music"}, "Genres", nav)
|
||||||
|
.addEventListener("click", _ => this._pushState({type:"tags", tag:"Genre"}));
|
||||||
|
|
||||||
html.button({icon:"folder"}, "Files and directories", nav)
|
html.button({icon:"folder"}, "Files and directories", nav)
|
||||||
.addEventListener("click", _ => this._pushState({type:"path", path:""}));
|
.addEventListener("click", _ => this._pushState({type:"path", path:""}));
|
||||||
|
|
||||||
|
@ -106,7 +110,7 @@ class Library extends Component {
|
||||||
const values = (await this._mpd.listTags(tag, filter)).filter(nonempty);
|
const values = (await this._mpd.listTags(tag, filter)).filter(nonempty);
|
||||||
html.clear(this);
|
html.clear(this);
|
||||||
|
|
||||||
if ("AlbumArtist" in filter) { this._buildBack(); }
|
if ("AlbumArtist" in filter || "Genre" in filter) { this._buildBack(); }
|
||||||
(values.length > 0) && this._addFilter();
|
(values.length > 0) && this._addFilter();
|
||||||
values.forEach(value => this._buildTag(tag, value, filter));
|
values.forEach(value => this._buildTag(tag, value, filter));
|
||||||
}
|
}
|
||||||
|
@ -181,6 +185,7 @@ class Library extends Component {
|
||||||
let node;
|
let node;
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case "AlbumArtist":
|
case "AlbumArtist":
|
||||||
|
case "Genre":
|
||||||
node = new Tag(tag, value, filter);
|
node = new Tag(tag, value, filter);
|
||||||
this.appendChild(node);
|
this.appendChild(node);
|
||||||
node.onClick = () => this._pushState({type:"tags", tag:"Album", filter:node.createChildFilter()});
|
node.onClick = () => this._pushState({type:"tags", tag:"Album", filter:node.createChildFilter()});
|
||||||
|
|
|
@ -5,7 +5,8 @@ import Item from "../item.js";
|
||||||
|
|
||||||
const ICONS = {
|
const ICONS = {
|
||||||
"AlbumArtist": "artist",
|
"AlbumArtist": "artist",
|
||||||
"Album": "album"
|
"Album": "album",
|
||||||
|
"Genre": "music"
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Tag extends Item {
|
export default class Tag extends Item {
|
||||||
|
|
Loading…
Reference in a new issue