artist/albumartist, fixes #21

This commit is contained in:
Ondřej Žára 2020-12-26 20:46:42 +01:00
parent 9b701bb385
commit becddcbef5
No known key found for this signature in database
GPG key ID: B0A5751E616840C5
5 changed files with 22 additions and 8 deletions

View file

@ -896,9 +896,16 @@ function time(sec) {
function subtitle(data, options = {duration:true}) {
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"]);
options.duration && data["duration"] && tokens.push(time(Number(data["duration"])));
return tokens.join(SEPARATOR);
}
@ -983,8 +990,8 @@ class Player extends Component {
this._dispatchSongChange(data);
}
let artistNew = data["AlbumArtist"] || data["Artist"];
let artistOld = this._current.song["AlbumArtist"] || this._current.song["Artist"];
let artistNew = data["Artist"] || data["AlbumArtist"];
let artistOld = this._current.song["Artist"] || this._current.song["AlbumArtist"];
let albumNew = data["Album"];
let albumOld = this._current.song["Album"];

View file

@ -98,6 +98,6 @@
</footer>
</cyp-app>
<script type="module" src="cyp.js?1"></script>
<script type="module" src="cyp.js?2"></script>
</body>
</html>

View file

@ -166,7 +166,7 @@ class Library extends Component {
let results = new Map();
songs.forEach(song => {
let filter = {}, value;
const artist = song["AlbumArtist"] || song["Artist"]
const artist = song["AlbumArtist"] || song["Artist"];
if (tag == "Album") {
value = song[tag];

View file

@ -81,8 +81,8 @@ class Player extends Component {
this._dispatchSongChange(data);
}
let artistNew = data["AlbumArtist"] || data["Artist"];
let artistOld = this._current.song["AlbumArtist"] || this._current.song["Artist"];
let artistNew = data["Artist"] || data["AlbumArtist"];
let artistOld = this._current.song["Artist"] || this._current.song["AlbumArtist"];
let albumNew = data["Album"];
let albumOld = this._current.song["Album"];

View file

@ -9,9 +9,16 @@ export function time(sec) {
export function subtitle(data, options = {duration:true}) {
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"]);
options.duration && data["duration"] && tokens.push(time(Number(data["duration"])));
return tokens.join(SEPARATOR);
}