Переглянути джерело

Fixed some issues with stations and playlists.

KrisVos130 8 роки тому
батько
коміт
25c4592f3d

+ 2 - 1
backend/logic/actions/stations.js

@@ -536,7 +536,8 @@ module.exports = {
 				db.models.playlist.findOne({ _id: playlistId }, (err, playlist) => {
 					if (err) return cb(err);
 					if (playlist) {
-						db.models.station.update({_id: stationId}, { $set: { privatePlaylist: playlistId, currentSongIndex: 0 } }, (err) => {
+						let currentSongIndex = (playlist.songs.length > 0) ? playlist.songs.length - 1 : 0;
+						db.models.station.update({_id: stationId}, { $set: { privatePlaylist: playlistId, currentSongIndex: currentSongIndex } }, (err) => {
 							if (err) return cb(err);
 							stations.updateStation(stationId, (err, station) => {
 								if (err) return cb(err);

+ 1 - 1
frontend/components/Station/Station.vue

@@ -163,7 +163,7 @@
 									local.player.seekTo(local.timeBeforePause / 1000, true);
 									local.player.pauseVideo();
 								}
-								if (event.data === 2 && !local.paused && !local.noSong && local.getTimeElapsed() < local.currentSong.duration) {
+								if (event.data === 2 && !local.paused && !local.noSong && (local.getTimeElapsed() / 1000) < local.currentSong.duration) {
 									local.player.seekTo(local.getTimeElapsed() / 1000 + local.currentSong.skipDuration, true);
 									local.player.playVideo();
 								}