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.license`: Added for `en_US`
* `menubar.options.conf`: 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.audioControls": "Volume Controls",
"term.clearAll": "Clear All", "term.clearAll": "Clear All",
"term.recentStations": "Recent Stations", "term.recentStations": "Recent Stations",
"term.personalStations": "Personal Stations",
"term.amLive": "Apple Music Live",
"term.language": "Language", "term.language": "Language",
"term.funLanguages": "Fun", "term.funLanguages": "Fun",
"term.noLyrics": "Loading... / Lyrics not found./ Instrumental.", "term.noLyrics": "Loading... / Lyrics not found./ Instrumental.",

View file

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

View file

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

View file

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

View file

@ -25,6 +25,15 @@
</transition> </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 --> <!-- Library - Recently Added -->
<transition :name="chrome.desiredPageTransition" v-on:enter="getLibraryAlbumsFull(null, 0); searchLibraryAlbums(0);"> <transition :name="chrome.desiredPageTransition" v-on:enter="getLibraryAlbumsFull(null, 0); searchLibraryAlbums(0);">
<%- include('../pages/library-recentlyadded') %>'); <%- include('../pages/library-recentlyadded') %>');

View file

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