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

@ -337,6 +337,4 @@ Update 29/04/2022 00:00 UTC
* `menubar.options.license`: Added for `en_US`
* `menubar.options.conf`: Added for `en_US`
Update 07/05/2022 04:00 UTC
* `term.personalStations`: Added for `en_US`
`term.amLive`: Added for `en_US`

View file

@ -121,8 +121,6 @@
"term.audioControls": "Volume Controls",
"term.clearAll": "Clear All",
"term.recentStations": "Recent Stations",
"term.personalStations": "Personal Stations",
"term.amLive": "Apple Music Live",
"term.language": "Language",
"term.funLanguages": "Fun",
"term.noLyrics": "Loading... / Lyrics not found./ Instrumental.",

View file

@ -121,8 +121,6 @@
"term.audioControls": "Volume Controls",
"term.clearAll": "Clear All",
"term.recentStations": "Recent Stations",
"term.personalStations": "Personal Stations",
"term.amLive": "Apple Music Live",
"term.language": "Language",
"term.funLanguages": "Fun",
"term.noLyrics": "Loading... / Lyrics not found./ Instrumental.",

View file

@ -59,7 +59,6 @@ export class BrowserWindow {
"pages/settings",
"pages/installed-themes",
"pages/listen_now",
"pages/radio",
"pages/home",
"pages/artist-feed",
"pages/cider-playlist",
@ -113,7 +112,6 @@ export class BrowserWindow {
"components/artist-chip",
"components/hello-world",
"components/inline-collection-list",
"components/radio-child",
],
appRoutes: [
{
@ -188,11 +186,6 @@ export class BrowserWindow {
component: `<cider-listen-now :data="listennow"></cider-listen-now>`,
condition: `page == 'listen_now'`,
onEnter: ``
}, {
page: "radio",
component: `<cider-radio :data="radio"></cider-radio>`,
condition: `page == 'radio'`,
onEnter: ``
}, {
page: "settings",
component: `<cider-settings></cider-settings>`,

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)

View file

@ -25,6 +25,15 @@
</transition>
<% } %>
<transition v-on:enter="getRadioStations()" :name="chrome.desiredPageTransition">
<template v-if="page == 'radio'" @created="console.log('radio')">
<div class="content-inner">
<h1 class="header-text">{{$root.getLz('term.radio')}}</h1>
<h3>{{$root.getLz('term.recentStations')}}</h3>
<mediaitem-square :item="item" v-for="item in radio.personal"></mediaitem-square>
</div>
</template>
</transition>
<!-- Library - Recently Added -->
<transition :name="chrome.desiredPageTransition" v-on:enter="getLibraryAlbumsFull(null, 0); searchLibraryAlbums(0);">
<%- include('../pages/library-recentlyadded') %>');

View file

@ -39,8 +39,8 @@
<sidebar-library-item :name="$root.getLz('term.browse')" svg-icon="./assets/feather/globe.svg"
page="browse">
</sidebar-library-item>
<sidebar-library-item :name="$root.getLz('term.radio')" svg-icon="./assets/feather/radio.svg"
page="radio"></sidebar-library-item>
<sidebar-library-item :name="$root.getLz('term.radio')" svg-icon="./assets/feather/radio.svg" page="radio">
</sidebar-library-item>
</template>
<div class="app-sidebar-header-text"

View file

@ -1,31 +0,0 @@
<script type="text/x-template" id="radio-child">
<div>
<div class="row">
<div class="col">
<h3>{{ item.title }}</h3>
</div>
</div>
<mediaitem-square :item="station" v-for="station in item.data"></mediaitem-square>
<!-- <mediaitem-scroller-horizontal-sp-->
<!-- :withReason="index==0"-->
<!-- :items="recom.relationships.contents.data.limit(10)"></mediaitem-scroller-horizontal-sp>-->
</div>
</script>
<script>
Vue.component('radio-child', {
template: "#radio-child",
props: ["item"],
data: function () {
return {
isVisible: true,
app: this.$root
}
},
methods: {
visibilityChanged: function (isVisible, entry) {
// this.isVisible = isVisible
},
}
})
</script>

View file

@ -1,23 +0,0 @@
<script type="text/x-template" id="cider-radio">
<div class="content-inner">
<h1 class="header-text">{{app.getLz('term.radio')}}</h1>
<template v-for="item in data">
<radio-child :item="item"></radio-child>
</template>
</div>
</script>
<script>
Vue.component('cider-radio', {
template: "#cider-radio",
props: ["data"],
data: function () {
return {
app: this.$root
}
},
mounted() {
this.$root.getRadioStations()
}
})
</script>