+
Spotify
+
+
+
+
+
+
+
No (native) Playlists found
+
+
+
native Spotify Playlists
+
+
+
+
No Playlists found
+
+
+
+
+
+
Link Analyzer
@@ -1105,6 +1170,125 @@
{{ metadata }}
+
diff --git a/src/js/modules/components/spotify-tab.js b/src/js/modules/components/spotify-tab.js
new file mode 100644
index 0000000..f84765f
--- /dev/null
+++ b/src/js/modules/components/spotify-tab.js
@@ -0,0 +1,87 @@
+import Vue from 'vue/dist/vue.esm'
+import { socket } from '../socket.js'
+import { playlistView, artistView, albumView, spotifyPlaylistView } from '../tabs.js'
+import Downloads from '../downloads.js'
+import QualityModal from '../quality-modal.js'
+import TrackPreview from '../track-preview.js'
+import Utils from '../utils.js'
+
+const SpotifyTab = new Vue({
+ data() {
+ return {
+ tracks: [],
+ albums: [],
+ artists: [],
+ playlists: [],
+ spotifyPlaylists: [],
+ spotifyNativePlaylists: [],
+ spotifyTracks: []
+ }
+ },
+ methods: {
+ playlistView,
+ artistView,
+ albumView,
+ spotifyPlaylistView,
+ playPausePreview: TrackPreview.playPausePreview,
+ previewMouseEnter: TrackPreview.previewMouseEnter,
+ previewMouseLeave: TrackPreview.previewMouseLeave,
+ convertDuration: Utils.convertDuration,
+ addToQueue(e) {
+ e.stopPropagation()
+ Downloads.sendAddToQueue(e.currentTarget.dataset.link)
+ },
+ openQualityModal(e) {
+ QualityModal.open(e.currentTarget.dataset.link)
+ },
+ updated_userSpotifyPlaylists(data){this.spotifyPlaylists = data},
+ updated_userSpotifyNativePlaylists(data){this.spotifyNativePlaylists = data},
+ initSpotify(data) {
+ console.log(data)
+ this.tracks = []
+ this.albums = []
+ this.artists = []
+ this.playlists = []
+ this.updated_userSpotifyNativePlaylists(data)
+ this.spotifyTracks = []
+ document.getElementById('spotify_playlist_tab').click()
+ },
+ selectedLinks() {
+ var selected = []
+ if (this.spotifyPlaylists) {
+ this.spotifyPlaylists.forEach(item => {
+ if (item.selected)
+ selected.push(item.id)
+ })
+ }
+ return selected.join(';')
+ },
+ selectedLinksNative() {
+ var selected = []
+ if (this.spotifyNativePlaylists) {
+ this.spotifyNativePlaylists.forEach(item => {
+ if (item.selected)
+ selected.push(item.id)
+ })
+ }
+ return selected.join(';')
+ },
+ comparePlaylists(e) {
+ e.stopPropagation()
+ //console.log(e) // e == MouseEvent
+ console.log(e.currentTarget.dataset.link)
+ socket.emit('getTracklistFromSpotifyPlaylists', { playlists: e.currentTarget.dataset.link })
+ },
+ mergePlaylists(e) {
+ e.stopPropagation()
+ //console.log(e) // e == MouseEvent
+ console.log(e.currentTarget.dataset.link)
+ socket.emit('mergeSpotifyPlaylists', { playlists: e.currentTarget.dataset.link })
+ }
+ },
+ mounted() {
+ socket.on('init_spotify', this.initSpotify)
+ }
+}).$mount('#spotify_tab')
+
+export default SpotifyTab
diff --git a/src/js/modules/components/spotify-tracklist-tab.js b/src/js/modules/components/spotify-tracklist-tab.js
new file mode 100644
index 0000000..bc1cac8
--- /dev/null
+++ b/src/js/modules/components/spotify-tracklist-tab.js
@@ -0,0 +1,263 @@
+import _ from 'lodash'
+import Vue from 'vue/dist/vue.esm'
+import { socket } from '../socket.js'
+import { albumView, artistView, spotifyTracklistResultView, spotifyPlaylistView } from '../tabs.js'
+import Downloads from '../downloads.js'
+import QualityModal from '../quality-modal.js'
+import TrackPreview from '../track-preview.js'
+
+const SpotifyTracklistTab = new Vue({
+ data: () => ({
+ title: '',
+ metadata: '',
+ release_date: '',
+ label: '',
+ explicit: false,
+ image: '',
+ type: '',
+ link: '',
+ head: null,
+ body: [],
+ includedPlaylists: [],
+ showTracksInSinglePlaylistOnly: false,
+ hideTrackIfNoPlaylistSelected: false,
+ showTracksInMultiplePlaylistOnly: false
+
+ }),
+ methods: {
+ artistView,
+ albumView,
+ spotifyPlaylistView,
+ playPausePreview: TrackPreview.playPausePreview,
+ reset() {
+ this.title = 'Loading...'
+ this.image = ''
+ this.metadata = ''
+ this.label = ''
+ this.release_date = ''
+ this.explicit = false
+ this.type = ''
+ this.head = []
+ this.body = []
+ this.includedPlaylists = []
+ this.showTracksInSinglePlaylistOnly = false
+ this.hideTrackIfNoPlaylistSelected = false
+ this.showTracksInMultiplePlaylistOnly = false
+ },
+ addToQueue(e) {
+ e.stopPropagation()
+ Downloads.sendAddToQueue(e.currentTarget.dataset.link)
+ },
+ openQualityModal(e) {
+ QualityModal.open(e.currentTarget.dataset.link)
+ },
+ toggleAll(e) {
+ this.body.forEach(item => {
+ if (item.type == 'track') {
+ item.selected = e.currentTarget.checked
+ }
+ })
+ },
+ selectedLinks() {
+ var selected = []
+ if (this.body) {
+ this.body.forEach(item => {
+ if (item.type == 'track' && item.selected)
+ selected.push(this.type == 'Spotify Playlist' ? item.uri : item.link)
+ })
+ }
+ return selected.join(';')
+ },
+ convertDuration(duration) {
+ //convert from seconds only to mm:ss format
+ let mm, ss
+ mm = Math.floor(duration / 60)
+ ss = duration - mm * 60
+ //add leading zero if ss < 0
+ if (ss < 10) {
+ ss = '0' + ss
+ }
+ return mm + ':' + ss
+ },
+ showAlbum(data) {
+ this.type = 'Album'
+ this.link = `https://www.deezer.com/album/${data.id}`
+ this.title = data.title
+ this.explicit = data.explicit_lyrics
+ this.label = data.label
+ this.metadata = `${data.artist.name} • ${data.tracks.length} songs`
+ this.release_date = data.release_date.substring(0, 10)
+ this.image = data.cover_xl
+ this.head = [
+ { title: '