diff --git a/client/.eslintrc.cjs b/client/.eslintrc.cjs index 91c823b..beb304a 100644 --- a/client/.eslintrc.cjs +++ b/client/.eslintrc.cjs @@ -83,5 +83,8 @@ module.exports = { 'vue/multi-word-component-names': 'off', // allow debugger during development only 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', + + // Custom + // 'no-console': 'warn', }, }; diff --git a/client/quasar.config.js b/client/quasar.config.js index 3937e54..414ef9e 100644 --- a/client/quasar.config.js +++ b/client/quasar.config.js @@ -228,30 +228,30 @@ module.exports = configure(function (ctx) { theme_color: '#027be3', icons: [ { - src: 'icons/icon-128x128.png', - sizes: '128x128', - type: 'image/png', - }, - { - src: 'icons/icon-192x192.png', - sizes: '192x192', - type: 'image/png', - }, - { - src: 'icons/icon-256x256.png', - sizes: '256x256', - type: 'image/png', - }, - { - src: 'icons/icon-384x384.png', - sizes: '384x384', - type: 'image/png', - }, - { - src: 'icons/icon-512x512.png', - sizes: '512x512', - type: 'image/png', + src: 'icons/favicon-16x16.svg', + sizes: '16x16', + type: 'svg', }, + // { + // src: 'icons/icon-192x192.png', + // sizes: '192x192', + // type: 'image/png', + // }, + // { + // src: 'icons/icon-256x256.png', + // sizes: '256x256', + // type: 'image/png', + // }, + // { + // src: 'icons/icon-384x384.png', + // sizes: '384x384', + // type: 'image/png', + // }, + // { + // src: 'icons/icon-512x512.png', + // sizes: '512x512', + // type: 'image/png', + // }, ], }, }, diff --git a/client/src/components/player.vue b/client/src/components/player.vue index d50d9a9..e1a1587 100644 --- a/client/src/components/player.vue +++ b/client/src/components/player.vue @@ -156,12 +156,11 @@ export default { }, }, created() { - this.initializationInfo(); + // this.initializationInfo(); this.connectionPlayer(); }, mounted() { this.$store.dispatch('initPlayer'); - // console.log(this.$store.state); if (this.user?.id) { this.checkSongIsFavorite(); this.getSongList(); @@ -193,14 +192,15 @@ export default { app .getNowplaying() .then((responce) => { - console.log(responce.now_playing.song); + const { art, title, artist } = responce.now_playing.song; + console.log(art, title, artist); this.$store.dispatch('setCurrentPlay', { ...this.currentPlay, isLoader: false, - ...responce.now_playing.song, + art, + title, + artist, }); - console.log(this.player.target.src); - // console.log(this.$store.state); }) .catch((error) => console.log(error)); }, @@ -209,9 +209,11 @@ export default { if (this.connection) { this.connection.removePlay(); } + this.connection = new Player(); this.connection.init(); - this.connection.onHandler(this.getPlaying); + + this.connection.onHandler(this.handlePlayer); }, checkSongIsFavorite() { app @@ -234,30 +236,36 @@ export default { console.error(err); }); }, - getPlaying(e) { + handlePlayer(e) { + // console.log('getPlaying', e); const jsonData = JSON.parse(e.data); - if (jsonData?.pub?.data) { - const data = jsonData?.pub?.data; - if (this.currentPlay.live) { - if (data.np.station.listen_url !== this.player.target.src) { - console.log( - 'data.np.station.listen_url', - data.np.station.listen_url, - ); - this.$store.dispatch('changePlayer', data.np.station.listen_url); - console.log(this.player); - const params = { - ...this.currentPlay, - ...data.np.now_playing.song, - azura_id: data.np.now_playing.song.id, - isLoader: false, - live: true, - currentIndex: null, - }; - delete params.unique_id; - this.$store.dispatch('setCurrentPlay', params); - console.log(this.$store.state); - } + // console.log('jsonData', jsonData); + const data = + // Второй ответ + jsonData?.pub?.data || + // Первый ответ + jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data; + // console.log('getPlaying', data); + + if (!data) return; + if (this.currentPlay.live) { + const dataUrl = data.np.station.listen_url; + const playerUrl = this.player.target.src; + if (dataUrl !== playerUrl) { + // console.log('data.np.station.listen_url', dataUrl); + this.$store.dispatch('changePlayer', dataUrl); + console.log(this.player); + const params = { + ...this.currentPlay, + ...data.np.now_playing.song, + azura_id: data.np.now_playing.song.id, + isLoader: false, + live: true, + currentIndex: null, + }; + console.log('params in getPlaying ', params); + delete params.unique_id; + this.$store.dispatch('setCurrentPlay', params); } } }, @@ -358,6 +366,7 @@ export default { app .getAudio(id) .then((res) => { + console.log('res в методе getAudio', res); const blob = new Blob([res], { type: 'application/audio' }); const audioUrl = URL.createObjectURL(blob); this.$store.dispatch('changePlayer', audioUrl); diff --git a/client/src/index.template.html b/client/src/index.template.html index 16eea2c..0998647 100644 --- a/client/src/index.template.html +++ b/client/src/index.template.html @@ -1,20 +1,28 @@ - + - - - - - - - - - - - - - - - -
- + + + + + + + + + + + + + + + +
+ diff --git a/client/src/services/audio.js b/client/src/services/audio.js index 532793d..08abe19 100644 --- a/client/src/services/audio.js +++ b/client/src/services/audio.js @@ -24,6 +24,8 @@ export default class extends REST { this.connection = new EventSource( sseBaseUri + '?' + sseUriParams.toString(), ); + // window.connection = this.connection; + // this.connection.onopen = (e) => console.log('connected', e); } removePlay() { @@ -64,7 +66,6 @@ export default class extends REST { // return this._get(`station/${station}/playlists`, params, {}).then((data) => { return this._get(`radio.mp3`, params, {}) .then((data) => { - console.log(data); return data; }) .catch((error) => {