record label page

This commit is contained in:
vapormusic 2021-12-13 19:21:11 +07:00
parent 86212394f4
commit f952cca182
4 changed files with 128 additions and 6 deletions

View file

@ -292,6 +292,10 @@ const app = new Vue({
let response = await this.mk.api.artistView(artist, view, {}, {view: view, includeResponseMeta: !0})
await this.showCollection(response, title, "artists")
},
async showRecordLabelView (label, title, view) {
let response = await this.mk.api.recordLabelView(label, view, {}, {view: view, includeResponseMeta: !0})
await this.showCollection(response, title, "record-labels")
},
async showSearchView(term, group, title) {
let response = await this.mk.api.search(term, {
platform: "web",
@ -422,9 +426,16 @@ const app = new Vue({
;
let isLibrary = item.attributes.playParams ? (item.attributes.playParams.isLibrary ?? false) : false;
console.log(kind, id, isLibrary)
if (kind.toString().includes("artist")) {
app.getArtistInfo(id, isLibrary)
} else if (!kind.toString().includes("radioStation") && !kind.toString().includes("song") && !kind.toString().includes("musicVideo") && !kind.toString().includes("uploadedVideo")) {
} else if (kind.toString().includes("record-label")) {
kind = "recordLabel"
app.page = (kind) + "_" + (id);
console.log("oks");
app.getTypeFromID((kind), (id), (isLibrary), {extend: "editorialVideo", views: 'top-releases,latest-releases,top-artists'});
}
else if (!kind.toString().includes("radioStation") && !kind.toString().includes("song") && !kind.toString().includes("musicVideo") && !kind.toString().includes("uploadedVideo")) {
app.page = (kind) + "_" + (id);
console.log("oks");
app.getTypeFromID((kind), (id), (isLibrary), {extend: "editorialVideo"});
@ -486,12 +497,37 @@ const app = new Vue({
}
catch (e) {console.log(e)}
}
console.log(albumId);
if (albumId != "")
{
app.getTypeFromID("album",albumId, false);
app.page = "album_" + albumId;}
break;
break;
case "recordLabel":
let labelId = '';
try {
labelId = item.relationships['record-labels'].data[0].id
}
catch (_) { }
if (labelId == "") {
try {
let labelQuery = await app.mk.api.search(item.attributes.recordLabel, { limit: 1, types: 'record-labels' })
if (labelQuery["record-labels"].data.length > 0) {
labelId = labelQuery["record-labels"].data[0].id;
console.log(labelId)
}
}
catch (e) {console.log(e)}
}
if (labelId != "")
{
app.showingPlaylist = []
await app.getTypeFromID("recordLabel",labelId, false,{views: 'top-releases,latest-releases,top-artists'});
app.page = "recordLabel_" + labelId;
}
break;
}
},
pushNavigationEvent(item) {
@ -528,15 +564,14 @@ const app = new Vue({
},
async getTypeFromID(kind, id, isLibrary = false, params = {}) {
var a;
if ("kind" == "album" | "kind" == "albums") {
params["include"] = "tracks,artists,record-labels"
if (kind == "album" | kind == "albums") {
params["include"] = "tracks,artists,record-labels";
}
try {
a = await this.mkapi(kind.toString(), isLibrary, id.toString(), params);
} catch (e) {
console.log(e);
try {
console.log("opp", !isLibrary);
a = await this.mkapi(kind.toString(), !isLibrary, id.toString(), params);
} catch (err) {
console.log(err);

View file

@ -258,6 +258,10 @@
<cider-playlist :data="showingPlaylist"></cider-playlist>
</template>
</transition>
<transition name="wpfade">
<template v-if="page.includes('recordLabel_')">
<cider-recordlabel :data="showingPlaylist"></cider-recordlabel>
</template>
</transition>
<!-- Browse -->
<transition name="wpfade">
@ -428,6 +432,9 @@
<!-- Playlists / Albums -->
<%- include('pages/cider-playlist') %>
<!-- Record Label -->
<%- include('pages/recordLabel') %>
<!-- Collection List -->
<%- include('pages/collection-list') %>

View file

@ -58,6 +58,12 @@
<mediaitem-list-item :item="item"
v-for="item in data.relationships.tracks.data"></mediaitem-list-item>
</div>
<div class="playlist-time">
{{data.attributes.releaseDate}}
</div>
<div class="playlist-time" @click="app.searchAndNavigate(data,'recordLabel') " style="width: 50%;">
{{data.attributes.copyright}}
</div>
<div class="playlist-time">{{app.getTotalTime()}}</div>
</div>
</template>

View file

@ -0,0 +1,74 @@
<script type="text/x-template" id="cider-recordlabel">
<div class="content-inner artist-page">
<div class="artist-header" :style="getArtistPalette(data)">
<div class="row">
<div class="col-sm" style="width: auto;">
<div class="artist-image">
<mediaitem-artwork
:shadow="true"
:url="data.attributes.artwork ? data.attributes.artwork.url : ''"
size="220" type="artists"></mediaitem-artwork>
</div>
</div>
<div class="col flex-center"
>
<h1>{{ data.attributes.name }}</h1>
</div>
</div>
</div>
<div class="artist-body">
<div v-if = "app.showingPlaylist.attributes.description">
<div class="row">
<h3>About </h3>
</div>
<div class="row"><div>{{ app.showingPlaylist.attributes.description.standard }}</div>
</div>
<div>
<div class="row">
<div class="col">
<h3>{{ data.views["latest-releases"].attributes.title ?? ""}}</h3>
</div>
<div class="col-auto flex-center" v-if="data.views['latest-releases'].data.length >= 10">
<button class="cd-btn-seeall" @click="app.showRecordLabelView(data.id, data.attributes.name + ' - Latest Releases', 'latest-releases')">See All</button>
</div>
</div>
<mediaitem-square-large :item="item" v-for="item in data.views['latest-releases'].data">
</mediaitem-square-large>
</div>
</div>
</script>
<script>
Vue.component('cider-recordlabel', {
template: "#cider-recordlabel",
props: ['data'],
data: function () {
return {
topSongsExpanded: false
}
},
methods: {
getArtistPalette(artist) {
if (artist["attributes"]["artwork"]) {
return {
"background": "#" + artist["attributes"]["artwork"]["bgColor"],
"color": "#" + artist["attributes"]["artwork"]["textColor1"],
}
} else {
return {
"background": "#000000",
"color": "#ffffff",
}
}
},
getTopResult() {
if (this.search.results["meta"]) {
return this.search.results[this.search.results.meta.results.order[0]]["data"][0]
} else {
return false;
}
}
}
})
</script>