artist/albumartist, fixes #21
This commit is contained in:
parent
9b701bb385
commit
becddcbef5
5 changed files with 22 additions and 8 deletions
13
app/cyp.js
13
app/cyp.js
|
@ -896,9 +896,16 @@ function time(sec) {
|
||||||
|
|
||||||
function subtitle(data, options = {duration:true}) {
|
function subtitle(data, options = {duration:true}) {
|
||||||
let tokens = [];
|
let tokens = [];
|
||||||
data["Artist"] && tokens.push(data["Artist"]);
|
|
||||||
|
if (data["Artist"]) {
|
||||||
|
tokens.push(data["Artist"]);
|
||||||
|
} else if (data["AlbumArtist"]) {
|
||||||
|
tokens.push(data["AlbumArtist"]);
|
||||||
|
}
|
||||||
|
|
||||||
data["Album"] && tokens.push(data["Album"]);
|
data["Album"] && tokens.push(data["Album"]);
|
||||||
options.duration && data["duration"] && tokens.push(time(Number(data["duration"])));
|
options.duration && data["duration"] && tokens.push(time(Number(data["duration"])));
|
||||||
|
|
||||||
return tokens.join(SEPARATOR);
|
return tokens.join(SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -983,8 +990,8 @@ class Player extends Component {
|
||||||
this._dispatchSongChange(data);
|
this._dispatchSongChange(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
let artistNew = data["AlbumArtist"] || data["Artist"];
|
let artistNew = data["Artist"] || data["AlbumArtist"];
|
||||||
let artistOld = this._current.song["AlbumArtist"] || this._current.song["Artist"];
|
let artistOld = this._current.song["Artist"] || this._current.song["AlbumArtist"];
|
||||||
let albumNew = data["Album"];
|
let albumNew = data["Album"];
|
||||||
let albumOld = this._current.song["Album"];
|
let albumOld = this._current.song["Album"];
|
||||||
|
|
||||||
|
|
|
@ -98,6 +98,6 @@
|
||||||
</footer>
|
</footer>
|
||||||
</cyp-app>
|
</cyp-app>
|
||||||
|
|
||||||
<script type="module" src="cyp.js?1"></script>
|
<script type="module" src="cyp.js?2"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -166,7 +166,7 @@ class Library extends Component {
|
||||||
let results = new Map();
|
let results = new Map();
|
||||||
songs.forEach(song => {
|
songs.forEach(song => {
|
||||||
let filter = {}, value;
|
let filter = {}, value;
|
||||||
const artist = song["AlbumArtist"] || song["Artist"]
|
const artist = song["AlbumArtist"] || song["Artist"];
|
||||||
|
|
||||||
if (tag == "Album") {
|
if (tag == "Album") {
|
||||||
value = song[tag];
|
value = song[tag];
|
||||||
|
|
|
@ -81,8 +81,8 @@ class Player extends Component {
|
||||||
this._dispatchSongChange(data);
|
this._dispatchSongChange(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
let artistNew = data["AlbumArtist"] || data["Artist"];
|
let artistNew = data["Artist"] || data["AlbumArtist"];
|
||||||
let artistOld = this._current.song["AlbumArtist"] || this._current.song["Artist"];
|
let artistOld = this._current.song["Artist"] || this._current.song["AlbumArtist"];
|
||||||
let albumNew = data["Album"];
|
let albumNew = data["Album"];
|
||||||
let albumOld = this._current.song["Album"];
|
let albumOld = this._current.song["Album"];
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,16 @@ export function time(sec) {
|
||||||
|
|
||||||
export function subtitle(data, options = {duration:true}) {
|
export function subtitle(data, options = {duration:true}) {
|
||||||
let tokens = [];
|
let tokens = [];
|
||||||
data["Artist"] && tokens.push(data["Artist"]);
|
|
||||||
|
if (data["Artist"]) {
|
||||||
|
tokens.push(data["Artist"]);
|
||||||
|
} else if (data["AlbumArtist"]) {
|
||||||
|
tokens.push(data["AlbumArtist"]);
|
||||||
|
}
|
||||||
|
|
||||||
data["Album"] && tokens.push(data["Album"]);
|
data["Album"] && tokens.push(data["Album"]);
|
||||||
options.duration && data["duration"] && tokens.push(time(Number(data["duration"])));
|
options.duration && data["duration"] && tokens.push(time(Number(data["duration"])));
|
||||||
|
|
||||||
return tokens.join(SEPARATOR);
|
return tokens.join(SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue