commit
12b9785a62
3 changed files with 49 additions and 61 deletions
|
@ -140,9 +140,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getBadges() {
|
async getBadges() {
|
||||||
let self = this
|
const self = this
|
||||||
if (this.badges[this.item.attributes.playParams.id ?? this.item.id]) {
|
const id = (this.item.attributes.playParams ? this.item.attributes.playParams.id : null) || this.item.id
|
||||||
let friends = this.badges[this.item.attributes.playParams.id ?? this.item.id]
|
if (id && this.badges[id]) {
|
||||||
|
let friends = this.badges[id]
|
||||||
if (friends) {
|
if (friends) {
|
||||||
friends.forEach(function (friend) {
|
friends.forEach(function (friend) {
|
||||||
self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
|
self.app.mk.api.v3.music(`/v1/social/${app.mk.storefrontId}/social-profiles/${friend}`).then(data => {
|
||||||
|
|
|
@ -40,10 +40,11 @@
|
||||||
@click="data.attributes && data.attributes.artistName ? app.searchAndNavigate(data,'artist') : ''">
|
@click="data.attributes && data.attributes.artistName ? app.searchAndNavigate(data,'artist') : ''">
|
||||||
{{getArtistName(data)}}
|
{{getArtistName(data)}}
|
||||||
</div>
|
</div>
|
||||||
<div class="playlist-desc" v-if="getDescription(data) != ''">
|
<div class="playlist-desc" v-if="data.attributes.description && (data.attributes.description.standard || data.attributes.description.short)">
|
||||||
<div class="content"
|
<div v-if="data.attributes.description.short" class="content" v-html="data.attributes.description.short"></div>
|
||||||
v-html="getDescription(data)"></div>
|
<div v-else-if="data.attributes.description.standard" class="content" v-html="data.attributes.description.standard"></div>
|
||||||
<button class="more-btn" @click="editorialNotesExpanded = !editorialNotesExpanded">
|
<button v-if="data.attributes.description.short" class="more-btn"
|
||||||
|
@click="editorialNotesExpanded = !editorialNotesExpanded">
|
||||||
More
|
More
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -100,7 +101,8 @@
|
||||||
<div class="friends-info" v-if="itemBadges.length != 0">
|
<div class="friends-info" v-if="itemBadges.length != 0">
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<div class="badge-container">
|
<div class="badge-container">
|
||||||
<div class="socialBadge" :title="`${badge.attributes.name} - @${badge.attributes.handle}`" v-for="badge in itemBadges">
|
<div class="socialBadge" :title="`${badge.attributes.name} - @${badge.attributes.handle}`"
|
||||||
|
v-for="badge in itemBadges">
|
||||||
<mediaitem-artwork
|
<mediaitem-artwork
|
||||||
:url="badge.attributes.artwork.url"
|
:url="badge.attributes.artwork.url"
|
||||||
:size="60"></mediaitem-artwork>
|
:size="60"></mediaitem-artwork>
|
||||||
|
@ -182,25 +184,8 @@
|
||||||
this.confirm = true
|
this.confirm = true
|
||||||
setTimeout(() => this.confirm = false, 3000);
|
setTimeout(() => this.confirm = false, 3000);
|
||||||
},
|
},
|
||||||
|
|
||||||
getDescription(data) {
|
|
||||||
console.log(data.attributes)
|
|
||||||
if (data.attributes.editorialNotes) {
|
|
||||||
if (data.attributes.editorialNotes.hasOwnProperty('short')) {
|
|
||||||
return data.attributes.editorialNotes.short
|
|
||||||
} else if (data.attributes.editorialNotes.hasOwnProperty('standard')) {
|
|
||||||
return data.attributes.editorialNotes.standard
|
|
||||||
}
|
|
||||||
} else if (data.attributes.description) {
|
|
||||||
if (data.attributes.description.hasOwnProperty('short')) {
|
|
||||||
return data.attributes.description.short
|
|
||||||
} else if (data.attributes.description.hasOwnProperty('standard')) {
|
|
||||||
return data.attributes.description.standard
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ''
|
|
||||||
},
|
|
||||||
getArtistName(data) {
|
getArtistName(data) {
|
||||||
|
console.log(data.attributes)
|
||||||
if (data.attributes.artistName) {
|
if (data.attributes.artistName) {
|
||||||
return data.attributes.artistName
|
return data.attributes.artistName
|
||||||
} else if (data.attributes.artist) {
|
} else if (data.attributes.artist) {
|
||||||
|
@ -214,8 +199,12 @@
|
||||||
async isInLibrary() {
|
async isInLibrary() {
|
||||||
if (this.data.type && !this.data.type.includes("library")) {
|
if (this.data.type && !this.data.type.includes("library")) {
|
||||||
// please keep using vars here
|
// please keep using vars here
|
||||||
var params = { "fields[playlists]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library" }
|
const params = {
|
||||||
var res = await app.mkapi(this.data.attributes.playParams.kind ?? this.data.type, this.data.attributes.playParams.isLibrary ?? false, this.data.attributes.playParams.id ?? this.data.id, params);
|
"fields[playlists]": "inLibrary",
|
||||||
|
"fields[albums]": "inLibrary",
|
||||||
|
"relate": "library"
|
||||||
|
};
|
||||||
|
const res = await app.mkapi(this.data.attributes.playParams.kind ?? this.data.type, this.data.attributes.playParams.isLibrary ?? false, this.data.attributes.playParams.id ?? this.data.id, params);
|
||||||
this.inLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false
|
this.inLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false
|
||||||
console.log(res)
|
console.log(res)
|
||||||
} else {
|
} else {
|
||||||
|
@ -225,7 +214,7 @@
|
||||||
editPlaylist() {
|
editPlaylist() {
|
||||||
this.app.editPlaylist(this.data.id, this.data.attributes.name);
|
this.app.editPlaylist(this.data.id, this.data.attributes.name);
|
||||||
this.app.playlists.listing.forEach(playlist => {
|
this.app.playlists.listing.forEach(playlist => {
|
||||||
if (playlist.id == this.data.id) {
|
if (playlist.id === this.data.id) {
|
||||||
playlist.attributes.name = this.data.attributes.name
|
playlist.attributes.name = this.data.attributes.name
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -237,20 +226,20 @@
|
||||||
this.confirm = false
|
this.confirm = false
|
||||||
},
|
},
|
||||||
async removeFromLibrary(id) {
|
async removeFromLibrary(id) {
|
||||||
var params = { "fields[somgs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library" }
|
const params = {"fields[somgs]": "inLibrary", "fields[albums]": "inLibrary", "relate": "library"};
|
||||||
var id = this.data.id ?? this.data.attributes.playParams.id
|
var id = this.data.id ?? this.data.attributes.playParams.id
|
||||||
var res = await app.mkapi(this.data.attributes.playParams.kind ?? this.data.type, this.data.attributes.playParams.isLibrary ?? false, this.data.attributes.playParams.id ?? this.data.id, params);
|
const res = await app.mkapi(this.data.attributes.playParams.kind ?? this.data.type, this.data.attributes.playParams.isLibrary ?? false, this.data.attributes.playParams.id ?? this.data.id, params);
|
||||||
if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
|
if (res && res.relationships && res.relationships.library && res.relationships.library.data && res.relationships.library.data.length > 0) {
|
||||||
id = res.relationships.library.data[0].id
|
id = res.relationships.library.data[0].id
|
||||||
}
|
}
|
||||||
let kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
|
let kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
|
||||||
var truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
app.mk.api.library.remove({ [truekind]: id })
|
app.mk.api.library.remove({[truekind]: id})
|
||||||
this.inLibrary = false
|
this.inLibrary = false
|
||||||
this.confirm = false
|
this.confirm = false
|
||||||
},
|
},
|
||||||
editPlaylistName() {
|
editPlaylistName() {
|
||||||
if (this.data.attributes.canEdit && this.data.type == "library-playlists") {
|
if (this.data.attributes.canEdit && this.data.type === "library-playlists") {
|
||||||
this.nameEditing = true
|
this.nameEditing = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.querySelector(".nameEdit").focus()
|
document.querySelector(".nameEdit").focus()
|
||||||
|
@ -327,7 +316,7 @@
|
||||||
icon: "./assets/feather/share.svg",
|
icon: "./assets/feather/share.svg",
|
||||||
action: () => {
|
action: () => {
|
||||||
let route = ""
|
let route = ""
|
||||||
switch(this.data.type) {
|
switch (this.data.type) {
|
||||||
case 'albums':
|
case 'albums':
|
||||||
route = `/v1/catalog/${app.mk.storefrontId}/albums/${this.data.id}`
|
route = `/v1/catalog/${app.mk.storefrontId}/albums/${this.data.id}`
|
||||||
break;
|
break;
|
||||||
|
@ -341,10 +330,10 @@
|
||||||
route = `/v1/me/library/albums/${this.data.id}/catalog`
|
route = `/v1/me/library/albums/${this.data.id}/catalog`
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if(route == '') {
|
if (route === '') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
app.mk.api.v3.music(route).then(res=>{
|
app.mk.api.v3.music(route).then(res => {
|
||||||
console.log(res.data.data[0].attributes.url)
|
console.log(res.data.data[0].attributes.url)
|
||||||
app.copyToClipboard(res.data.data[0].attributes.url)
|
app.copyToClipboard(res.data.data[0].attributes.url)
|
||||||
})
|
})
|
||||||
|
@ -359,28 +348,29 @@
|
||||||
return `${kind}:${id}`
|
return `${kind}:${id}`
|
||||||
},
|
},
|
||||||
getFormattedDate: function () {
|
getFormattedDate: function () {
|
||||||
let date = (this.data.attributes.releaseDate ?? (this.data.attributes.lastModifiedDate ?? (this.data.attributes.dateAdded ?? '') ))
|
let date = (this.data.attributes.releaseDate ?? (this.data.attributes.lastModifiedDate ?? (this.data.attributes.dateAdded ?? '')))
|
||||||
let prefix = '';
|
let prefix = '';
|
||||||
if (date == null || date === "") return "";
|
if (date == null || date === "") return "";
|
||||||
switch(date){
|
switch (date) {
|
||||||
case this.data.attributes.releaseDate:
|
case this.data.attributes.releaseDate:
|
||||||
prefix = 'Released '
|
prefix = 'Released '
|
||||||
break;
|
break;
|
||||||
case this.data.attributes.lastModifiedDate:
|
case this.data.attributes.lastModifiedDate:
|
||||||
prefix = 'Updated '
|
prefix = 'Updated '
|
||||||
break;
|
break;
|
||||||
case this.data.attributes.dateAdded:
|
case this.data.attributes.dateAdded:
|
||||||
prefix = 'Added '
|
prefix = 'Added '
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
let month, year;
|
||||||
try {
|
try {
|
||||||
var releaseDate = new Date(date);
|
const releaseDate = new Date(date);
|
||||||
console.log(date, releaseDate)
|
console.log(date, releaseDate)
|
||||||
month = new Intl.DateTimeFormat('en-US', { month: 'long' }).format(releaseDate);
|
month = new Intl.DateTimeFormat('en-US', {month: 'long'}).format(releaseDate);
|
||||||
date = releaseDate.getDate();
|
date = releaseDate.getDate();
|
||||||
year = releaseDate.getFullYear();
|
year = releaseDate.getFullYear();
|
||||||
|
|
||||||
return prefix+date + " " + month + " " + year;
|
return prefix + date + " " + month + " " + year;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -394,25 +384,27 @@
|
||||||
array[j] = temp;
|
array[j] = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var id = this.data.attributes.playParams.id ?? this.data.id;
|
|
||||||
|
const id = this.data.attributes.playParams.id ?? this.data.id;
|
||||||
//console.log("1")
|
//console.log("1")
|
||||||
var kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
|
const kind = this.data.attributes.playParams.kind ?? this.data.type ?? '';
|
||||||
//console.log("1")
|
//console.log("1")
|
||||||
var truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
const truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
|
|
||||||
let query = (this.data ?? app.showingPlaylist).relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
|
let query = (this.data ?? app.showingPlaylist).relationships.tracks.data.map(item => new MusicKit.MediaItem(item));
|
||||||
app.mk.stop().then(function () {
|
app.mk.stop().then(function () {
|
||||||
app.mk.setQueue({[truekind]: [id]}).then(function () {
|
app.mk.setQueue({[truekind]: [id]}).then(function () {
|
||||||
app.mk.play().then(function () {
|
app.mk.play().then(function () {
|
||||||
if (query.length > 100) {
|
if (query.length > 100) {
|
||||||
let u = query.slice(100); if (app.mk.shuffleMode == 1) { shuffleArray(u) }
|
let u = query.slice(100);
|
||||||
app.mk.queue.append(u)}
|
if (app.mk.shuffleMode == 1) {
|
||||||
})
|
shuffleArray(u)
|
||||||
|
}
|
||||||
|
app.mk.queue.append(u)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,7 @@
|
||||||
<!-- Generator: Adobe Illustrator 24.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
<!-- Generator: Adobe Illustrator 24.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||||
fill="white" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
fill="white" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||||
<style type="text/css">
|
<path id="XMLID_11_" d="M418.5,139.4H232.4v139.8h186.1V139.4z M464.8,46.7H46.3C20.5,46.7,0,68.1,0,93.1v325.9
|
||||||
.st0{fill:#333333;}
|
|
||||||
</style>
|
|
||||||
<g id="XMLID_6_">
|
|
||||||
<path id="XMLID_11_" class="st0" d="M418.5,139.4H232.4v139.8h186.1V139.4z M464.8,46.7H46.3C20.5,46.7,0,68.1,0,93.1v325.9
|
|
||||||
c0,25.8,21.4,46.3,46.3,46.3h419.4c25.8,0,46.3-20.5,46.3-46.3V93.1C512,67.2,490.6,46.7,464.8,46.7z M464.8,418.9H46.3V92.2h419.4
|
c0,25.8,21.4,46.3,46.3,46.3h419.4c25.8,0,46.3-20.5,46.3-46.3V93.1C512,67.2,490.6,46.7,464.8,46.7z M464.8,418.9H46.3V92.2h419.4
|
||||||
v326.8H464.8z"/>
|
v326.8H464.8z"/>
|
||||||
</g>
|
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 716 B After Width: | Height: | Size: 627 B |
Loading…
Add table
Add a link
Reference in a new issue