CHONKY BOY

This commit is contained in:
Core 2022-08-04 05:27:29 +01:00
parent 31ed921a1a
commit c15f55d0ee
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
213 changed files with 64188 additions and 55736 deletions

View file

@ -6,10 +6,10 @@
<h3>{{ app.getLz('term.personalStations') }}</h3>
</div>
</div>
<!-- <mediaitem-square :kind="'385'" size="600"-->
<!-- :item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []"-->
<!-- :imagesize="800"-->
<!-- v-for="item of getFlattenedCategories()">-->
<!-- <mediaitem-square :kind="'385'" size="600"-->
<!-- :item="item ? (item.attributes.kind ? item : ((item.relationships && item.relationships.contents ) ? item.relationships.contents.data[0] : item)) : []"-->
<!-- :imagesize="800"-->
<!-- v-for="item of getFlattenedCategories()">-->
<mediaitem-square :item="item" v-for="item in radio.personal"></mediaitem-square>
<div class="row">
<div class="col">
@ -27,65 +27,65 @@
</script>
<script>
Vue.component('cider-radio', {
template: "#cider-radio",
props: ["data"],
data: function () {
return {
app: this.$root,
radio: {personal: [], recent: [], am: []}
}
},
async mounted() {
this.radio.personal = await this.getPersonalStations()
this.radio.recent = await this.getRecentStations()
this.radio.am = await this.getAmStations()
console.log(this.radio)
// this.getPersonalStations();
// this.getAmStations();
},
methods: {
async getPersonalStations(attempts = 0) {
if (attempts > 3) {
return []
}
try {
return (await app.mk.api.v3.music(`/v1/catalog/${app.mk.api.v3.storefrontId}/stations`, {
"filter[identity]": "personal",
})).data.data
} catch (e) {
console.error(`Failed to get personal stations: ${e}`)
await this.getPersonalStations(attempts + 1)
}
},
async getRecentStations(attempts = 0) {
if (attempts > 3) {
return []
}
try {
return (await app.mk.api.v3.music(`/v1/me/recent/radio-stations`, {
"platform": "web",
"art[url]": "f",
l: app.mklang
})).data.data
} catch (e) {
console.error(`Failed to get recent stations: ${e}`)
await this.getRecentStations(attempts + 1)
}
},
async getAmStations(attempt = 0) {
if (attempt > 3) {
return []
}
try {
return (await app.mk.api.v3.music(`/v1/catalog/${app.mk.api.v3.storefrontId}/stations`, {
"filter[featured]": "apple-music-live-radio",
})).data.data
} catch (e) {
console.error(`Failed to get AM stations: ${e}`)
await this.getAmStations(attempt + 1)
}
},
}
})
</script>
Vue.component('cider-radio', {
template: "#cider-radio",
props: ["data"],
data: function() {
return {
app: this.$root,
radio: { personal: [], recent: [], am: [] }
}
},
async mounted() {
this.radio.personal = await this.getPersonalStations()
this.radio.recent = await this.getRecentStations()
this.radio.am = await this.getAmStations()
console.log(this.radio)
// this.getPersonalStations();
// this.getAmStations();
},
methods: {
async getPersonalStations(attempts = 0) {
if (attempts > 3) {
return []
}
try {
return (await app.mk.api.v3.music(`/v1/catalog/${app.mk.api.v3.storefrontId}/stations`, {
"filter[identity]": "personal",
})).data.data
} catch (e) {
console.error(`Failed to get personal stations: ${e}`)
await this.getPersonalStations(attempts + 1)
}
},
async getRecentStations(attempts = 0) {
if (attempts > 3) {
return []
}
try {
return (await app.mk.api.v3.music(`/v1/me/recent/radio-stations`, {
"platform": "web",
"art[url]": "f",
l: app.mklang
})).data.data
} catch (e) {
console.error(`Failed to get recent stations: ${e}`)
await this.getRecentStations(attempts + 1)
}
},
async getAmStations(attempt = 0) {
if (attempt > 3) {
return []
}
try {
return (await app.mk.api.v3.music(`/v1/catalog/${app.mk.api.v3.storefrontId}/stations`, {
"filter[featured]": "apple-music-live-radio",
})).data.data
} catch (e) {
console.error(`Failed to get AM stations: ${e}`)
await this.getAmStations(attempt + 1)
}
},
}
})
</script>