Revert "Radio improvement, needs optimisation."

This reverts commit c0c12bc2ba.
This commit is contained in:
Core 2022-05-07 06:41:39 +01:00
parent f9f300968d
commit baf234085e
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
9 changed files with 15 additions and 100 deletions

View file

@ -42,9 +42,7 @@ const app = new Vue({
listennow: [],
madeforyou: [],
radio: {
personal: {},
recent: {},
amlive: {},
personal: []
},
mklang: 'en',
webview: {
@ -324,7 +322,6 @@ const app = new Vue({
try {
this.listennow.timestamp = 0;
this.browsepage.timestamp = 0;
this.radio.timestamp = 0;
} catch (e) { }
},
/**
@ -2535,39 +2532,15 @@ const app = new Vue({
}
},
async getRadioStations(attempt = 0) {
if (this.radio.timestamp > Date.now() - 120000) {
return
}
if (attempt > 3) {
return
}
try {
this.radio.personal.title = app.getLz('term.personalStations')
this.radio.recent.title = app.getLz('term.recentStations')
this.radio.amlive.title = app.getLz('term.amLive')
app.mk.api.v3.music(`/v1/catalog/${app.mk.api.v3.storefrontId}/stations`, {
"filter[identity]": "personal",
}).then(res => {
this.radio.personal.data = res.data.data
})
app.mk.api.v3.music(`/v1/me/recent/radio-stations`, {
this.radio.personal = (await app.mk.api.v3.music(`/v1/me/recent/radio-stations`, {
"platform": "web",
"art[url]": "f",
l: this.mklang
}).then(res => {
this.radio.recent.data = res.data.data
})
app.mk.api.v3.music(`/v1/catalog/${app.mk.api.v3.storefrontId}/stations`, {
"filter[featured]": "apple-music-live-radio",
}).then(res => {
this.radio.amlive.data = res.data.data
})
this.radio.timestamp = Date.now()
console.debug(this.radio)
})).data.data;
} catch (e) {
console.log(e)
this.getRadioStations(attempt + 1)