Merge branch 'master' of git.flexites.org:Students/ITRadio

This commit is contained in:
Mike0001-droid 2024-06-27 17:10:42 +05:00
commit d332dac38f
6 changed files with 28 additions and 14 deletions

View File

@ -219,9 +219,9 @@ module.exports = configure(function (ctx) {
}, },
manifest: { manifest: {
name: 'Tugan App', name: 'IT Radio App',
short_name: 'Tugan App', short_name: 'IT Radio App',
description: 'A Tugan project', description: 'IT Radio project',
display: 'standalone', display: 'standalone',
orientation: 'portrait', orientation: 'portrait',
background_color: '#ffffff', background_color: '#ffffff',
@ -284,7 +284,7 @@ module.exports = configure(function (ctx) {
builder: { builder: {
// https://www.electron.build/configuration/configuration // https://www.electron.build/configuration/configuration
appId: 'tugan', appId: 'it-radio',
}, },
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain // "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain

View File

@ -156,11 +156,12 @@ export default {
}, },
}, },
created() { created() {
this.initializationInfo();
this.connectionPlayer(); this.connectionPlayer();
}, },
mounted() { mounted() {
this.initializationInfo();
this.$store.dispatch('initPlayer'); this.$store.dispatch('initPlayer');
// console.log(this.$store.state);
if (this.user?.id) { if (this.user?.id) {
this.checkSongIsFavorite(); this.checkSongIsFavorite();
this.getSongList(); this.getSongList();
@ -188,9 +189,22 @@ export default {
} }
}, },
methods: { methods: {
async initializationInfo() { initializationInfo() {
return app.getNowplaying().then((responce) => responce.now_playing.song); app
.getNowplaying()
.then((responce) => {
console.log(responce.now_playing.song);
this.$store.dispatch('setCurrentPlay', {
...this.currentPlay,
isLoader: false,
...responce.now_playing.song,
});
console.log(this.player.target.src);
// console.log(this.$store.state);
})
.catch((error) => console.log(error));
}, },
connectionPlayer() { connectionPlayer() {
if (this.connection) { if (this.connection) {
this.connection.removePlay(); this.connection.removePlay();
@ -231,6 +245,7 @@ export default {
data.np.station.listen_url, data.np.station.listen_url,
); );
this.$store.dispatch('changePlayer', data.np.station.listen_url); this.$store.dispatch('changePlayer', data.np.station.listen_url);
console.log(this.player);
const params = { const params = {
...this.currentPlay, ...this.currentPlay,
...data.np.now_playing.song, ...data.np.now_playing.song,
@ -241,6 +256,7 @@ export default {
}; };
delete params.unique_id; delete params.unique_id;
this.$store.dispatch('setCurrentPlay', params); this.$store.dispatch('setCurrentPlay', params);
console.log(this.$store.state);
} }
} }
} }

View File

@ -217,7 +217,7 @@ export default class extends REST {
} }
static getNowplaying(station, params) { static getNowplaying(station, params) {
return this._get('/radio/song/get_nowplaying/', params, {}) return this._get('radio/song/get_nowplaying', params, {})
.then((data) => { .then((data) => {
return data; return data;
}) })
@ -229,5 +229,3 @@ export default class extends REST {
}); });
} }
} }
// console.log(Django.getNowplaying());

View File

@ -57,8 +57,8 @@ export default class extends REST {
}; };
} }
onHandler(event) { onHandler(callback) {
this.connection.onmessage = event; this.connection.onmessage = callback;
} }
static getPlayList(station, params) { static getPlayList(station, params) {
// return this._get(`station/${station}/playlists`, params, {}).then((data) => { // return this._get(`station/${station}/playlists`, params, {}).then((data) => {

View File

@ -41,5 +41,4 @@ const robotsTxt = {
}, },
], ],
}; };
console.log(urlPath);
export { selfUrl, ajax, cache, urlPath, urlPathAudio, selfPath, robotsTxt }; export { selfUrl, ajax, cache, urlPath, urlPathAudio, selfPath, robotsTxt };

View File

@ -39,7 +39,7 @@ export default createStore({
}, },
}; };
}, },
plugins: [vuexPersist.plugin], // plugins: [vuexPersist.plugin],
mutations: { mutations: {
user(state, user) { user(state, user) {
state.user = user; state.user = user;
@ -92,6 +92,7 @@ export default createStore({
state.player.target.pause(); state.player.target.pause();
} }
if (params.play) { if (params.play) {
console.log(state);
if (state.player.target.readyState >= 3) { if (state.player.target.readyState >= 3) {
state.currentPlay.isPlay = true; state.currentPlay.isPlay = true;
state.player.target.play(); state.player.target.play();