Merge branch 'ciderapp:develop' into develop

This commit is contained in:
Core 2022-02-16 14:35:27 +00:00 committed by GitHub
commit 16c0f8408f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 20 deletions

View file

@ -154,6 +154,7 @@
"term.videoExtras": "Video Extras", "term.videoExtras": "Video Extras",
"term.top": "Top", "term.top": "Top",
"term.version": "Version", "term.version": "Version",
"term.noVideos": "No videos found.",
// Home // Home
"home.title": "Home", "home.title": "Home",

View file

@ -1094,7 +1094,7 @@ const app = new Vue({
let playlistId = response.id let playlistId = response.id
this.playlists.loadingState = (!transient) ? 0 : 1 this.playlists.loadingState = (!transient) ? 0 : 1
this.showingPlaylist = response this.showingPlaylist = response
if (!response.relationships.tracks.next) { if (!response.relationships?.tracks?.next) {
this.playlists.loadingState = 1 this.playlists.loadingState = 1
return return
} }
@ -1170,7 +1170,7 @@ const app = new Vue({
let max = this.mk.currentPlaybackDuration let max = this.mk.currentPlaybackDuration
let value = (val - min) / (max - min) * 100 let value = (val - min) / (max - min) * 100
return { return {
'background': ('linear-gradient(to right, var(--keyColor) 0%, var(--keyColor) ' + value + '%, #333 ' + value + '%, #333 100%)') 'background': ('linear-gradient(to right, var(--songProgressColor) 0%, var(--songProgressColor) ' + value + '%, var(--songProgressBackground) ' + value + '%, var(--songProgressBackground) 100%)')
} }
}, },
async getRecursive(response) { async getRecursive(response) {

View file

@ -35,6 +35,8 @@
--keyColor-disabled: rgba(250, 88, 106, 0.35); --keyColor-disabled: rgba(250, 88, 106, 0.35);
--navigationBarHeight: 38px; --navigationBarHeight: 38px;
--modalBackground: #262626; --modalBackground: #262626;
--songProgressColor: var(--keyColor);
--songProgressBackground: #333;
--textColor: #eee; --textColor: #eee;
} }

View file

@ -144,13 +144,15 @@
}, },
async isInLibrary() { async isInLibrary() {
if (this.item.type && !this.item.type.includes("library")) { if (this.item.type && !this.item.type.includes("library")) {
var params = { let params = {
"fields[playlists]": "inLibrary", relate:"library",
"fields[albums]": "inLibrary", "fields":"inLibrary",
"relate": "library",
"extend": this.revisedRandId() "extend": this.revisedRandId()
} }
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params); let kind = this.item.type ?? this.item.attributes.playParams.kind
let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
if (truekind == "musicVideos") {truekind = "music-videos"}
let res = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
res = res.data.data[0] res = res.data.data[0]
this.addedToLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false this.addedToLibrary = (res && res.attributes && res.attributes.inLibrary) ? res.attributes.inLibrary : false
} else { } else {
@ -158,21 +160,20 @@
} }
}, },
async removeFromLibrary(id) { async removeFromLibrary(id) {
var params = { let params = {
"fields[playlists]": "inLibrary", relate:"library",
"fields[songs]": "inLibrary", "fields":"inLibrary",
"fields[albums]": "inLibrary",
"relate": "library",
"extend": this.revisedRandId() "extend": this.revisedRandId()
} }
var id = this.item.id ?? this.item.attributes.playParams.id let kind = this.item.type ?? this.item.attributes.playParams.kind
var res = await app.mkapi(this.item.attributes.playParams.kind ?? this.item.type, this.item.attributes.playParams.isLibrary ?? false, this.item.attributes.playParams.id ?? this.item.id, params); let truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
if (truekind == "musicVideos") {truekind = "music-videos"}
let res = await app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/?ids[${truekind}]=${this.item.attributes.playParams.id ?? this.item.id}`,params);
res= res.data.data[0] res= res.data.data[0]
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.item.attributes.playParams.kind ?? this.item.type ?? '';
var truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{}, app.mk.api.v3.music(`v1/me/library/${truekind}/${id.toString()}`,{},
{ {
fetchOptions: { fetchOptions: {

View file

@ -6,8 +6,13 @@
</div> </div>
</div> </div>
<div class="madeforyou-body"> <div class="madeforyou-body">
<template v-if="videos.length > 0">
<mediaitem-square :size="300" :item="item" v-for="item in videos"> <mediaitem-square :size="300" :item="item" v-for="item in videos">
</mediaitem-square> </mediaitem-square>
</template>
<template v-else-if="loaded == true">
<div>{{$root.getLz('term.noVideos')}}</div>
</template>
</div> </div>
</div> </div>
</script> </script>
@ -19,12 +24,14 @@
data: function(){ data: function(){
return { return {
videos: [], videos: [],
loaded: false
} }
}, },
mounted() { mounted() {
this.$nextTick(async function () { this.$nextTick(async function () {
if (this.$data.videos == null || this.$data.videos.length == 0) if (this.$data.videos == null || this.$data.videos.length == 0)
this.$data.videos = (await this.$root.mk.api.v3.music('/v1/me/library/music-videos')).data?.data ?? [] this.$data.videos = (await this.$root.mk.api.v3.music('/v1/me/library/music-videos')).data?.data ?? []
this.$data.loaded = true
}) })
} }
}) })