mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 15:15:57 -05:00
[web] Cleanup of code to simplify
Useless methods have been removed and code has been partially cleaned up.
This commit is contained in:
parent
3a1cc63e8f
commit
387e531d64
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -88,7 +88,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
created: function () {
|
||||
created() {
|
||||
this.connect()
|
||||
|
||||
// Start the progress bar on app start
|
||||
@ -106,7 +106,7 @@ export default {
|
||||
next()
|
||||
})
|
||||
|
||||
// hook the progress bar to finish after we've finished moving router-view
|
||||
// Hook the progress bar to finish after we've finished moving router-view
|
||||
this.$router.afterEach((to, from) => {
|
||||
if (to.meta.show_progress) {
|
||||
this.$Progress.finish()
|
||||
@ -115,7 +115,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
connect: function () {
|
||||
connect() {
|
||||
webapi
|
||||
.config()
|
||||
.then(({ data }) => {
|
||||
@ -135,7 +135,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_ws: function () {
|
||||
open_ws() {
|
||||
if (this.$store.state.config.websocket_port <= 0) {
|
||||
this.$store.dispatch('add_notification', {
|
||||
text: this.$t('server.missing-port'),
|
||||
@ -226,7 +226,7 @@ export default {
|
||||
vm.update_pairing()
|
||||
|
||||
update_throttled = true
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
update_throttled = false
|
||||
}, 500)
|
||||
}
|
||||
@ -234,7 +234,7 @@ export default {
|
||||
// These events are fired when the window becomes active in different ways
|
||||
// When this happens, we should update 'now playing' info etc
|
||||
window.addEventListener('focus', update_info)
|
||||
document.addEventListener('visibilitychange', function () {
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (document.visibilityState === 'visible') {
|
||||
update_info()
|
||||
}
|
||||
@ -273,7 +273,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
update_library_stats: function () {
|
||||
update_library_stats() {
|
||||
webapi.library_stats().then(({ data }) => {
|
||||
this.$store.commit(types.UPDATE_LIBRARY_STATS, data)
|
||||
})
|
||||
@ -288,37 +288,37 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
update_outputs: function () {
|
||||
update_outputs() {
|
||||
webapi.outputs().then(({ data }) => {
|
||||
this.$store.commit(types.UPDATE_OUTPUTS, data.outputs)
|
||||
})
|
||||
},
|
||||
|
||||
update_player_status: function () {
|
||||
update_player_status() {
|
||||
webapi.player_status().then(({ data }) => {
|
||||
this.$store.commit(types.UPDATE_PLAYER_STATUS, data)
|
||||
})
|
||||
},
|
||||
|
||||
update_queue: function () {
|
||||
update_queue() {
|
||||
webapi.queue().then(({ data }) => {
|
||||
this.$store.commit(types.UPDATE_QUEUE, data)
|
||||
})
|
||||
},
|
||||
|
||||
update_settings: function () {
|
||||
update_settings() {
|
||||
webapi.settings().then(({ data }) => {
|
||||
this.$store.commit(types.UPDATE_SETTINGS, data)
|
||||
})
|
||||
},
|
||||
|
||||
update_lastfm: function () {
|
||||
update_lastfm() {
|
||||
webapi.lastfm().then(({ data }) => {
|
||||
this.$store.commit(types.UPDATE_LASTFM, data)
|
||||
})
|
||||
},
|
||||
|
||||
update_spotify: function () {
|
||||
update_spotify() {
|
||||
webapi.spotify().then(({ data }) => {
|
||||
this.$store.commit(types.UPDATE_SPOTIFY, data)
|
||||
|
||||
@ -335,14 +335,14 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
update_pairing: function () {
|
||||
update_pairing() {
|
||||
webapi.pairing().then(({ data }) => {
|
||||
this.$store.commit(types.UPDATE_PAIRING, data)
|
||||
this.pairing_active = data.active
|
||||
})
|
||||
},
|
||||
|
||||
update_is_clipped: function () {
|
||||
update_is_clipped() {
|
||||
if (this.show_burger_menu || this.show_player_menu) {
|
||||
document.querySelector('html').classList.add('is-clipped')
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ export default {
|
||||
_source: null,
|
||||
_gain: null,
|
||||
|
||||
// setup audio routing
|
||||
// Setup audio routing
|
||||
setupAudio() {
|
||||
const AudioContext = window.AudioContext || window.webkitAudioContext
|
||||
this._context = new AudioContext()
|
||||
@ -27,7 +27,7 @@ export default {
|
||||
return this._audio
|
||||
},
|
||||
|
||||
// set audio volume
|
||||
// Set audio volume
|
||||
setVolume(volume) {
|
||||
if (!this._gain) return
|
||||
volume = parseFloat(volume) || 0.0
|
||||
@ -36,7 +36,7 @@ export default {
|
||||
this._gain.gain.value = volume
|
||||
},
|
||||
|
||||
// play audio source url
|
||||
// Play audio source url
|
||||
playSource(source) {
|
||||
this.stopAudio()
|
||||
this._context.resume().then(() => {
|
||||
@ -46,22 +46,22 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
// stop playing audio
|
||||
// Stop playing audio
|
||||
stopAudio() {
|
||||
try {
|
||||
this._audio.pause()
|
||||
} catch (e) {
|
||||
// continue regardless of error
|
||||
// Continue regardless of error
|
||||
}
|
||||
try {
|
||||
this._audio.stop()
|
||||
} catch (e) {
|
||||
// continue regardless of error
|
||||
// Continue regardless of error
|
||||
}
|
||||
try {
|
||||
this._audio.close()
|
||||
} catch (e) {
|
||||
// continue regardless of error
|
||||
// Continue regardless of error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
artwork_url_with_size: function () {
|
||||
artwork_url_with_size() {
|
||||
if (this.maxwidth > 0 && this.maxheight > 0) {
|
||||
return webapi.artwork_url_append_size_params(
|
||||
this.artwork_url,
|
||||
@ -59,7 +59,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
dataURI: function () {
|
||||
dataURI() {
|
||||
return renderSVG(this.caption, this.alt_text, {
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
|
@ -17,7 +17,7 @@ export default {
|
||||
name: 'IndexButtonList',
|
||||
props: ['index'],
|
||||
methods: {
|
||||
nav: function (id) {
|
||||
nav(id) {
|
||||
this.$router.push({ hash: '#index_' + id })
|
||||
}
|
||||
}
|
||||
|
@ -95,13 +95,13 @@ export default {
|
||||
).value
|
||||
},
|
||||
|
||||
media_kind_resolved: function () {
|
||||
media_kind_resolved() {
|
||||
return this.media_kind ? this.media_kind : this.selected_album.media_kind
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_album: function (album) {
|
||||
open_album(album) {
|
||||
this.selected_album = album
|
||||
if (this.media_kind_resolved === 'podcast') {
|
||||
this.$router.push({ path: '/podcasts/' + album.id })
|
||||
@ -112,12 +112,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_dialog: function (album) {
|
||||
open_dialog(album) {
|
||||
this.selected_album = album
|
||||
this.show_details_modal = true
|
||||
},
|
||||
|
||||
open_remove_podcast_dialog: function () {
|
||||
open_remove_podcast_dialog() {
|
||||
webapi
|
||||
.library_album_tracks(this.selected_album.id, { limit: 1 })
|
||||
.then(({ data }) => {
|
||||
@ -131,11 +131,11 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
play_count_changed: function () {
|
||||
play_count_changed() {
|
||||
this.$emit('play-count-changed')
|
||||
},
|
||||
|
||||
remove_podcast: function () {
|
||||
remove_podcast() {
|
||||
this.show_remove_podcast_modal = false
|
||||
webapi
|
||||
.library_playlist_delete(this.rss_playlist_to_remove.id)
|
||||
|
@ -53,13 +53,13 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
media_kind_resolved: function () {
|
||||
media_kind_resolved() {
|
||||
return this.media_kind ? this.media_kind : this.selected_artist.media_kind
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_artist: function (artist) {
|
||||
open_artist(artist) {
|
||||
this.selected_artist = artist
|
||||
if (this.media_kind_resolved === 'audiobook') {
|
||||
this.$router.push({ path: '/audiobooks/artists/' + artist.id })
|
||||
@ -68,7 +68,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_dialog: function (artist) {
|
||||
open_dialog(artist) {
|
||||
this.selected_artist = artist
|
||||
this.show_details_modal = true
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
media_kind_resolved: function () {
|
||||
media_kind_resolved() {
|
||||
return this.media_kind
|
||||
? this.media_kind
|
||||
: this.selected_composer.media_kind
|
||||
@ -60,7 +60,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_composer: function (composer) {
|
||||
open_composer(composer) {
|
||||
this.selected_composer = composer
|
||||
this.$router.push({
|
||||
name: 'ComposerAlbums',
|
||||
@ -68,7 +68,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_dialog: function (composer) {
|
||||
open_dialog(composer) {
|
||||
this.selected_composer = composer
|
||||
this.show_details_modal = true
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_parent_directory: function () {
|
||||
open_parent_directory() {
|
||||
const parent = this.current_directory.slice(
|
||||
0,
|
||||
this.current_directory.lastIndexOf('/')
|
||||
@ -95,14 +95,14 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_directory: function (directory) {
|
||||
open_directory(directory) {
|
||||
this.$router.push({
|
||||
path: '/files',
|
||||
query: { directory: directory.path }
|
||||
})
|
||||
},
|
||||
|
||||
open_dialog: function (directory) {
|
||||
open_dialog(directory) {
|
||||
this.selected_directory = directory
|
||||
this.show_details_modal = true
|
||||
}
|
||||
|
@ -48,17 +48,17 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
media_kind_resolved: function () {
|
||||
media_kind_resolved() {
|
||||
return this.media_kind ? this.media_kind : this.selected_genre.media_kind
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_genre: function (genre) {
|
||||
open_genre(genre) {
|
||||
this.$router.push({ name: 'Genre', params: { genre: genre.name } })
|
||||
},
|
||||
|
||||
open_dialog: function (genre) {
|
||||
open_dialog(genre) {
|
||||
this.selected_genre = genre
|
||||
this.show_details_modal = true
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play({ item_id: this.item.id })
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_playlist: function (playlist) {
|
||||
open_playlist(playlist) {
|
||||
if (playlist.type !== 'folder') {
|
||||
this.$router.push({ path: '/playlists/' + playlist.id + '/tracks' })
|
||||
} else {
|
||||
@ -56,12 +56,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_dialog: function (playlist) {
|
||||
open_dialog(playlist) {
|
||||
this.selected_playlist = playlist
|
||||
this.show_details_modal = true
|
||||
},
|
||||
|
||||
icon_name: function (playlist) {
|
||||
icon_name(playlist) {
|
||||
if (playlist.type === 'folder') {
|
||||
return 'folder'
|
||||
} else if (playlist.type === 'rss') {
|
||||
|
@ -72,7 +72,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play_track: function (position, track) {
|
||||
play_track(position, track) {
|
||||
if (this.uris) {
|
||||
webapi.player_play_uri(this.uris, false, position)
|
||||
} else if (this.expression) {
|
||||
@ -82,7 +82,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_dialog: function (track) {
|
||||
open_dialog(track) {
|
||||
this.selected_track = track
|
||||
this.show_details_modal = true
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
add_stream: function () {
|
||||
add_stream() {
|
||||
this.loading = true
|
||||
webapi
|
||||
.library_add(this.url)
|
||||
|
@ -100,7 +100,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
add_stream: function () {
|
||||
add_stream() {
|
||||
this.loading = true
|
||||
webapi
|
||||
.queue_add(this.url)
|
||||
@ -113,7 +113,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
this.loading = true
|
||||
webapi
|
||||
.player_play_uri(this.url, false)
|
||||
|
@ -134,32 +134,32 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
artwork_url: function () {
|
||||
artwork_url() {
|
||||
return webapi.artwork_url_append_size_params(this.album.artwork_url)
|
||||
},
|
||||
|
||||
media_kind_resolved: function () {
|
||||
media_kind_resolved() {
|
||||
return this.media_kind ? this.media_kind : this.album.media_kind
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_uri(this.album.uri, false)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add(this.album.uri)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add_next(this.album.uri)
|
||||
},
|
||||
|
||||
open_album: function () {
|
||||
open_album() {
|
||||
this.$emit('close')
|
||||
if (this.media_kind_resolved === 'podcast') {
|
||||
this.$router.push({ path: '/podcasts/' + this.album.id })
|
||||
@ -170,7 +170,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.$emit('close')
|
||||
if (this.media_kind_resolved === 'audiobook') {
|
||||
this.$router.push({
|
||||
@ -181,7 +181,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mark_played: function () {
|
||||
mark_played() {
|
||||
webapi
|
||||
.library_album_track_update(this.album.id, { play_count: 'played' })
|
||||
.then(({ data }) => {
|
||||
@ -190,11 +190,11 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
artwork_loaded: function () {
|
||||
artwork_loaded() {
|
||||
this.artwork_visible = true
|
||||
},
|
||||
|
||||
artwork_error: function () {
|
||||
artwork_error() {
|
||||
this.artwork_visible = false
|
||||
}
|
||||
}
|
||||
|
@ -77,22 +77,22 @@ export default {
|
||||
emits: ['close'],
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_uri(this.artist.uri, false)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add(this.artist.uri)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add_next(this.artist.uri)
|
||||
},
|
||||
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.$emit('close')
|
||||
this.$router.push({ path: '/music/artists/' + this.artist.id })
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ export default {
|
||||
emits: ['close'],
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_expression(
|
||||
'composer is "' + this.composer.name + '" and media_kind is music',
|
||||
@ -87,21 +87,21 @@ export default {
|
||||
)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_expression_add(
|
||||
'composer is "' + this.composer.name + '" and media_kind is music'
|
||||
)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_expression_add_next(
|
||||
'composer is "' + this.composer.name + '" and media_kind is music'
|
||||
)
|
||||
},
|
||||
|
||||
open_albums: function () {
|
||||
open_albums() {
|
||||
this.$emit('close')
|
||||
this.$router.push({
|
||||
name: 'ComposerAlbums',
|
||||
@ -109,7 +109,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_tracks: function () {
|
||||
open_tracks() {
|
||||
this.show_details_modal = false
|
||||
this.$router.push({
|
||||
name: 'ComposerTracks',
|
||||
|
@ -50,7 +50,7 @@ export default {
|
||||
emits: ['close'],
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_expression(
|
||||
'path starts with "' + this.directory.path + '" order by path asc',
|
||||
@ -58,14 +58,14 @@ export default {
|
||||
)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_expression_add(
|
||||
'path starts with "' + this.directory.path + '" order by path asc'
|
||||
)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_expression_add_next(
|
||||
'path starts with "' + this.directory.path + '" order by path asc'
|
||||
|
@ -70,7 +70,7 @@ export default {
|
||||
emits: ['close'],
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_expression(
|
||||
'genre is "' + this.genre.name + '" and media_kind is music',
|
||||
@ -78,21 +78,21 @@ export default {
|
||||
)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_expression_add(
|
||||
'genre is "' + this.genre.name + '" and media_kind is music'
|
||||
)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_expression_add_next(
|
||||
'genre is "' + this.genre.name + '" and media_kind is music'
|
||||
)
|
||||
},
|
||||
|
||||
open_genre: function () {
|
||||
open_genre() {
|
||||
this.$emit('close')
|
||||
this.$router.push({ name: 'Genre', params: { genre: this.genre.name } })
|
||||
}
|
||||
|
@ -73,22 +73,22 @@ export default {
|
||||
emits: ['close'],
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_uri(this.uris ? this.uris : this.playlist.uri, false)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add(this.uris ? this.uris : this.playlist.uri)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add_next(this.uris ? this.uris : this.playlist.uri)
|
||||
},
|
||||
|
||||
open_playlist: function () {
|
||||
open_playlist() {
|
||||
this.$emit('close')
|
||||
this.$router.push({ path: '/playlists/' + this.playlist.id + '/tracks' })
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
save: function () {
|
||||
save() {
|
||||
if (this.playlist_name.length < 1) {
|
||||
return
|
||||
}
|
||||
|
@ -197,17 +197,17 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
remove: function () {
|
||||
remove() {
|
||||
this.$emit('close')
|
||||
webapi.queue_remove(this.item.id)
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play({ item_id: this.item.id })
|
||||
},
|
||||
|
||||
open_album: function () {
|
||||
open_album() {
|
||||
if (this.media_kind === 'podcast') {
|
||||
this.$router.push({ path: '/podcasts/' + this.item.album_id })
|
||||
} else if (this.media_kind === 'audiobook') {
|
||||
@ -217,22 +217,22 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_album_artist: function () {
|
||||
open_album_artist() {
|
||||
this.$router.push({ path: '/music/artists/' + this.item.album_artist_id })
|
||||
},
|
||||
|
||||
open_genre: function () {
|
||||
open_genre() {
|
||||
this.$router.push({ name: 'Genre', params: { genre: this.item.genre } })
|
||||
},
|
||||
|
||||
open_spotify_artist: function () {
|
||||
open_spotify_artist() {
|
||||
this.$emit('close')
|
||||
this.$router.push({
|
||||
path: '/music/spotify/artists/' + this.spotify_track.artists[0].id
|
||||
})
|
||||
},
|
||||
|
||||
open_spotify_album: function () {
|
||||
open_spotify_album() {
|
||||
this.$emit('close')
|
||||
this.$router.push({
|
||||
path: '/music/spotify/albums/' + this.spotify_track.album.id
|
||||
|
@ -229,22 +229,22 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play_track: function () {
|
||||
play_track() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_uri(this.track.uri, false)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add(this.track.uri)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add_next(this.track.uri)
|
||||
},
|
||||
|
||||
open_album: function () {
|
||||
open_album() {
|
||||
this.$emit('close')
|
||||
if (this.track.media_kind === 'podcast') {
|
||||
this.$router.push({ path: '/podcasts/' + this.track.album_id })
|
||||
@ -255,32 +255,32 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.$emit('close')
|
||||
this.$router.push({
|
||||
path: '/music/artists/' + this.track.album_artist_id
|
||||
})
|
||||
},
|
||||
|
||||
open_genre: function () {
|
||||
open_genre() {
|
||||
this.$router.push({ name: 'Genre', params: { genre: this.track.genre } })
|
||||
},
|
||||
|
||||
open_spotify_artist: function () {
|
||||
open_spotify_artist() {
|
||||
this.$emit('close')
|
||||
this.$router.push({
|
||||
path: '/music/spotify/artists/' + this.spotify_track.artists[0].id
|
||||
})
|
||||
},
|
||||
|
||||
open_spotify_album: function () {
|
||||
open_spotify_album() {
|
||||
this.$emit('close')
|
||||
this.$router.push({
|
||||
path: '/music/spotify/albums/' + this.spotify_track.album.id
|
||||
})
|
||||
},
|
||||
|
||||
mark_new: function () {
|
||||
mark_new() {
|
||||
webapi
|
||||
.library_track_update(this.track.id, { play_count: 'reset' })
|
||||
.then(() => {
|
||||
@ -289,7 +289,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
mark_played: function () {
|
||||
mark_played() {
|
||||
webapi
|
||||
.library_track_update(this.track.id, { play_count: 'increment' })
|
||||
.then(() => {
|
||||
|
@ -412,12 +412,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// on app mounted
|
||||
// On app mounted
|
||||
mounted() {
|
||||
this.setupAudio()
|
||||
},
|
||||
|
||||
// on app destroyed
|
||||
// On app destroyed
|
||||
unmounted() {
|
||||
this.closeAudio()
|
||||
},
|
||||
@ -427,11 +427,11 @@ export default {
|
||||
this.show_outputs_menu = false
|
||||
},
|
||||
|
||||
set_volume: function (newVolume) {
|
||||
set_volume(newVolume) {
|
||||
webapi.player_volume(newVolume)
|
||||
},
|
||||
|
||||
toggle_mute_volume: function () {
|
||||
toggle_mute_volume() {
|
||||
if (this.player.volume > 0) {
|
||||
this.set_volume(0)
|
||||
} else {
|
||||
@ -439,7 +439,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
setupAudio: function () {
|
||||
setupAudio() {
|
||||
const a = _audio.setupAudio()
|
||||
|
||||
a.addEventListener('waiting', (e) => {
|
||||
@ -465,13 +465,13 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
// close active audio
|
||||
closeAudio: function () {
|
||||
// Close active audio
|
||||
closeAudio() {
|
||||
_audio.stopAudio()
|
||||
this.playing = false
|
||||
},
|
||||
|
||||
playChannel: function () {
|
||||
playChannel() {
|
||||
if (this.playing) {
|
||||
return
|
||||
}
|
||||
@ -482,7 +482,7 @@ export default {
|
||||
_audio.setVolume(this.stream_volume / 100)
|
||||
},
|
||||
|
||||
togglePlay: function () {
|
||||
togglePlay() {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
@ -492,7 +492,7 @@ export default {
|
||||
return this.playChannel()
|
||||
},
|
||||
|
||||
set_stream_volume: function (newVolume) {
|
||||
set_stream_volume(newVolume) {
|
||||
this.stream_volume = newVolume
|
||||
_audio.setVolume(this.stream_volume / 100)
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_link: function () {
|
||||
open_link() {
|
||||
if (this.show_burger_menu) {
|
||||
this.$store.commit(types.SHOW_BURGER_MENU, false)
|
||||
}
|
||||
@ -57,7 +57,7 @@ export default {
|
||||
this.$router.push({ path: this.to })
|
||||
},
|
||||
|
||||
full_path: function () {
|
||||
full_path() {
|
||||
const resolved = this.$router.resolve(this.to)
|
||||
return resolved.href
|
||||
}
|
||||
|
@ -67,15 +67,15 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play_next: function () {
|
||||
play_next() {
|
||||
webapi.player_next()
|
||||
},
|
||||
|
||||
set_volume: function (newVolume) {
|
||||
set_volume(newVolume) {
|
||||
webapi.player_output_volume(this.output.id, newVolume)
|
||||
},
|
||||
|
||||
set_enabled: function () {
|
||||
set_enabled() {
|
||||
const values = {
|
||||
selected: !this.output.selected
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
remove: function (notification) {
|
||||
remove(notification) {
|
||||
this.$store.commit(types.DELETE_NOTIFICATION, notification)
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggle_consume_mode: function () {
|
||||
toggle_consume_mode() {
|
||||
webapi.player_consume(!this.is_consume)
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play_next: function () {
|
||||
play_next() {
|
||||
if (this.disabled) {
|
||||
return
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggle_play_pause: function () {
|
||||
toggle_play_pause() {
|
||||
if (this.disabled) {
|
||||
if (this.show_disabled_message) {
|
||||
this.$store.dispatch('add_notification', {
|
||||
|
@ -29,7 +29,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play_previous: function () {
|
||||
play_previous() {
|
||||
if (this.disabled) {
|
||||
return
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggle_repeat_mode: function () {
|
||||
toggle_repeat_mode() {
|
||||
if (this.is_repeat_all) {
|
||||
webapi.player_repeat('single')
|
||||
} else if (this.is_repeat_single) {
|
||||
|
@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
seek: function () {
|
||||
seek() {
|
||||
if (!this.disabled) {
|
||||
webapi.player_seek(this.seek_ms * -1)
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
seek: function () {
|
||||
seek() {
|
||||
if (!this.disabled) {
|
||||
webapi.player_seek(this.seek_ms)
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggle_shuffle_mode: function () {
|
||||
toggle_shuffle_mode() {
|
||||
webapi.player_shuffle(!this.is_shuffle)
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
clear_status: function () {
|
||||
clear_status() {
|
||||
this.statusUpdate = ''
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
clear_status: function () {
|
||||
clear_status() {
|
||||
this.statusUpdate = ''
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
clear_status: function () {
|
||||
clear_status() {
|
||||
this.statusUpdate = ''
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ export default {
|
||||
props: ['artist'],
|
||||
|
||||
methods: {
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.$router.push({ path: '/music/spotify/artists/' + this.artist.id })
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export default {
|
||||
props: ['playlist'],
|
||||
|
||||
methods: {
|
||||
open_playlist: function () {
|
||||
open_playlist() {
|
||||
this.$router.push({
|
||||
path: '/music/spotify/playlists/' + this.playlist.id
|
||||
})
|
||||
|
@ -39,7 +39,7 @@ export default {
|
||||
name: 'SpotifyListItemTrack',
|
||||
props: ['track', 'position', 'album', 'context_uri'],
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_uri(this.context_uri, false, this.position)
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
artwork_url: function () {
|
||||
artwork_url() {
|
||||
if (this.album.images && this.album.images.length > 0) {
|
||||
return this.album.images[0].url
|
||||
}
|
||||
@ -117,36 +117,36 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_uri(this.album.uri, false)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add(this.album.uri)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add_next(this.album.uri)
|
||||
},
|
||||
|
||||
open_album: function () {
|
||||
open_album() {
|
||||
this.$router.push({ path: '/music/spotify/albums/' + this.album.id })
|
||||
},
|
||||
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.$router.push({
|
||||
path: '/music/spotify/artists/' + this.album.artists[0].id
|
||||
})
|
||||
},
|
||||
|
||||
artwork_loaded: function () {
|
||||
artwork_loaded() {
|
||||
this.artwork_visible = true
|
||||
},
|
||||
|
||||
artwork_error: function () {
|
||||
artwork_error() {
|
||||
this.artwork_visible = false
|
||||
}
|
||||
}
|
||||
|
@ -83,22 +83,22 @@ export default {
|
||||
emits: ['close'],
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_uri(this.artist.uri, false)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add(this.artist.uri)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add_next(this.artist.uri)
|
||||
},
|
||||
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.$router.push({ path: '/music/spotify/artists/' + this.artist.id })
|
||||
}
|
||||
}
|
||||
|
@ -88,22 +88,22 @@ export default {
|
||||
emits: ['close'],
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_uri(this.playlist.uri, false)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add(this.playlist.uri)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add_next(this.playlist.uri)
|
||||
},
|
||||
|
||||
open_playlist: function () {
|
||||
open_playlist() {
|
||||
this.$router.push({
|
||||
path: '/music/spotify/playlists/' + this.playlist.id
|
||||
})
|
||||
|
@ -118,26 +118,26 @@ export default {
|
||||
emits: ['close'],
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
this.$emit('close')
|
||||
webapi.player_play_uri(this.track.uri, false)
|
||||
},
|
||||
|
||||
queue_add: function () {
|
||||
queue_add() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add(this.track.uri)
|
||||
},
|
||||
|
||||
queue_add_next: function () {
|
||||
queue_add_next() {
|
||||
this.$emit('close')
|
||||
webapi.queue_add_next(this.track.uri)
|
||||
},
|
||||
|
||||
open_album: function () {
|
||||
open_album() {
|
||||
this.$router.push({ path: '/music/spotify/albums/' + this.album.id })
|
||||
},
|
||||
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.$router.push({
|
||||
path: '/music/spotify/artists/' + this.album.artists[0].id
|
||||
})
|
||||
|
@ -50,7 +50,7 @@ export default {
|
||||
return this.$store.state.spotify.webapi_token_valid
|
||||
},
|
||||
|
||||
route_query: function () {
|
||||
route_query() {
|
||||
if (!this.query) {
|
||||
return null
|
||||
}
|
||||
@ -65,7 +65,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
search_library: function () {
|
||||
search_library() {
|
||||
this.$store.commit(types.SEARCH_PATH, '/search/library')
|
||||
this.$router.push({
|
||||
path: this.$store.state.search_path,
|
||||
@ -73,7 +73,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
search_spotify: function () {
|
||||
search_spotify() {
|
||||
this.$store.commit(types.SEARCH_PATH, '/search/spotify')
|
||||
this.$router.push({
|
||||
path: this.$store.state.search_path,
|
||||
|
@ -4,7 +4,7 @@ import i18n from '@/i18n'
|
||||
const { t, locale } = i18n.global
|
||||
|
||||
export const filters = {
|
||||
durationInHours: function (value_ms) {
|
||||
durationInHours(value_ms) {
|
||||
const seconds = Math.floor(value_ms / 1000)
|
||||
if (seconds > 3600) {
|
||||
return Duration.fromObject({ seconds: seconds })
|
||||
@ -16,7 +16,7 @@ export const filters = {
|
||||
.toFormat('mm:ss')
|
||||
},
|
||||
|
||||
durationInDays: function (value_ms) {
|
||||
durationInDays(value_ms) {
|
||||
const minutes = Math.floor(value_ms / 60000)
|
||||
if (minutes > 1440) {
|
||||
// 60 * 24
|
||||
@ -33,29 +33,29 @@ export const filters = {
|
||||
.toHuman()
|
||||
},
|
||||
|
||||
date: function (value) {
|
||||
date(value) {
|
||||
return DateTime.fromISO(value)
|
||||
.setLocale(locale.value)
|
||||
.toLocaleString(DateTime.DATE_FULL)
|
||||
},
|
||||
|
||||
datetime: function (value) {
|
||||
datetime(value) {
|
||||
return DateTime.fromISO(value)
|
||||
.setLocale(locale.value)
|
||||
.toLocaleString(DateTime.DATETIME_MED)
|
||||
},
|
||||
|
||||
timeFromNow: function (value) {
|
||||
var diff = DateTime.now().diff(DateTime.fromISO(value))
|
||||
timeFromNow(value) {
|
||||
const diff = DateTime.now().diff(DateTime.fromISO(value))
|
||||
|
||||
return this.durationInDays(diff.as('milliseconds'))
|
||||
},
|
||||
|
||||
number: function (value) {
|
||||
number(value) {
|
||||
return value.toLocaleString(locale.value)
|
||||
},
|
||||
|
||||
channels: function (value) {
|
||||
channels(value) {
|
||||
if (value === 1) {
|
||||
return t('filter.mono')
|
||||
}
|
||||
|
@ -51,14 +51,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_album(to.params.album_id),
|
||||
webapi.library_album_tracks(to.params.album_id)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.album = response[0].data
|
||||
vm.tracks = new GroupByList(response[1].data)
|
||||
}
|
||||
@ -90,12 +90,12 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.show_details_modal = false
|
||||
this.$router.push({ path: '/music/artists/' + this.album.artist_id })
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_uri(this.album.uri, true)
|
||||
}
|
||||
}
|
||||
|
@ -80,14 +80,14 @@ import ListAlbums from '@/components/ListAlbums.vue'
|
||||
import DropdownMenu from '@/components/DropdownMenu.vue'
|
||||
import webapi from '@/webapi'
|
||||
import * as types from '@/store/mutation_types'
|
||||
import { byName, byYear, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName, byYear } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return webapi.library_albums('music')
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.albums_list = new GroupByList(response.data)
|
||||
}
|
||||
}
|
||||
|
@ -61,17 +61,17 @@ import ModalDialogArtist from '@/components/ModalDialogArtist.vue'
|
||||
import DropdownMenu from '@/components/DropdownMenu.vue'
|
||||
import webapi from '@/webapi'
|
||||
import * as types from '@/store/mutation_types'
|
||||
import { byName, byYear, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName, byYear } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_artist(to.params.artist_id),
|
||||
webapi.library_artist_albums(to.params.artist_id)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.artist = response[0].data
|
||||
vm.albums_list = new GroupByList(response[1].data)
|
||||
}
|
||||
@ -142,13 +142,13 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_tracks: function () {
|
||||
open_tracks() {
|
||||
this.$router.push({
|
||||
path: '/music/artists/' + this.artist.id + '/tracks'
|
||||
})
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_uri(
|
||||
this.albums.items.map((a) => a.uri).join(','),
|
||||
true
|
||||
|
@ -71,17 +71,17 @@ import ListTracks from '@/components/ListTracks.vue'
|
||||
import ModalDialogArtist from '@/components/ModalDialogArtist.vue'
|
||||
import webapi from '@/webapi'
|
||||
import * as types from '@/store/mutation_types'
|
||||
import { byName, byRating, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_artist(to.params.artist_id),
|
||||
webapi.library_artist_tracks(to.params.artist_id)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.artist = response[0].data
|
||||
vm.tracks_list = new GroupByList(response[1].data.tracks)
|
||||
}
|
||||
@ -154,12 +154,12 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.show_details_modal = false
|
||||
this.$router.push({ path: '/music/artists/' + this.artist.id })
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_uri(this.tracks_list.map((a) => a.uri).join(','), true)
|
||||
}
|
||||
}
|
||||
|
@ -80,14 +80,14 @@ import ListArtists from '@/components/ListArtists.vue'
|
||||
import DropdownMenu from '@/components/DropdownMenu.vue'
|
||||
import webapi from '@/webapi'
|
||||
import * as types from '@/store/mutation_types'
|
||||
import { byName, byYear, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName, byYear } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return webapi.library_artists('music')
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.artists_list = new GroupByList(response.data)
|
||||
}
|
||||
}
|
||||
|
@ -54,14 +54,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_album(to.params.album_id),
|
||||
webapi.library_album_tracks(to.params.album_id)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.album = response[0].data
|
||||
vm.tracks = new GroupByList(response[1].data)
|
||||
}
|
||||
@ -93,12 +93,12 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.show_details_modal = false
|
||||
this.$router.push({ path: '/audiobooks/artists/' + this.album.artist_id })
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_uri(this.album.uri, false)
|
||||
}
|
||||
}
|
||||
|
@ -25,14 +25,14 @@ import IndexButtonList from '@/components/IndexButtonList.vue'
|
||||
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
||||
import ListAlbums from '@/components/ListAlbums.vue'
|
||||
import webapi from '@/webapi'
|
||||
import { byName, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return webapi.library_albums('audiobook')
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.albums = new GroupByList(response.data)
|
||||
vm.albums.group(byName('name_sort', true))
|
||||
}
|
||||
|
@ -44,14 +44,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '../lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_artist(to.params.artist_id),
|
||||
webapi.library_artist_albums(to.params.artist_id)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.artist = response[0].data
|
||||
vm.albums = new GroupByList(response[1].data)
|
||||
}
|
||||
@ -89,7 +89,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_uri(
|
||||
this.albums.items.map((a) => a.uri).join(','),
|
||||
false
|
||||
|
@ -26,14 +26,14 @@ import TabsAudiobooks from '@/components/TabsAudiobooks.vue'
|
||||
import IndexButtonList from '@/components/IndexButtonList.vue'
|
||||
import ListArtists from '@/components/ListArtists.vue'
|
||||
import webapi from '@/webapi'
|
||||
import { byName, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return webapi.library_artists('audiobook')
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.artists_list = new GroupByList(response.data)
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.search({
|
||||
type: 'album',
|
||||
@ -75,7 +75,7 @@ const dataObject = {
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.recently_added = new GroupByList(response[0].data.albums)
|
||||
vm.recently_played = new GroupByList(response[1].data.tracks)
|
||||
}
|
||||
@ -110,7 +110,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_browse: function (type) {
|
||||
open_browse(type) {
|
||||
this.$router.push({ path: '/music/browse/' + type })
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ import TabsMusic from '@/components/TabsMusic.vue'
|
||||
import ListAlbums from '@/components/ListAlbums.vue'
|
||||
import webapi from '@/webapi'
|
||||
import store from '@/store'
|
||||
import { byDateSinceToday, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byDateSinceToday } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
const limit = store.getters.settings_option_recently_added_limit
|
||||
return webapi.search({
|
||||
type: 'album',
|
||||
@ -32,7 +32,7 @@ const dataObject = {
|
||||
})
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.recently_added = new GroupByList(response.data.albums)
|
||||
vm.recently_added.group(
|
||||
byDateSinceToday('time_added', {
|
||||
|
@ -24,7 +24,7 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return webapi.search({
|
||||
type: 'track',
|
||||
expression:
|
||||
@ -33,7 +33,7 @@ const dataObject = {
|
||||
})
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.recently_played = new GroupByList(response.data.tracks)
|
||||
}
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_composer(to.params.composer),
|
||||
webapi.library_composer_albums(to.params.composer)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.composer = response[0].data
|
||||
vm.albums_list = new GroupByList(response[1].data.albums)
|
||||
}
|
||||
@ -98,14 +98,14 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_tracks: function () {
|
||||
open_tracks() {
|
||||
this.$router.push({
|
||||
name: 'ComposerTracks',
|
||||
params: { composer: this.composer.name }
|
||||
})
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_expression(
|
||||
'composer is "' + this.composer.name + '" and media_kind is music',
|
||||
true
|
||||
|
@ -73,17 +73,17 @@ import ListTracks from '@/components/ListTracks.vue'
|
||||
import ModalDialogComposer from '@/components/ModalDialogComposer.vue'
|
||||
import webapi from '@/webapi'
|
||||
import * as types from '@/store/mutation_types'
|
||||
import { byName, byRating, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_composer(to.params.composer),
|
||||
webapi.library_composer_tracks(to.params.composer)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.composer = response[0].data
|
||||
vm.tracks_list = new GroupByList(response[1].data.tracks)
|
||||
}
|
||||
@ -156,7 +156,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_albums: function () {
|
||||
open_albums() {
|
||||
this.show_details_modal = false
|
||||
this.$router.push({
|
||||
name: 'ComposerAlbums',
|
||||
@ -164,7 +164,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_expression(this.expression, true)
|
||||
}
|
||||
}
|
||||
|
@ -25,14 +25,14 @@ import TabsMusic from '@/components/TabsMusic.vue'
|
||||
import IndexButtonList from '@/components/IndexButtonList.vue'
|
||||
import ListComposers from '@/components/ListComposers.vue'
|
||||
import webapi from '@/webapi'
|
||||
import { byName, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return webapi.library_composers('music')
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.composers = new GroupByList(response.data)
|
||||
vm.composers.group(byName('name_sort'))
|
||||
}
|
||||
|
@ -49,14 +49,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
if (to.query.directory) {
|
||||
return webapi.library_files(to.query.directory)
|
||||
}
|
||||
return Promise.resolve()
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
if (response) {
|
||||
vm.dirs = response.data.directories
|
||||
vm.playlists = new GroupByList(response.data.playlists)
|
||||
@ -119,7 +119,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_expression(this.play_expression, false)
|
||||
}
|
||||
}
|
||||
|
@ -52,17 +52,17 @@ import IndexButtonList from '@/components/IndexButtonList.vue'
|
||||
import ListAlbums from '@/components/ListAlbums.vue'
|
||||
import ModalDialogGenre from '@/components/ModalDialogGenre.vue'
|
||||
import webapi from '@/webapi'
|
||||
import { byName, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_genre(to.params.genre),
|
||||
webapi.library_genre_albums(to.params.genre)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.genre = response[0].data
|
||||
vm.albums_list = new GroupByList(response[1].data.albums)
|
||||
vm.albums_list.group(byName('name_sort', true))
|
||||
@ -105,7 +105,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_tracks: function () {
|
||||
open_tracks() {
|
||||
this.show_details_modal = false
|
||||
this.$router.push({
|
||||
name: 'GenreTracks',
|
||||
@ -113,7 +113,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_expression(
|
||||
'genre is "' + this.genre.name + '" and media_kind is music',
|
||||
true
|
||||
|
@ -67,17 +67,17 @@ import ListTracks from '@/components/ListTracks.vue'
|
||||
import ModalDialogGenre from '@/components/ModalDialogGenre.vue'
|
||||
import webapi from '@/webapi'
|
||||
import * as types from '@/store/mutation_types'
|
||||
import { byName, byRating, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName, byRating } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_genre(to.params.genre),
|
||||
webapi.library_genre_tracks(to.params.genre)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.genre = response[0].data
|
||||
vm.tracks_list = new GroupByList(response[1].data.tracks)
|
||||
}
|
||||
@ -150,12 +150,12 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_genre: function () {
|
||||
open_genre() {
|
||||
this.show_details_modal = false
|
||||
this.$router.push({ name: 'Genre', params: { genre: this.genre.name } })
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_expression(this.expression, true)
|
||||
}
|
||||
}
|
||||
|
@ -25,14 +25,14 @@ import TabsMusic from '@/components/TabsMusic.vue'
|
||||
import IndexButtonList from '@/components/IndexButtonList.vue'
|
||||
import ListGenres from '@/components/ListGenres.vue'
|
||||
import webapi from '@/webapi'
|
||||
import { byName, GroupByList } from '@/lib/GroupByList'
|
||||
import { GroupByList, byName } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return webapi.library_genres('music')
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.genres = response.data
|
||||
vm.genres = new GroupByList(response.data)
|
||||
vm.genres.group(byName('name_sort'))
|
||||
|
@ -161,7 +161,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function () {},
|
||||
mounted() {},
|
||||
|
||||
created() {
|
||||
this.item_progress_ms = this.state.item_progress_ms
|
||||
@ -181,27 +181,27 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
tick: function () {
|
||||
tick() {
|
||||
if (!this.is_dragged) {
|
||||
this.item_progress_ms += 1000
|
||||
}
|
||||
},
|
||||
|
||||
start_dragging: function () {
|
||||
start_dragging() {
|
||||
this.is_dragged = true
|
||||
},
|
||||
|
||||
end_dragging: function () {
|
||||
end_dragging() {
|
||||
this.is_dragged = false
|
||||
},
|
||||
|
||||
seek: function (newPosition) {
|
||||
seek(newPosition) {
|
||||
webapi.player_seek_to_pos(newPosition).catch(() => {
|
||||
this.item_progress_ms = this.state.item_progress_ms
|
||||
})
|
||||
},
|
||||
|
||||
open_dialog: function (item) {
|
||||
open_dialog(item) {
|
||||
this.selected_item = item
|
||||
this.show_details_modal = true
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_playlist(to.params.playlist_id),
|
||||
webapi.library_playlist_tracks(to.params.playlist_id)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.playlist = response[0].data
|
||||
vm.tracks = new GroupByList(response[1].data)
|
||||
}
|
||||
@ -89,7 +89,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_uri(this.uris, true)
|
||||
}
|
||||
}
|
||||
|
@ -20,14 +20,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList, noop } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_playlist(to.params.playlist_id),
|
||||
webapi.library_playlist_folder(to.params.playlist_id)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.playlist = response[0].data
|
||||
vm.playlists_list = new GroupByList(response[1].data)
|
||||
}
|
||||
|
@ -64,14 +64,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_album(to.params.album_id),
|
||||
webapi.library_podcast_episodes(to.params.album_id)
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.album = response[0].data
|
||||
vm.tracks = new GroupByList(response[1].data.tracks)
|
||||
}
|
||||
@ -116,11 +116,11 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
play: function () {
|
||||
play() {
|
||||
webapi.player_play_uri(this.album.uri, false)
|
||||
},
|
||||
|
||||
open_remove_podcast_dialog: function () {
|
||||
open_remove_podcast_dialog() {
|
||||
webapi
|
||||
.library_track_playlists(this.tracks.items[0].id)
|
||||
.then(({ data }) => {
|
||||
@ -132,7 +132,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
remove_podcast: function () {
|
||||
remove_podcast() {
|
||||
this.show_remove_podcast_modal = false
|
||||
webapi
|
||||
.library_playlist_delete(this.rss_playlist_to_remove.id)
|
||||
@ -141,7 +141,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
reload_tracks: function () {
|
||||
reload_tracks() {
|
||||
webapi.library_podcast_episodes(this.album.id).then(({ data }) => {
|
||||
this.tracks = new GroupByList(data.tracks)
|
||||
})
|
||||
|
@ -66,14 +66,14 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return Promise.all([
|
||||
webapi.library_albums('podcast'),
|
||||
webapi.library_podcasts_new_episodes()
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.albums = new GroupByList(response[0].data)
|
||||
vm.new_episodes = new GroupByList(response[1].data.tracks)
|
||||
}
|
||||
@ -118,31 +118,31 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
mark_all_played: function () {
|
||||
mark_all_played() {
|
||||
this.new_episodes.items.forEach((ep) => {
|
||||
webapi.library_track_update(ep.id, { play_count: 'increment' })
|
||||
})
|
||||
this.new_episodes.items = {}
|
||||
},
|
||||
|
||||
open_add_podcast_dialog: function (item) {
|
||||
open_add_podcast_dialog(item) {
|
||||
this.show_url_modal = true
|
||||
},
|
||||
|
||||
reload_new_episodes: function () {
|
||||
reload_new_episodes() {
|
||||
webapi.library_podcasts_new_episodes().then(({ data }) => {
|
||||
this.new_episodes = new GroupByList(data.tracks)
|
||||
})
|
||||
},
|
||||
|
||||
reload_podcasts: function () {
|
||||
reload_podcasts() {
|
||||
webapi.library_albums('podcast').then(({ data }) => {
|
||||
this.albums = new GroupByList(data)
|
||||
this.reload_new_episodes()
|
||||
})
|
||||
},
|
||||
|
||||
update_rss: function () {
|
||||
update_rss() {
|
||||
this.$store.commit(types.UPDATE_DIALOG_SCAN_KIND, 'rss')
|
||||
this.$store.commit(types.SHOW_UPDATE_DIALOG, true)
|
||||
}
|
||||
|
@ -162,19 +162,19 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
queue_clear: function () {
|
||||
queue_clear() {
|
||||
webapi.queue_clear()
|
||||
},
|
||||
|
||||
update_show_next_items: function (e) {
|
||||
update_show_next_items(e) {
|
||||
this.$store.commit(types.SHOW_ONLY_NEXT_ITEMS, !this.show_only_next_items)
|
||||
},
|
||||
|
||||
remove: function (item) {
|
||||
remove(item) {
|
||||
webapi.queue_remove(item.id)
|
||||
},
|
||||
|
||||
move_item: function (e) {
|
||||
move_item(e) {
|
||||
const oldPosition = !this.show_only_next_items
|
||||
? e.oldIndex
|
||||
: e.oldIndex + this.current_position
|
||||
@ -185,16 +185,16 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
open_dialog: function (item) {
|
||||
open_dialog(item) {
|
||||
this.selected_item = item
|
||||
this.show_details_modal = true
|
||||
},
|
||||
|
||||
open_add_stream_dialog: function (item) {
|
||||
open_add_stream_dialog(item) {
|
||||
this.show_url_modal = true
|
||||
},
|
||||
|
||||
save_dialog: function (item) {
|
||||
save_dialog(item) {
|
||||
if (this.queue_items.length > 0) {
|
||||
this.show_pls_save_modal = true
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ import webapi from '@/webapi'
|
||||
import { GroupByList } from '@/lib/GroupByList'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
return webapi.library_radio_streams()
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.tracks = new GroupByList(response.data.tracks)
|
||||
}
|
||||
}
|
||||
|
@ -345,13 +345,6 @@ export default {
|
||||
},
|
||||
show_all_podcasts_button() {
|
||||
return this.podcasts.total > this.podcasts.items.length
|
||||
},
|
||||
|
||||
is_visible_artwork() {
|
||||
return this.$store.getters.settings_option(
|
||||
'webinterface',
|
||||
'show_cover_artwork_in_album_lists'
|
||||
).value
|
||||
}
|
||||
},
|
||||
|
||||
@ -361,12 +354,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function () {
|
||||
mounted() {
|
||||
this.search(this.$route)
|
||||
},
|
||||
|
||||
methods: {
|
||||
search: function (route) {
|
||||
search(route) {
|
||||
if (!route.query.query || route.query.query === '') {
|
||||
this.search_query = ''
|
||||
this.$refs.search_field.focus()
|
||||
@ -380,7 +373,7 @@ export default {
|
||||
this.$store.commit(types.ADD_RECENT_SEARCH, route.query.query)
|
||||
},
|
||||
|
||||
searchMusic: function (query) {
|
||||
searchMusic(query) {
|
||||
if (
|
||||
query.type.indexOf('track') < 0 &&
|
||||
query.type.indexOf('artist') < 0 &&
|
||||
@ -415,7 +408,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
searchAudiobooks: function (query) {
|
||||
searchAudiobooks(query) {
|
||||
if (query.type.indexOf('audiobook') < 0) {
|
||||
return
|
||||
}
|
||||
@ -446,7 +439,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
searchPodcasts: function (query) {
|
||||
searchPodcasts(query) {
|
||||
if (query.type.indexOf('podcast') < 0) {
|
||||
return
|
||||
}
|
||||
@ -477,7 +470,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
new_search: function () {
|
||||
new_search() {
|
||||
if (!this.search_query) {
|
||||
return
|
||||
}
|
||||
@ -494,7 +487,7 @@ export default {
|
||||
this.$refs.search_field.blur()
|
||||
},
|
||||
|
||||
open_search_tracks: function () {
|
||||
open_search_tracks() {
|
||||
this.$router.push({
|
||||
path: '/search/library',
|
||||
query: {
|
||||
@ -504,7 +497,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_artists: function () {
|
||||
open_search_artists() {
|
||||
this.$router.push({
|
||||
path: '/search/library',
|
||||
query: {
|
||||
@ -514,7 +507,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_albums: function () {
|
||||
open_search_albums() {
|
||||
this.$router.push({
|
||||
path: '/search/library',
|
||||
query: {
|
||||
@ -524,7 +517,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_composers: function () {
|
||||
open_search_composers() {
|
||||
this.$router.push({
|
||||
path: '/search/library',
|
||||
query: {
|
||||
@ -534,7 +527,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_playlists: function () {
|
||||
open_search_playlists() {
|
||||
this.$router.push({
|
||||
path: '/search/library',
|
||||
query: {
|
||||
@ -544,7 +537,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_audiobooks: function () {
|
||||
open_search_audiobooks() {
|
||||
this.$router.push({
|
||||
path: '/search/library',
|
||||
query: {
|
||||
@ -554,7 +547,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_podcasts: function () {
|
||||
open_search_podcasts() {
|
||||
this.$router.push({
|
||||
path: '/search/library',
|
||||
query: {
|
||||
@ -564,43 +557,43 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_composer: function (composer) {
|
||||
open_composer(composer) {
|
||||
this.$router.push({
|
||||
name: 'ComposerAlbums',
|
||||
params: { composer: composer.name }
|
||||
})
|
||||
},
|
||||
|
||||
open_playlist: function (playlist) {
|
||||
open_playlist(playlist) {
|
||||
this.$router.push({ path: '/playlists/' + playlist.id + '/tracks' })
|
||||
},
|
||||
|
||||
open_recent_search: function (query) {
|
||||
open_recent_search(query) {
|
||||
this.search_query = query
|
||||
this.new_search()
|
||||
},
|
||||
|
||||
open_track_dialog: function (track) {
|
||||
open_track_dialog(track) {
|
||||
this.selected_track = track
|
||||
this.show_track_details_modal = true
|
||||
},
|
||||
|
||||
open_album_dialog: function (album) {
|
||||
open_album_dialog(album) {
|
||||
this.selected_album = album
|
||||
this.show_album_details_modal = true
|
||||
},
|
||||
|
||||
open_artist_dialog: function (artist) {
|
||||
open_artist_dialog(artist) {
|
||||
this.selected_artist = artist
|
||||
this.show_artist_details_modal = true
|
||||
},
|
||||
|
||||
open_composer_dialog: function (composer) {
|
||||
open_composer_dialog(composer) {
|
||||
this.selected_composer = composer
|
||||
this.show_composer_details_modal = true
|
||||
},
|
||||
|
||||
open_playlist_dialog: function (playlist) {
|
||||
open_playlist_dialog(playlist) {
|
||||
this.selected_playlist = playlist
|
||||
this.show_playlist_details_modal = true
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ import webapi from '@/webapi'
|
||||
import SpotifyWebApi from 'spotify-web-api-js'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
const spotifyApi = new SpotifyWebApi()
|
||||
spotifyApi.setAccessToken(store.state.spotify.webapi_token)
|
||||
return spotifyApi.getAlbum(to.params.album_id, {
|
||||
@ -88,7 +88,7 @@ const dataObject = {
|
||||
})
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.album = response
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
artwork_url: function () {
|
||||
artwork_url() {
|
||||
if (this.album.images && this.album.images.length > 0) {
|
||||
return this.album.images[0].url
|
||||
}
|
||||
@ -137,18 +137,18 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_artist: function () {
|
||||
open_artist() {
|
||||
this.$router.push({
|
||||
path: '/music/spotify/artists/' + this.album.artists[0].id
|
||||
})
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
this.show_details_modal = false
|
||||
webapi.player_play_uri(this.album.uri, true)
|
||||
},
|
||||
|
||||
open_track_dialog: function (track) {
|
||||
open_track_dialog(track) {
|
||||
this.selected_track = track
|
||||
this.show_track_details_modal = true
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ const dataObject = {
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.artist = response[0]
|
||||
|
||||
vm.albums = []
|
||||
@ -149,7 +149,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
load_next: function ({ loaded }) {
|
||||
load_next({ loaded }) {
|
||||
const spotifyApi = new SpotifyWebApi()
|
||||
spotifyApi.setAccessToken(this.$store.state.spotify.webapi_token)
|
||||
spotifyApi
|
||||
@ -164,27 +164,27 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
append_albums: function (data) {
|
||||
append_albums(data) {
|
||||
this.albums = this.albums.concat(data.items)
|
||||
this.total = data.total
|
||||
this.offset += data.limit
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
this.show_details_modal = false
|
||||
webapi.player_play_uri(this.artist.uri, true)
|
||||
},
|
||||
|
||||
open_album: function (album) {
|
||||
open_album(album) {
|
||||
this.$router.push({ path: '/music/spotify/albums/' + album.id })
|
||||
},
|
||||
|
||||
open_dialog: function (album) {
|
||||
open_dialog(album) {
|
||||
this.selected_album = album
|
||||
this.show_details_modal = true
|
||||
},
|
||||
|
||||
artwork_url: function (album) {
|
||||
artwork_url(album) {
|
||||
if (album.images && album.images.length > 0) {
|
||||
return album.images[0].url
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ import * as types from '@/store/mutation_types'
|
||||
import SpotifyWebApi from 'spotify-web-api-js'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
if (
|
||||
store.state.spotify_new_releases.length > 0 &&
|
||||
store.state.spotify_featured_playlists.length > 0
|
||||
@ -127,7 +127,7 @@ const dataObject = {
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
if (response) {
|
||||
store.commit(types.SPOTIFY_NEW_RELEASES, response[0].albums.items)
|
||||
store.commit(
|
||||
@ -191,21 +191,21 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_album: function (album) {
|
||||
open_album(album) {
|
||||
this.$router.push({ path: '/music/spotify/albums/' + album.id })
|
||||
},
|
||||
|
||||
open_album_dialog: function (album) {
|
||||
open_album_dialog(album) {
|
||||
this.selected_album = album
|
||||
this.show_album_details_modal = true
|
||||
},
|
||||
|
||||
open_playlist_dialog: function (playlist) {
|
||||
open_playlist_dialog(playlist) {
|
||||
this.selected_playlist = playlist
|
||||
this.show_playlist_details_modal = true
|
||||
},
|
||||
|
||||
artwork_url: function (album) {
|
||||
artwork_url(album) {
|
||||
if (album.images && album.images.length > 0) {
|
||||
return album.images[0].url
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ import * as types from '@/store/mutation_types'
|
||||
import SpotifyWebApi from 'spotify-web-api-js'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
if (store.state.spotify_featured_playlists.length > 0) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
@ -52,7 +52,7 @@ const dataObject = {
|
||||
})
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
if (response) {
|
||||
store.commit(types.SPOTIFY_FEATURED_PLAYLISTS, response.playlists.items)
|
||||
}
|
||||
@ -95,7 +95,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_playlist_dialog: function (playlist) {
|
||||
open_playlist_dialog(playlist) {
|
||||
this.selected_playlist = playlist
|
||||
this.show_playlist_details_modal = true
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ import * as types from '@/store/mutation_types'
|
||||
import SpotifyWebApi from 'spotify-web-api-js'
|
||||
|
||||
const dataObject = {
|
||||
load: function (to) {
|
||||
load(to) {
|
||||
if (store.state.spotify_new_releases.length > 0) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
@ -64,7 +64,7 @@ const dataObject = {
|
||||
})
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
if (response) {
|
||||
store.commit(types.SPOTIFY_NEW_RELEASES, response.albums.items)
|
||||
}
|
||||
@ -115,16 +115,16 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
open_album: function (album) {
|
||||
open_album(album) {
|
||||
this.$router.push({ path: '/music/spotify/albums/' + album.id })
|
||||
},
|
||||
|
||||
open_album_dialog: function (album) {
|
||||
open_album_dialog(album) {
|
||||
this.selected_album = album
|
||||
this.show_album_details_modal = true
|
||||
},
|
||||
|
||||
artwork_url: function (album) {
|
||||
artwork_url(album) {
|
||||
if (album.images && album.images.length > 0) {
|
||||
return album.images[0].url
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ const dataObject = {
|
||||
])
|
||||
},
|
||||
|
||||
set: function (vm, response) {
|
||||
set(vm, response) {
|
||||
vm.playlist = response[0]
|
||||
vm.tracks = []
|
||||
vm.total = 0
|
||||
@ -130,7 +130,7 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
load_next: function ({ loaded }) {
|
||||
load_next({ loaded }) {
|
||||
const spotifyApi = new SpotifyWebApi()
|
||||
spotifyApi.setAccessToken(this.$store.state.spotify.webapi_token)
|
||||
spotifyApi
|
||||
@ -144,18 +144,18 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
append_tracks: function (data) {
|
||||
append_tracks(data) {
|
||||
this.tracks = this.tracks.concat(data.items)
|
||||
this.total = data.total
|
||||
this.offset += data.limit
|
||||
},
|
||||
|
||||
play: function () {
|
||||
play() {
|
||||
this.show_details_modal = false
|
||||
webapi.player_play_uri(this.playlist.uri, true)
|
||||
},
|
||||
|
||||
open_track_dialog: function (track) {
|
||||
open_track_dialog(track) {
|
||||
this.selected_track = track
|
||||
this.show_track_details_modal = true
|
||||
}
|
||||
|
@ -379,20 +379,20 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function () {
|
||||
mounted() {
|
||||
this.query = this.$route.query
|
||||
this.search()
|
||||
},
|
||||
|
||||
methods: {
|
||||
reset: function () {
|
||||
reset() {
|
||||
this.tracks = { items: [], total: 0 }
|
||||
this.artists = { items: [], total: 0 }
|
||||
this.albums = { items: [], total: 0 }
|
||||
this.playlists = { items: [], total: 0 }
|
||||
},
|
||||
|
||||
search: function () {
|
||||
search() {
|
||||
this.reset()
|
||||
|
||||
// If no search query present reset and focus search field
|
||||
@ -415,7 +415,7 @@ export default {
|
||||
this.search_all()
|
||||
},
|
||||
|
||||
spotify_search: function () {
|
||||
spotify_search() {
|
||||
return webapi.spotify().then(({ data }) => {
|
||||
this.search_param.market = data.webapi_country
|
||||
|
||||
@ -429,7 +429,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
search_all: function () {
|
||||
search_all() {
|
||||
this.spotify_search().then((data) => {
|
||||
this.tracks = data.tracks ? data.tracks : { items: [], total: 0 }
|
||||
this.artists = data.artists ? data.artists : { items: [], total: 0 }
|
||||
@ -440,7 +440,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
search_tracks_next: function ({ loaded }) {
|
||||
search_tracks_next({ loaded }) {
|
||||
this.spotify_search().then((data) => {
|
||||
this.tracks.items = this.tracks.items.concat(data.tracks.items)
|
||||
this.tracks.total = data.tracks.total
|
||||
@ -450,7 +450,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
search_artists_next: function ({ loaded }) {
|
||||
search_artists_next({ loaded }) {
|
||||
this.spotify_search().then((data) => {
|
||||
this.artists.items = this.artists.items.concat(data.artists.items)
|
||||
this.artists.total = data.artists.total
|
||||
@ -460,7 +460,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
search_albums_next: function ({ loaded }) {
|
||||
search_albums_next({ loaded }) {
|
||||
this.spotify_search().then((data) => {
|
||||
this.albums.items = this.albums.items.concat(data.albums.items)
|
||||
this.albums.total = data.albums.total
|
||||
@ -470,7 +470,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
search_playlists_next: function ({ loaded }) {
|
||||
search_playlists_next({ loaded }) {
|
||||
this.spotify_search().then((data) => {
|
||||
this.playlists.items = this.playlists.items.concat(data.playlists.items)
|
||||
this.playlists.total = data.playlists.total
|
||||
@ -480,7 +480,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
new_search: function () {
|
||||
new_search() {
|
||||
if (!this.search_query) {
|
||||
return
|
||||
}
|
||||
@ -497,7 +497,7 @@ export default {
|
||||
this.$refs.search_field.blur()
|
||||
},
|
||||
|
||||
open_search_tracks: function () {
|
||||
open_search_tracks() {
|
||||
this.$router.push({
|
||||
path: '/search/spotify',
|
||||
query: {
|
||||
@ -507,7 +507,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_artists: function () {
|
||||
open_search_artists() {
|
||||
this.$router.push({
|
||||
path: '/search/spotify',
|
||||
query: {
|
||||
@ -517,7 +517,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_albums: function () {
|
||||
open_search_albums() {
|
||||
this.$router.push({
|
||||
path: '/search/spotify',
|
||||
query: {
|
||||
@ -527,7 +527,7 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_search_playlists: function () {
|
||||
open_search_playlists() {
|
||||
this.$router.push({
|
||||
path: '/search/spotify',
|
||||
query: {
|
||||
@ -537,36 +537,36 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
open_recent_search: function (query) {
|
||||
open_recent_search(query) {
|
||||
this.search_query = query
|
||||
this.new_search()
|
||||
},
|
||||
|
||||
open_track_dialog: function (track) {
|
||||
open_track_dialog(track) {
|
||||
this.selected_track = track
|
||||
this.show_track_details_modal = true
|
||||
},
|
||||
|
||||
open_album_dialog: function (album) {
|
||||
open_album_dialog(album) {
|
||||
this.selected_album = album
|
||||
this.show_album_details_modal = true
|
||||
},
|
||||
|
||||
open_artist_dialog: function (artist) {
|
||||
open_artist_dialog(artist) {
|
||||
this.selected_artist = artist
|
||||
this.show_artist_details_modal = true
|
||||
},
|
||||
|
||||
open_playlist_dialog: function (playlist) {
|
||||
open_playlist_dialog(playlist) {
|
||||
this.selected_playlist = playlist
|
||||
this.show_playlist_details_modal = true
|
||||
},
|
||||
|
||||
open_album: function (album) {
|
||||
open_album(album) {
|
||||
this.$router.push({ path: '/music/spotify/albums/' + album.id })
|
||||
},
|
||||
|
||||
artwork_url: function (album) {
|
||||
artwork_url(album) {
|
||||
if (album.images && album.images.length > 0) {
|
||||
return album.images[0].url
|
||||
}
|
||||
|
@ -83,11 +83,11 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
scroll_to_top: function () {
|
||||
scroll_to_top() {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||
},
|
||||
|
||||
scroll_to_content: function () {
|
||||
scroll_to_content() {
|
||||
if (this.$route.meta.has_tabs) {
|
||||
this.$scrollTo('#top', { offset: -140 })
|
||||
} else {
|
||||
@ -95,7 +95,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
visibilityChanged: function (isVisible) {
|
||||
visibilityChanged(isVisible) {
|
||||
this.options_visible = isVisible
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user