|
@@ -5,7 +5,7 @@
|
|
<div class="left-section">
|
|
<div class="left-section">
|
|
<div class="top-section">
|
|
<div class="top-section">
|
|
<div class="player-section">
|
|
<div class="player-section">
|
|
- <div id="player"></div>
|
|
|
|
|
|
+ <div id="editSongPlayer"></div>
|
|
<canvas
|
|
<canvas
|
|
id="durationCanvas"
|
|
id="durationCanvas"
|
|
height="20"
|
|
height="20"
|
|
@@ -74,11 +74,12 @@
|
|
</div>
|
|
</div>
|
|
<img
|
|
<img
|
|
class="thumbnail-preview"
|
|
class="thumbnail-preview"
|
|
- :src="editing.song.thumbnail"
|
|
|
|
|
|
+ :src="song.thumbnail"
|
|
onerror="this.src='/assets/notes-transparent.png'"
|
|
onerror="this.src='/assets/notes-transparent.png'"
|
|
|
|
+ v-if="songDataLoaded"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
- <div class="edit-section">
|
|
|
|
|
|
+ <div class="edit-section" v-if="songDataLoaded">
|
|
<div class="control is-grouped">
|
|
<div class="control is-grouped">
|
|
<div class="title-container">
|
|
<div class="title-container">
|
|
<label class="label">Title</label>
|
|
<label class="label">Title</label>
|
|
@@ -87,7 +88,7 @@
|
|
class="input"
|
|
class="input"
|
|
type="text"
|
|
type="text"
|
|
id="title-input"
|
|
id="title-input"
|
|
- v-model="editing.song.title"
|
|
|
|
|
|
+ v-model="song.title"
|
|
@keyup.ctrl.alt.d="
|
|
@keyup.ctrl.alt.d="
|
|
getAlbumData('title')
|
|
getAlbumData('title')
|
|
"
|
|
"
|
|
@@ -106,7 +107,7 @@
|
|
<input
|
|
<input
|
|
class="input"
|
|
class="input"
|
|
type="text"
|
|
type="text"
|
|
- v-model.number="editing.song.duration"
|
|
|
|
|
|
+ v-model.number="song.duration"
|
|
/>
|
|
/>
|
|
<button
|
|
<button
|
|
class="button duration-fill-button"
|
|
class="button duration-fill-button"
|
|
@@ -122,9 +123,7 @@
|
|
<input
|
|
<input
|
|
class="input"
|
|
class="input"
|
|
type="text"
|
|
type="text"
|
|
- v-model.number="
|
|
|
|
- editing.song.skipDuration
|
|
|
|
- "
|
|
|
|
|
|
+ v-model.number="song.skipDuration"
|
|
/>
|
|
/>
|
|
</p>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
@@ -136,7 +135,7 @@
|
|
<input
|
|
<input
|
|
class="input"
|
|
class="input"
|
|
type="text"
|
|
type="text"
|
|
- v-model="editing.song.thumbnail"
|
|
|
|
|
|
+ v-model="song.thumbnail"
|
|
@keyup.ctrl.alt.d="
|
|
@keyup.ctrl.alt.d="
|
|
getAlbumData('albumArt')
|
|
getAlbumData('albumArt')
|
|
"
|
|
"
|
|
@@ -203,8 +202,7 @@
|
|
<div class="list-container">
|
|
<div class="list-container">
|
|
<div
|
|
<div
|
|
class="list-item"
|
|
class="list-item"
|
|
- v-for="(artist, index) in editing.song
|
|
|
|
- .artists"
|
|
|
|
|
|
+ v-for="(artist, index) in song.artists"
|
|
:key="index"
|
|
:key="index"
|
|
>
|
|
>
|
|
<div
|
|
<div
|
|
@@ -276,8 +274,7 @@
|
|
<div class="list-container">
|
|
<div class="list-container">
|
|
<div
|
|
<div
|
|
class="list-item"
|
|
class="list-item"
|
|
- v-for="(genre, index) in editing.song
|
|
|
|
- .genres"
|
|
|
|
|
|
+ v-for="(genre, index) in song.genres"
|
|
:key="index"
|
|
:key="index"
|
|
>
|
|
>
|
|
<div
|
|
<div
|
|
@@ -296,41 +293,33 @@
|
|
<input
|
|
<input
|
|
class="input"
|
|
class="input"
|
|
type="text"
|
|
type="text"
|
|
- v-model="editing.song.songId"
|
|
|
|
|
|
+ v-model="song.songId"
|
|
/>
|
|
/>
|
|
</p>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div class="right-section">
|
|
|
|
|
|
+ <div class="right-section" v-if="songDataLoaded">
|
|
<div class="api-section">
|
|
<div class="api-section">
|
|
- <div
|
|
|
|
- class="selected-discogs-info"
|
|
|
|
- v-if="!editing.song.discogs"
|
|
|
|
- >
|
|
|
|
|
|
+ <div class="selected-discogs-info" v-if="!song.discogs">
|
|
<p class="selected-discogs-info-none">None</p>
|
|
<p class="selected-discogs-info-none">None</p>
|
|
</div>
|
|
</div>
|
|
- <div
|
|
|
|
- class="selected-discogs-info"
|
|
|
|
- v-if="editing.song.discogs"
|
|
|
|
- >
|
|
|
|
|
|
+ <div class="selected-discogs-info" v-if="song.discogs">
|
|
<div class="top-container">
|
|
<div class="top-container">
|
|
- <img
|
|
|
|
- :src="editing.song.discogs.album.albumArt"
|
|
|
|
- />
|
|
|
|
|
|
+ <img :src="song.discogs.album.albumArt" />
|
|
<div class="right-container">
|
|
<div class="right-container">
|
|
<p class="album-title">
|
|
<p class="album-title">
|
|
- {{ editing.song.discogs.album.title }}
|
|
|
|
|
|
+ {{ song.discogs.album.title }}
|
|
</p>
|
|
</p>
|
|
<div class="bottom-row">
|
|
<div class="bottom-row">
|
|
<p class="type-year">
|
|
<p class="type-year">
|
|
<span>{{
|
|
<span>{{
|
|
- editing.song.discogs.album.type
|
|
|
|
|
|
+ song.discogs.album.type
|
|
}}</span>
|
|
}}</span>
|
|
•
|
|
•
|
|
<span>{{
|
|
<span>{{
|
|
- editing.song.discogs.album.year
|
|
|
|
|
|
+ song.discogs.album.year
|
|
}}</span>
|
|
}}</span>
|
|
</p>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
@@ -340,34 +329,24 @@
|
|
<p class="bottom-container-field">
|
|
<p class="bottom-container-field">
|
|
Artists:
|
|
Artists:
|
|
<span>{{
|
|
<span>{{
|
|
- editing.song.discogs.album.artists.join(
|
|
|
|
- ", "
|
|
|
|
- )
|
|
|
|
|
|
+ song.discogs.album.artists.join(", ")
|
|
}}</span>
|
|
}}</span>
|
|
</p>
|
|
</p>
|
|
<p class="bottom-container-field">
|
|
<p class="bottom-container-field">
|
|
Genres:
|
|
Genres:
|
|
<span>{{
|
|
<span>{{
|
|
- editing.song.discogs.album.genres.join(
|
|
|
|
- ", "
|
|
|
|
- )
|
|
|
|
|
|
+ song.discogs.album.genres.join(", ")
|
|
}}</span>
|
|
}}</span>
|
|
</p>
|
|
</p>
|
|
<p class="bottom-container-field">
|
|
<p class="bottom-container-field">
|
|
Data quality:
|
|
Data quality:
|
|
- <span>{{
|
|
|
|
- editing.song.discogs.dataQuality
|
|
|
|
- }}</span>
|
|
|
|
|
|
+ <span>{{ song.discogs.dataQuality }}</span>
|
|
</p>
|
|
</p>
|
|
<p class="bottom-container-field">
|
|
<p class="bottom-container-field">
|
|
Track:
|
|
Track:
|
|
<span
|
|
<span
|
|
- >{{
|
|
|
|
- editing.song.discogs.track.position
|
|
|
|
- }}.
|
|
|
|
- {{
|
|
|
|
- editing.song.discogs.track.title
|
|
|
|
- }}</span
|
|
|
|
|
|
+ >{{ song.discogs.track.position }}.
|
|
|
|
+ {{ song.discogs.track.title }}</span
|
|
>
|
|
>
|
|
</p>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
@@ -492,23 +471,17 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div slot="footer" class="footer-buttons">
|
|
<div slot="footer" class="footer-buttons">
|
|
- <button
|
|
|
|
- class="button is-success"
|
|
|
|
- @click="save(editing.song, false)"
|
|
|
|
- >
|
|
|
|
|
|
+ <button class="button is-success" @click="save(song, false)">
|
|
<i class="material-icons save-changes">done</i>
|
|
<i class="material-icons save-changes">done</i>
|
|
<span> Save</span>
|
|
<span> Save</span>
|
|
</button>
|
|
</button>
|
|
- <button
|
|
|
|
- class="button is-success"
|
|
|
|
- @click="save(editing.song, true)"
|
|
|
|
- >
|
|
|
|
|
|
+ <button class="button is-success" @click="save(song, true)">
|
|
<i class="material-icons save-changes">done</i>
|
|
<i class="material-icons save-changes">done</i>
|
|
<span> Save and close</span>
|
|
<span> Save and close</span>
|
|
</button>
|
|
</button>
|
|
<button
|
|
<button
|
|
class="button is-danger"
|
|
class="button is-danger"
|
|
- @click="closeModal({ sector: 'admin', modal: 'editSong' })"
|
|
|
|
|
|
+ @click="closeModal({ sector: sector, modal: 'editSong' })"
|
|
>
|
|
>
|
|
<span> Close</span>
|
|
<span> Close</span>
|
|
</button>
|
|
</button>
|
|
@@ -545,8 +518,14 @@ import FloatingBox from "../ui/FloatingBox.vue";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
components: { Modal, FloatingBox },
|
|
components: { Modal, FloatingBox },
|
|
|
|
+ props: {
|
|
|
|
+ songId: { type: String, default: null },
|
|
|
|
+ songType: { type: String, default: null },
|
|
|
|
+ sector: { type: String, default: "admin" }
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ songDataLoaded: false,
|
|
focusedElementBefore: null,
|
|
focusedElementBefore: null,
|
|
discogsQuery: "",
|
|
discogsQuery: "",
|
|
youtubeVideoDuration: 0.0,
|
|
youtubeVideoDuration: 0.0,
|
|
@@ -605,10 +584,9 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
- ...mapState("admin/songs", {
|
|
|
|
|
|
+ ...mapState("editSongModal", {
|
|
video: state => state.video,
|
|
video: state => state.video,
|
|
- editing: state => state.editing,
|
|
|
|
- songs: state => state.songs
|
|
|
|
|
|
+ song: state => state.song
|
|
}),
|
|
}),
|
|
...mapState("modals", {
|
|
...mapState("modals", {
|
|
modals: state => state.modals.admin
|
|
modals: state => state.modals.admin
|
|
@@ -616,10 +594,10 @@ export default {
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
/* eslint-disable */
|
|
/* eslint-disable */
|
|
- "editing.song.duration": function() {
|
|
|
|
|
|
+ "song.duration": function () {
|
|
this.drawCanvas();
|
|
this.drawCanvas();
|
|
},
|
|
},
|
|
- "editing.song.skipDuration": function() {
|
|
|
|
|
|
+ "song.skipDuration": function () {
|
|
this.drawCanvas();
|
|
this.drawCanvas();
|
|
}
|
|
}
|
|
/* eslint-enable */
|
|
/* eslint-enable */
|
|
@@ -628,123 +606,169 @@ export default {
|
|
// if (this.modals.editSong = false) this.video.player.stopVideo();
|
|
// if (this.modals.editSong = false) this.video.player.stopVideo();
|
|
|
|
|
|
// this.loadVideoById(
|
|
// this.loadVideoById(
|
|
- // this.editing.song.songId,
|
|
|
|
- // this.editing.song.skipDuration
|
|
|
|
|
|
+ // this.song.songId,
|
|
|
|
+ // this.song.skipDuration
|
|
// );
|
|
// );
|
|
|
|
|
|
- this.discogsQuery = this.editing.song.title;
|
|
|
|
-
|
|
|
|
lofig.get("cookie.secure").then(useHTTPS => {
|
|
lofig.get("cookie.secure").then(useHTTPS => {
|
|
this.useHTTPS = useHTTPS;
|
|
this.useHTTPS = useHTTPS;
|
|
});
|
|
});
|
|
|
|
|
|
io.getSocket(socket => {
|
|
io.getSocket(socket => {
|
|
this.socket = socket;
|
|
this.socket = socket;
|
|
- });
|
|
|
|
|
|
|
|
- this.interval = setInterval(() => {
|
|
|
|
- if (
|
|
|
|
- this.editing.song.duration !== -1 &&
|
|
|
|
- this.video.paused === false &&
|
|
|
|
- this.playerReady &&
|
|
|
|
- this.video.player.getCurrentTime() -
|
|
|
|
- this.editing.song.skipDuration >
|
|
|
|
- this.editing.song.duration
|
|
|
|
- ) {
|
|
|
|
- this.video.paused = false;
|
|
|
|
- this.video.player.stopVideo();
|
|
|
|
- this.drawCanvas();
|
|
|
|
- }
|
|
|
|
- if (this.playerReady) {
|
|
|
|
- this.youtubeVideoCurrentTime = this.video.player
|
|
|
|
- .getCurrentTime()
|
|
|
|
- .toFixed(3);
|
|
|
|
- }
|
|
|
|
|
|
+ this.socket.emit(
|
|
|
|
+ `${this.songType}.getSongFromMusareId`,
|
|
|
|
+ this.songId,
|
|
|
|
+ res => {
|
|
|
|
+ if (res.status === "success") {
|
|
|
|
+ const { song } = res.data;
|
|
|
|
+ // this.song = { ...song };
|
|
|
|
+ // if (this.song.discogs === undefined)
|
|
|
|
+ // this.song.discogs = null;
|
|
|
|
+ this.editSong(song);
|
|
|
|
+
|
|
|
|
+ this.songDataLoaded = true;
|
|
|
|
+
|
|
|
|
+ // this.edit(res.data.song);
|
|
|
|
+
|
|
|
|
+ this.discogsQuery = this.song.title;
|
|
|
|
+
|
|
|
|
+ this.interval = setInterval(() => {
|
|
|
|
+ if (
|
|
|
|
+ this.song.duration !== -1 &&
|
|
|
|
+ this.video.paused === false &&
|
|
|
|
+ this.playerReady &&
|
|
|
|
+ this.video.player.getCurrentTime() -
|
|
|
|
+ this.song.skipDuration >
|
|
|
|
+ this.song.duration
|
|
|
|
+ ) {
|
|
|
|
+ this.video.paused = false;
|
|
|
|
+ this.video.player.stopVideo();
|
|
|
|
+ this.drawCanvas();
|
|
|
|
+ }
|
|
|
|
+ if (this.playerReady) {
|
|
|
|
+ this.youtubeVideoCurrentTime = this.video.player
|
|
|
|
+ .getCurrentTime()
|
|
|
|
+ .toFixed(3);
|
|
|
|
+ }
|
|
|
|
|
|
- if (this.video.paused === false) this.drawCanvas();
|
|
|
|
- }, 200);
|
|
|
|
-
|
|
|
|
- this.video.player = new window.YT.Player("player", {
|
|
|
|
- height: 298,
|
|
|
|
- width: 530,
|
|
|
|
- videoId: this.editing.song.songId,
|
|
|
|
- host: "https://www.youtube-nocookie.com",
|
|
|
|
- playerVars: {
|
|
|
|
- controls: 0,
|
|
|
|
- iv_load_policy: 3,
|
|
|
|
- rel: 0,
|
|
|
|
- showinfo: 0,
|
|
|
|
- autoplay: 1
|
|
|
|
- },
|
|
|
|
- startSeconds: this.editing.song.skipDuration,
|
|
|
|
- events: {
|
|
|
|
- onReady: () => {
|
|
|
|
- let volume = parseInt(localStorage.getItem("volume"));
|
|
|
|
- volume = typeof volume === "number" ? volume : 20;
|
|
|
|
- console.log(`Seekto: ${this.editing.song.skipDuration}`);
|
|
|
|
- this.video.player.seekTo(this.editing.song.skipDuration);
|
|
|
|
- this.video.player.setVolume(volume);
|
|
|
|
- if (volume > 0) this.video.player.unMute();
|
|
|
|
- this.youtubeVideoDuration = this.video.player
|
|
|
|
- .getDuration()
|
|
|
|
- .toFixed(3);
|
|
|
|
- this.youtubeVideoNote = "(~)";
|
|
|
|
- this.playerReady = true;
|
|
|
|
-
|
|
|
|
- this.drawCanvas();
|
|
|
|
- },
|
|
|
|
- onStateChange: event => {
|
|
|
|
- this.drawCanvas();
|
|
|
|
-
|
|
|
|
- if (event.data === 1) {
|
|
|
|
- if (!this.video.autoPlayed) {
|
|
|
|
- this.video.autoPlayed = true;
|
|
|
|
- return this.video.player.stopVideo();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- this.video.paused = false;
|
|
|
|
- let youtubeDuration = this.video.player.getDuration();
|
|
|
|
- this.youtubeVideoDuration = youtubeDuration.toFixed(3);
|
|
|
|
- this.youtubeVideoNote = "";
|
|
|
|
-
|
|
|
|
- if (this.editing.song.duration === -1)
|
|
|
|
- this.editing.song.duration = youtubeDuration;
|
|
|
|
-
|
|
|
|
- youtubeDuration -= this.editing.song.skipDuration;
|
|
|
|
- if (this.editing.song.duration > youtubeDuration + 1) {
|
|
|
|
- this.video.player.stopVideo();
|
|
|
|
- this.video.paused = true;
|
|
|
|
- return new Toast({
|
|
|
|
- content:
|
|
|
|
- "Video can't play. Specified duration is bigger than the YouTube song duration.",
|
|
|
|
- timeout: 4000
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- if (this.editing.song.duration <= 0) {
|
|
|
|
- this.video.player.stopVideo();
|
|
|
|
- this.video.paused = true;
|
|
|
|
- return new Toast({
|
|
|
|
- content:
|
|
|
|
- "Video can't play. Specified duration has to be more than 0 seconds.",
|
|
|
|
- timeout: 4000
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (
|
|
|
|
- this.video.player.getCurrentTime() <
|
|
|
|
- this.editing.song.skipDuration
|
|
|
|
- ) {
|
|
|
|
- return this.video.player.seekTo(
|
|
|
|
- this.editing.song.skipDuration
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- } else if (event.data === 2) {
|
|
|
|
- this.video.paused = true;
|
|
|
|
|
|
+ if (this.video.paused === false) this.drawCanvas();
|
|
|
|
+ }, 200);
|
|
|
|
+
|
|
|
|
+ this.video.player = new window.YT.Player(
|
|
|
|
+ "editSongPlayer",
|
|
|
|
+ {
|
|
|
|
+ height: 298,
|
|
|
|
+ width: 530,
|
|
|
|
+ videoId: this.song.songId,
|
|
|
|
+ host: "https://www.youtube-nocookie.com",
|
|
|
|
+ playerVars: {
|
|
|
|
+ controls: 0,
|
|
|
|
+ iv_load_policy: 3,
|
|
|
|
+ rel: 0,
|
|
|
|
+ showinfo: 0,
|
|
|
|
+ autoplay: 1
|
|
|
|
+ },
|
|
|
|
+ startSeconds: this.song.skipDuration,
|
|
|
|
+ events: {
|
|
|
|
+ onReady: () => {
|
|
|
|
+ let volume = parseInt(
|
|
|
|
+ localStorage.getItem("volume")
|
|
|
|
+ );
|
|
|
|
+ volume =
|
|
|
|
+ typeof volume === "number"
|
|
|
|
+ ? volume
|
|
|
|
+ : 20;
|
|
|
|
+ console.log(
|
|
|
|
+ `Seekto: ${this.song.skipDuration}`
|
|
|
|
+ );
|
|
|
|
+ this.video.player.seekTo(
|
|
|
|
+ this.song.skipDuration
|
|
|
|
+ );
|
|
|
|
+ this.video.player.setVolume(volume);
|
|
|
|
+ if (volume > 0)
|
|
|
|
+ this.video.player.unMute();
|
|
|
|
+ this.youtubeVideoDuration = this.video.player
|
|
|
|
+ .getDuration()
|
|
|
|
+ .toFixed(3);
|
|
|
|
+ this.youtubeVideoNote = "(~)";
|
|
|
|
+ this.playerReady = true;
|
|
|
|
+
|
|
|
|
+ this.drawCanvas();
|
|
|
|
+ },
|
|
|
|
+ onStateChange: event => {
|
|
|
|
+ this.drawCanvas();
|
|
|
|
+
|
|
|
|
+ if (event.data === 1) {
|
|
|
|
+ if (!this.video.autoPlayed) {
|
|
|
|
+ this.video.autoPlayed = true;
|
|
|
|
+ return this.video.player.stopVideo();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.video.paused = false;
|
|
|
|
+ let youtubeDuration = this.video.player.getDuration();
|
|
|
|
+ this.youtubeVideoDuration = youtubeDuration.toFixed(
|
|
|
|
+ 3
|
|
|
|
+ );
|
|
|
|
+ this.youtubeVideoNote = "";
|
|
|
|
+
|
|
|
|
+ if (this.song.duration === -1)
|
|
|
|
+ this.song.duration = youtubeDuration;
|
|
|
|
+
|
|
|
|
+ youtubeDuration -= this.song
|
|
|
|
+ .skipDuration;
|
|
|
|
+ if (
|
|
|
|
+ this.song.duration >
|
|
|
|
+ youtubeDuration + 1
|
|
|
|
+ ) {
|
|
|
|
+ this.video.player.stopVideo();
|
|
|
|
+ this.video.paused = true;
|
|
|
|
+ return new Toast({
|
|
|
|
+ content:
|
|
|
|
+ "Video can't play. Specified duration is bigger than the YouTube song duration.",
|
|
|
|
+ timeout: 4000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this.song.duration <= 0) {
|
|
|
|
+ this.video.player.stopVideo();
|
|
|
|
+ this.video.paused = true;
|
|
|
|
+ return new Toast({
|
|
|
|
+ content:
|
|
|
|
+ "Video can't play. Specified duration has to be more than 0 seconds.",
|
|
|
|
+ timeout: 4000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (
|
|
|
|
+ this.video.player.getCurrentTime() <
|
|
|
|
+ this.song.skipDuration
|
|
|
|
+ ) {
|
|
|
|
+ return this.video.player.seekTo(
|
|
|
|
+ this.song.skipDuration
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ } else if (event.data === 2) {
|
|
|
|
+ this.video.paused = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ new Toast({
|
|
|
|
+ content: "Song with that ID not found",
|
|
|
|
+ timeout: 3000
|
|
|
|
+ });
|
|
|
|
+ this.closeModal({
|
|
|
|
+ sector: this.sector,
|
|
|
|
+ modal: "editSong"
|
|
|
|
+ });
|
|
}
|
|
}
|
|
-
|
|
|
|
- return false;
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ );
|
|
});
|
|
});
|
|
|
|
|
|
let volume = parseFloat(localStorage.getItem("volume"));
|
|
let volume = parseFloat(localStorage.getItem("volume"));
|
|
@@ -834,7 +858,7 @@ export default {
|
|
ctrl: true,
|
|
ctrl: true,
|
|
preventDefault: true,
|
|
preventDefault: true,
|
|
handler: () => {
|
|
handler: () => {
|
|
- this.save(this.editing.song, false);
|
|
|
|
|
|
+ this.save(this.song, false);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -844,7 +868,7 @@ export default {
|
|
preventDefault: true,
|
|
preventDefault: true,
|
|
handler: () => {
|
|
handler: () => {
|
|
this.closeModal({
|
|
this.closeModal({
|
|
- sector: "admin",
|
|
|
|
|
|
+ sector: this.sector,
|
|
modal: "editSong"
|
|
modal: "editSong"
|
|
});
|
|
});
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
@@ -1042,25 +1066,25 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
return this.socket.emit(
|
|
return this.socket.emit(
|
|
- `${this.editing.type}.update`,
|
|
|
|
|
|
+ `${this.songType}.update`,
|
|
song._id,
|
|
song._id,
|
|
song,
|
|
song,
|
|
res => {
|
|
res => {
|
|
new Toast({ content: res.message, timeout: 4000 });
|
|
new Toast({ content: res.message, timeout: 4000 });
|
|
if (res.status === "success") {
|
|
if (res.status === "success") {
|
|
- this.songs.forEach(originalSong => {
|
|
|
|
- const updatedSong = song;
|
|
|
|
- if (originalSong._id === updatedSong._id) {
|
|
|
|
- Object.keys(originalSong).forEach(n => {
|
|
|
|
- updatedSong[n] = originalSong[n];
|
|
|
|
- return originalSong[n];
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ // this.songs.forEach(originalSong => {
|
|
|
|
+ // const updatedSong = song;
|
|
|
|
+ // if (originalSong._id === updatedSong._id) {
|
|
|
|
+ // Object.keys(originalSong).forEach(n => {
|
|
|
|
+ // updatedSong[n] = originalSong[n];
|
|
|
|
+ // return originalSong[n];
|
|
|
|
+ // });
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
}
|
|
}
|
|
if (close)
|
|
if (close)
|
|
this.closeModal({
|
|
this.closeModal({
|
|
- sector: "admin",
|
|
|
|
|
|
+ sector: this.sector,
|
|
modal: "editSong"
|
|
modal: "editSong"
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -1099,33 +1123,33 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
fillDuration() {
|
|
fillDuration() {
|
|
- this.editing.song.duration =
|
|
|
|
- this.youtubeVideoDuration - this.editing.song.skipDuration;
|
|
|
|
|
|
+ this.song.duration =
|
|
|
|
+ this.youtubeVideoDuration - this.song.skipDuration;
|
|
},
|
|
},
|
|
getAlbumData(type) {
|
|
getAlbumData(type) {
|
|
- if (!this.editing.song.discogs) return;
|
|
|
|
|
|
+ if (!this.song.discogs) return;
|
|
if (type === "title")
|
|
if (type === "title")
|
|
this.updateSongField({
|
|
this.updateSongField({
|
|
field: "title",
|
|
field: "title",
|
|
- value: this.editing.song.discogs.track.title
|
|
|
|
|
|
+ value: this.song.discogs.track.title
|
|
});
|
|
});
|
|
if (type === "albumArt")
|
|
if (type === "albumArt")
|
|
this.updateSongField({
|
|
this.updateSongField({
|
|
field: "thumbnail",
|
|
field: "thumbnail",
|
|
- value: this.editing.song.discogs.album.albumArt
|
|
|
|
|
|
+ value: this.song.discogs.album.albumArt
|
|
});
|
|
});
|
|
if (type === "genres")
|
|
if (type === "genres")
|
|
this.updateSongField({
|
|
this.updateSongField({
|
|
field: "genres",
|
|
field: "genres",
|
|
value: JSON.parse(
|
|
value: JSON.parse(
|
|
- JSON.stringify(this.editing.song.discogs.album.genres)
|
|
|
|
|
|
+ JSON.stringify(this.song.discogs.album.genres)
|
|
)
|
|
)
|
|
});
|
|
});
|
|
if (type === "artists")
|
|
if (type === "artists")
|
|
this.updateSongField({
|
|
this.updateSongField({
|
|
field: "artists",
|
|
field: "artists",
|
|
value: JSON.parse(
|
|
value: JSON.parse(
|
|
- JSON.stringify(this.editing.song.discogs.album.artists)
|
|
|
|
|
|
+ JSON.stringify(this.song.discogs.album.artists)
|
|
)
|
|
)
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -1264,9 +1288,7 @@ export default {
|
|
case "skipToLast10Secs":
|
|
case "skipToLast10Secs":
|
|
if (this.video.paused) this.pauseVideo(false);
|
|
if (this.video.paused) this.pauseVideo(false);
|
|
this.video.player.seekTo(
|
|
this.video.player.seekTo(
|
|
- this.editing.song.duration -
|
|
|
|
- 10 +
|
|
|
|
- this.editing.song.skipDuration
|
|
|
|
|
|
+ this.song.duration - 10 + this.song.skipDuration
|
|
);
|
|
);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1283,13 +1305,13 @@ export default {
|
|
.getElementById("new-genre")
|
|
.getElementById("new-genre")
|
|
.value.toLowerCase()
|
|
.value.toLowerCase()
|
|
.trim();
|
|
.trim();
|
|
- if (this.editing.song.genres.indexOf(genre) !== -1)
|
|
|
|
|
|
+ if (this.song.genres.indexOf(genre) !== -1)
|
|
return new Toast({
|
|
return new Toast({
|
|
content: "Genre already exists",
|
|
content: "Genre already exists",
|
|
timeout: 3000
|
|
timeout: 3000
|
|
});
|
|
});
|
|
if (genre) {
|
|
if (genre) {
|
|
- this.editing.song.genres.push(genre);
|
|
|
|
|
|
+ this.song.genres.push(genre);
|
|
document.getElementById("new-genre").value = "";
|
|
document.getElementById("new-genre").value = "";
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -1301,13 +1323,13 @@ export default {
|
|
}
|
|
}
|
|
if (type === "artists") {
|
|
if (type === "artists") {
|
|
const artist = document.getElementById("new-artist").value;
|
|
const artist = document.getElementById("new-artist").value;
|
|
- if (this.editing.song.artists.indexOf(artist) !== -1)
|
|
|
|
|
|
+ if (this.song.artists.indexOf(artist) !== -1)
|
|
return new Toast({
|
|
return new Toast({
|
|
content: "Artist already exists",
|
|
content: "Artist already exists",
|
|
timeout: 3000
|
|
timeout: 3000
|
|
});
|
|
});
|
|
if (document.getElementById("new-artist").value !== "") {
|
|
if (document.getElementById("new-artist").value !== "") {
|
|
- this.editing.song.artists.push(artist);
|
|
|
|
|
|
+ this.song.artists.push(artist);
|
|
document.getElementById("new-artist").value = "";
|
|
document.getElementById("new-artist").value = "";
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -1320,9 +1342,8 @@ export default {
|
|
return false;
|
|
return false;
|
|
},
|
|
},
|
|
removeTag(type, index) {
|
|
removeTag(type, index) {
|
|
- if (type === "genres") this.editing.song.genres.splice(index, 1);
|
|
|
|
- else if (type === "artists")
|
|
|
|
- this.editing.song.artists.splice(index, 1);
|
|
|
|
|
|
+ if (type === "genres") this.song.genres.splice(index, 1);
|
|
|
|
+ else if (type === "artists") this.song.artists.splice(index, 1);
|
|
},
|
|
},
|
|
drawCanvas() {
|
|
drawCanvas() {
|
|
const canvasElement = document.getElementById("durationCanvas");
|
|
const canvasElement = document.getElementById("durationCanvas");
|
|
@@ -1330,13 +1351,16 @@ export default {
|
|
|
|
|
|
const videoDuration = Number(this.youtubeVideoDuration);
|
|
const videoDuration = Number(this.youtubeVideoDuration);
|
|
|
|
|
|
- const skipDuration = Number(this.editing.song.skipDuration);
|
|
|
|
- const duration = Number(this.editing.song.duration);
|
|
|
|
|
|
+ const skipDuration = Number(this.song.skipDuration);
|
|
|
|
+ const duration = Number(this.song.duration);
|
|
const afterDuration = videoDuration - (skipDuration + duration);
|
|
const afterDuration = videoDuration - (skipDuration + duration);
|
|
|
|
|
|
const width = 530;
|
|
const width = 530;
|
|
|
|
|
|
- const currentTime = this.video.player.getCurrentTime();
|
|
|
|
|
|
+ const currentTime =
|
|
|
|
+ this.video.player && this.video.player.getCurrentTime
|
|
|
|
+ ? this.video.player.getCurrentTime()
|
|
|
|
+ : 0;
|
|
|
|
|
|
const widthSkipDuration = (skipDuration / videoDuration) * width;
|
|
const widthSkipDuration = (skipDuration / videoDuration) * width;
|
|
const widthDuration = (duration / videoDuration) * width;
|
|
const widthDuration = (duration / videoDuration) * width;
|
|
@@ -1370,7 +1394,7 @@ export default {
|
|
resetGenreHelper() {
|
|
resetGenreHelper() {
|
|
this.$refs.genreHelper.resetBox();
|
|
this.$refs.genreHelper.resetBox();
|
|
},
|
|
},
|
|
- ...mapActions("admin/songs", [
|
|
|
|
|
|
+ ...mapActions("editSongModal", [
|
|
"stopVideo",
|
|
"stopVideo",
|
|
"loadVideoById",
|
|
"loadVideoById",
|
|
"pauseVideo",
|
|
"pauseVideo",
|