[web] Cleanup of code to simplify

Useless methods have been removed and code has been partially cleaned up.
This commit is contained in:
Alain Nussbaumer 2023-06-07 21:25:54 +02:00
parent 3a1cc63e8f
commit 387e531d64
84 changed files with 355 additions and 362 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -88,7 +88,7 @@ export default {
} }
}, },
created: function () { created() {
this.connect() this.connect()
// Start the progress bar on app start // Start the progress bar on app start
@ -106,7 +106,7 @@ export default {
next() 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) => { this.$router.afterEach((to, from) => {
if (to.meta.show_progress) { if (to.meta.show_progress) {
this.$Progress.finish() this.$Progress.finish()
@ -115,7 +115,7 @@ export default {
}, },
methods: { methods: {
connect: function () { connect() {
webapi webapi
.config() .config()
.then(({ data }) => { .then(({ data }) => {
@ -135,7 +135,7 @@ export default {
}) })
}, },
open_ws: function () { open_ws() {
if (this.$store.state.config.websocket_port <= 0) { if (this.$store.state.config.websocket_port <= 0) {
this.$store.dispatch('add_notification', { this.$store.dispatch('add_notification', {
text: this.$t('server.missing-port'), text: this.$t('server.missing-port'),
@ -226,7 +226,7 @@ export default {
vm.update_pairing() vm.update_pairing()
update_throttled = true update_throttled = true
setTimeout(function () { setTimeout(() => {
update_throttled = false update_throttled = false
}, 500) }, 500)
} }
@ -234,7 +234,7 @@ export default {
// These events are fired when the window becomes active in different ways // These events are fired when the window becomes active in different ways
// When this happens, we should update 'now playing' info etc // When this happens, we should update 'now playing' info etc
window.addEventListener('focus', update_info) window.addEventListener('focus', update_info)
document.addEventListener('visibilitychange', function () { document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') { if (document.visibilityState === 'visible') {
update_info() update_info()
} }
@ -273,7 +273,7 @@ export default {
} }
}, },
update_library_stats: function () { update_library_stats() {
webapi.library_stats().then(({ data }) => { webapi.library_stats().then(({ data }) => {
this.$store.commit(types.UPDATE_LIBRARY_STATS, data) this.$store.commit(types.UPDATE_LIBRARY_STATS, data)
}) })
@ -288,37 +288,37 @@ export default {
}) })
}, },
update_outputs: function () { update_outputs() {
webapi.outputs().then(({ data }) => { webapi.outputs().then(({ data }) => {
this.$store.commit(types.UPDATE_OUTPUTS, data.outputs) this.$store.commit(types.UPDATE_OUTPUTS, data.outputs)
}) })
}, },
update_player_status: function () { update_player_status() {
webapi.player_status().then(({ data }) => { webapi.player_status().then(({ data }) => {
this.$store.commit(types.UPDATE_PLAYER_STATUS, data) this.$store.commit(types.UPDATE_PLAYER_STATUS, data)
}) })
}, },
update_queue: function () { update_queue() {
webapi.queue().then(({ data }) => { webapi.queue().then(({ data }) => {
this.$store.commit(types.UPDATE_QUEUE, data) this.$store.commit(types.UPDATE_QUEUE, data)
}) })
}, },
update_settings: function () { update_settings() {
webapi.settings().then(({ data }) => { webapi.settings().then(({ data }) => {
this.$store.commit(types.UPDATE_SETTINGS, data) this.$store.commit(types.UPDATE_SETTINGS, data)
}) })
}, },
update_lastfm: function () { update_lastfm() {
webapi.lastfm().then(({ data }) => { webapi.lastfm().then(({ data }) => {
this.$store.commit(types.UPDATE_LASTFM, data) this.$store.commit(types.UPDATE_LASTFM, data)
}) })
}, },
update_spotify: function () { update_spotify() {
webapi.spotify().then(({ data }) => { webapi.spotify().then(({ data }) => {
this.$store.commit(types.UPDATE_SPOTIFY, data) this.$store.commit(types.UPDATE_SPOTIFY, data)
@ -335,14 +335,14 @@ export default {
}) })
}, },
update_pairing: function () { update_pairing() {
webapi.pairing().then(({ data }) => { webapi.pairing().then(({ data }) => {
this.$store.commit(types.UPDATE_PAIRING, data) this.$store.commit(types.UPDATE_PAIRING, data)
this.pairing_active = data.active this.pairing_active = data.active
}) })
}, },
update_is_clipped: function () { update_is_clipped() {
if (this.show_burger_menu || this.show_player_menu) { if (this.show_burger_menu || this.show_player_menu) {
document.querySelector('html').classList.add('is-clipped') document.querySelector('html').classList.add('is-clipped')
} else { } else {

View File

@ -8,7 +8,7 @@ export default {
_source: null, _source: null,
_gain: null, _gain: null,
// setup audio routing // Setup audio routing
setupAudio() { setupAudio() {
const AudioContext = window.AudioContext || window.webkitAudioContext const AudioContext = window.AudioContext || window.webkitAudioContext
this._context = new AudioContext() this._context = new AudioContext()
@ -27,7 +27,7 @@ export default {
return this._audio return this._audio
}, },
// set audio volume // Set audio volume
setVolume(volume) { setVolume(volume) {
if (!this._gain) return if (!this._gain) return
volume = parseFloat(volume) || 0.0 volume = parseFloat(volume) || 0.0
@ -36,7 +36,7 @@ export default {
this._gain.gain.value = volume this._gain.gain.value = volume
}, },
// play audio source url // Play audio source url
playSource(source) { playSource(source) {
this.stopAudio() this.stopAudio()
this._context.resume().then(() => { this._context.resume().then(() => {
@ -46,22 +46,22 @@ export default {
}) })
}, },
// stop playing audio // Stop playing audio
stopAudio() { stopAudio() {
try { try {
this._audio.pause() this._audio.pause()
} catch (e) { } catch (e) {
// continue regardless of error // Continue regardless of error
} }
try { try {
this._audio.stop() this._audio.stop()
} catch (e) { } catch (e) {
// continue regardless of error // Continue regardless of error
} }
try { try {
this._audio.close() this._audio.close()
} catch (e) { } catch (e) {
// continue regardless of error // Continue regardless of error
} }
} }
} }

View File

@ -32,7 +32,7 @@ export default {
}, },
computed: { computed: {
artwork_url_with_size: function () { artwork_url_with_size() {
if (this.maxwidth > 0 && this.maxheight > 0) { if (this.maxwidth > 0 && this.maxheight > 0) {
return webapi.artwork_url_append_size_params( return webapi.artwork_url_append_size_params(
this.artwork_url, this.artwork_url,
@ -59,7 +59,7 @@ export default {
}, },
methods: { methods: {
dataURI: function () { dataURI() {
return renderSVG(this.caption, this.alt_text, { return renderSVG(this.caption, this.alt_text, {
width: this.width, width: this.width,
height: this.height, height: this.height,

View File

@ -17,7 +17,7 @@ export default {
name: 'IndexButtonList', name: 'IndexButtonList',
props: ['index'], props: ['index'],
methods: { methods: {
nav: function (id) { nav(id) {
this.$router.push({ hash: '#index_' + id }) this.$router.push({ hash: '#index_' + id })
} }
} }

View File

@ -95,13 +95,13 @@ export default {
).value ).value
}, },
media_kind_resolved: function () { media_kind_resolved() {
return this.media_kind ? this.media_kind : this.selected_album.media_kind return this.media_kind ? this.media_kind : this.selected_album.media_kind
} }
}, },
methods: { methods: {
open_album: function (album) { open_album(album) {
this.selected_album = album this.selected_album = album
if (this.media_kind_resolved === 'podcast') { if (this.media_kind_resolved === 'podcast') {
this.$router.push({ path: '/podcasts/' + album.id }) 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.selected_album = album
this.show_details_modal = true this.show_details_modal = true
}, },
open_remove_podcast_dialog: function () { open_remove_podcast_dialog() {
webapi webapi
.library_album_tracks(this.selected_album.id, { limit: 1 }) .library_album_tracks(this.selected_album.id, { limit: 1 })
.then(({ data }) => { .then(({ data }) => {
@ -131,11 +131,11 @@ export default {
}) })
}, },
play_count_changed: function () { play_count_changed() {
this.$emit('play-count-changed') this.$emit('play-count-changed')
}, },
remove_podcast: function () { remove_podcast() {
this.show_remove_podcast_modal = false this.show_remove_podcast_modal = false
webapi webapi
.library_playlist_delete(this.rss_playlist_to_remove.id) .library_playlist_delete(this.rss_playlist_to_remove.id)

View File

@ -53,13 +53,13 @@ export default {
}, },
computed: { computed: {
media_kind_resolved: function () { media_kind_resolved() {
return this.media_kind ? this.media_kind : this.selected_artist.media_kind return this.media_kind ? this.media_kind : this.selected_artist.media_kind
} }
}, },
methods: { methods: {
open_artist: function (artist) { open_artist(artist) {
this.selected_artist = artist this.selected_artist = artist
if (this.media_kind_resolved === 'audiobook') { if (this.media_kind_resolved === 'audiobook') {
this.$router.push({ path: '/audiobooks/artists/' + artist.id }) 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.selected_artist = artist
this.show_details_modal = true this.show_details_modal = true
} }

View File

@ -52,7 +52,7 @@ export default {
}, },
computed: { computed: {
media_kind_resolved: function () { media_kind_resolved() {
return this.media_kind return this.media_kind
? this.media_kind ? this.media_kind
: this.selected_composer.media_kind : this.selected_composer.media_kind
@ -60,7 +60,7 @@ export default {
}, },
methods: { methods: {
open_composer: function (composer) { open_composer(composer) {
this.selected_composer = composer this.selected_composer = composer
this.$router.push({ this.$router.push({
name: 'ComposerAlbums', name: 'ComposerAlbums',
@ -68,7 +68,7 @@ export default {
}) })
}, },
open_dialog: function (composer) { open_dialog(composer) {
this.selected_composer = composer this.selected_composer = composer
this.show_details_modal = true this.show_details_modal = true
} }

View File

@ -72,7 +72,7 @@ export default {
}, },
methods: { methods: {
open_parent_directory: function () { open_parent_directory() {
const parent = this.current_directory.slice( const parent = this.current_directory.slice(
0, 0,
this.current_directory.lastIndexOf('/') this.current_directory.lastIndexOf('/')
@ -95,14 +95,14 @@ export default {
} }
}, },
open_directory: function (directory) { open_directory(directory) {
this.$router.push({ this.$router.push({
path: '/files', path: '/files',
query: { directory: directory.path } query: { directory: directory.path }
}) })
}, },
open_dialog: function (directory) { open_dialog(directory) {
this.selected_directory = directory this.selected_directory = directory
this.show_details_modal = true this.show_details_modal = true
} }

View File

@ -48,17 +48,17 @@ export default {
}, },
computed: { computed: {
media_kind_resolved: function () { media_kind_resolved() {
return this.media_kind ? this.media_kind : this.selected_genre.media_kind return this.media_kind ? this.media_kind : this.selected_genre.media_kind
} }
}, },
methods: { methods: {
open_genre: function (genre) { open_genre(genre) {
this.$router.push({ name: 'Genre', params: { genre: genre.name } }) this.$router.push({ name: 'Genre', params: { genre: genre.name } })
}, },
open_dialog: function (genre) { open_dialog(genre) {
this.selected_genre = genre this.selected_genre = genre
this.show_details_modal = true this.show_details_modal = true
} }

View File

@ -64,7 +64,7 @@ export default {
}, },
methods: { methods: {
play: function () { play() {
webapi.player_play({ item_id: this.item.id }) webapi.player_play({ item_id: this.item.id })
} }
} }

View File

@ -48,7 +48,7 @@ export default {
}, },
methods: { methods: {
open_playlist: function (playlist) { open_playlist(playlist) {
if (playlist.type !== 'folder') { if (playlist.type !== 'folder') {
this.$router.push({ path: '/playlists/' + playlist.id + '/tracks' }) this.$router.push({ path: '/playlists/' + playlist.id + '/tracks' })
} else { } else {
@ -56,12 +56,12 @@ export default {
} }
}, },
open_dialog: function (playlist) { open_dialog(playlist) {
this.selected_playlist = playlist this.selected_playlist = playlist
this.show_details_modal = true this.show_details_modal = true
}, },
icon_name: function (playlist) { icon_name(playlist) {
if (playlist.type === 'folder') { if (playlist.type === 'folder') {
return 'folder' return 'folder'
} else if (playlist.type === 'rss') { } else if (playlist.type === 'rss') {

View File

@ -72,7 +72,7 @@ export default {
}, },
methods: { methods: {
play_track: function (position, track) { play_track(position, track) {
if (this.uris) { if (this.uris) {
webapi.player_play_uri(this.uris, false, position) webapi.player_play_uri(this.uris, false, position)
} else if (this.expression) { } else if (this.expression) {
@ -82,7 +82,7 @@ export default {
} }
}, },
open_dialog: function (track) { open_dialog(track) {
this.selected_track = track this.selected_track = track
this.show_details_modal = true this.show_details_modal = true
} }

View File

@ -94,7 +94,7 @@ export default {
}, },
methods: { methods: {
add_stream: function () { add_stream() {
this.loading = true this.loading = true
webapi webapi
.library_add(this.url) .library_add(this.url)

View File

@ -100,7 +100,7 @@ export default {
}, },
methods: { methods: {
add_stream: function () { add_stream() {
this.loading = true this.loading = true
webapi webapi
.queue_add(this.url) .queue_add(this.url)
@ -113,7 +113,7 @@ export default {
}) })
}, },
play: function () { play() {
this.loading = true this.loading = true
webapi webapi
.player_play_uri(this.url, false) .player_play_uri(this.url, false)

View File

@ -134,32 +134,32 @@ export default {
}, },
computed: { computed: {
artwork_url: function () { artwork_url() {
return webapi.artwork_url_append_size_params(this.album.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 return this.media_kind ? this.media_kind : this.album.media_kind
} }
}, },
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_uri(this.album.uri, false) webapi.player_play_uri(this.album.uri, false)
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_add(this.album.uri) webapi.queue_add(this.album.uri)
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_add_next(this.album.uri) webapi.queue_add_next(this.album.uri)
}, },
open_album: function () { open_album() {
this.$emit('close') this.$emit('close')
if (this.media_kind_resolved === 'podcast') { if (this.media_kind_resolved === 'podcast') {
this.$router.push({ path: '/podcasts/' + this.album.id }) this.$router.push({ path: '/podcasts/' + this.album.id })
@ -170,7 +170,7 @@ export default {
} }
}, },
open_artist: function () { open_artist() {
this.$emit('close') this.$emit('close')
if (this.media_kind_resolved === 'audiobook') { if (this.media_kind_resolved === 'audiobook') {
this.$router.push({ this.$router.push({
@ -181,7 +181,7 @@ export default {
} }
}, },
mark_played: function () { mark_played() {
webapi webapi
.library_album_track_update(this.album.id, { play_count: 'played' }) .library_album_track_update(this.album.id, { play_count: 'played' })
.then(({ data }) => { .then(({ data }) => {
@ -190,11 +190,11 @@ export default {
}) })
}, },
artwork_loaded: function () { artwork_loaded() {
this.artwork_visible = true this.artwork_visible = true
}, },
artwork_error: function () { artwork_error() {
this.artwork_visible = false this.artwork_visible = false
} }
} }

View File

@ -77,22 +77,22 @@ export default {
emits: ['close'], emits: ['close'],
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_uri(this.artist.uri, false) webapi.player_play_uri(this.artist.uri, false)
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_add(this.artist.uri) webapi.queue_add(this.artist.uri)
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_add_next(this.artist.uri) webapi.queue_add_next(this.artist.uri)
}, },
open_artist: function () { open_artist() {
this.$emit('close') this.$emit('close')
this.$router.push({ path: '/music/artists/' + this.artist.id }) this.$router.push({ path: '/music/artists/' + this.artist.id })
} }

View File

@ -79,7 +79,7 @@ export default {
emits: ['close'], emits: ['close'],
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_expression( webapi.player_play_expression(
'composer is "' + this.composer.name + '" and media_kind is music', 'composer is "' + this.composer.name + '" and media_kind is music',
@ -87,21 +87,21 @@ export default {
) )
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_expression_add( webapi.queue_expression_add(
'composer is "' + this.composer.name + '" and media_kind is music' 'composer is "' + this.composer.name + '" and media_kind is music'
) )
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_expression_add_next( webapi.queue_expression_add_next(
'composer is "' + this.composer.name + '" and media_kind is music' 'composer is "' + this.composer.name + '" and media_kind is music'
) )
}, },
open_albums: function () { open_albums() {
this.$emit('close') this.$emit('close')
this.$router.push({ this.$router.push({
name: 'ComposerAlbums', name: 'ComposerAlbums',
@ -109,7 +109,7 @@ export default {
}) })
}, },
open_tracks: function () { open_tracks() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ this.$router.push({
name: 'ComposerTracks', name: 'ComposerTracks',

View File

@ -50,7 +50,7 @@ export default {
emits: ['close'], emits: ['close'],
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_expression( webapi.player_play_expression(
'path starts with "' + this.directory.path + '" order by path asc', 'path starts with "' + this.directory.path + '" order by path asc',
@ -58,14 +58,14 @@ export default {
) )
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_expression_add( webapi.queue_expression_add(
'path starts with "' + this.directory.path + '" order by path asc' 'path starts with "' + this.directory.path + '" order by path asc'
) )
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_expression_add_next( webapi.queue_expression_add_next(
'path starts with "' + this.directory.path + '" order by path asc' 'path starts with "' + this.directory.path + '" order by path asc'

View File

@ -70,7 +70,7 @@ export default {
emits: ['close'], emits: ['close'],
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_expression( webapi.player_play_expression(
'genre is "' + this.genre.name + '" and media_kind is music', 'genre is "' + this.genre.name + '" and media_kind is music',
@ -78,21 +78,21 @@ export default {
) )
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_expression_add( webapi.queue_expression_add(
'genre is "' + this.genre.name + '" and media_kind is music' 'genre is "' + this.genre.name + '" and media_kind is music'
) )
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_expression_add_next( webapi.queue_expression_add_next(
'genre is "' + this.genre.name + '" and media_kind is music' 'genre is "' + this.genre.name + '" and media_kind is music'
) )
}, },
open_genre: function () { open_genre() {
this.$emit('close') this.$emit('close')
this.$router.push({ name: 'Genre', params: { genre: this.genre.name } }) this.$router.push({ name: 'Genre', params: { genre: this.genre.name } })
} }

View File

@ -73,22 +73,22 @@ export default {
emits: ['close'], emits: ['close'],
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_uri(this.uris ? this.uris : this.playlist.uri, false) webapi.player_play_uri(this.uris ? this.uris : this.playlist.uri, false)
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_add(this.uris ? this.uris : this.playlist.uri) webapi.queue_add(this.uris ? this.uris : this.playlist.uri)
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_add_next(this.uris ? this.uris : this.playlist.uri) webapi.queue_add_next(this.uris ? this.uris : this.playlist.uri)
}, },
open_playlist: function () { open_playlist() {
this.$emit('close') this.$emit('close')
this.$router.push({ path: '/playlists/' + this.playlist.id + '/tracks' }) this.$router.push({ path: '/playlists/' + this.playlist.id + '/tracks' })
} }

View File

@ -99,7 +99,7 @@ export default {
}, },
methods: { methods: {
save: function () { save() {
if (this.playlist_name.length < 1) { if (this.playlist_name.length < 1) {
return return
} }

View File

@ -197,17 +197,17 @@ export default {
}, },
methods: { methods: {
remove: function () { remove() {
this.$emit('close') this.$emit('close')
webapi.queue_remove(this.item.id) webapi.queue_remove(this.item.id)
}, },
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play({ item_id: this.item.id }) webapi.player_play({ item_id: this.item.id })
}, },
open_album: function () { open_album() {
if (this.media_kind === 'podcast') { if (this.media_kind === 'podcast') {
this.$router.push({ path: '/podcasts/' + this.item.album_id }) this.$router.push({ path: '/podcasts/' + this.item.album_id })
} else if (this.media_kind === 'audiobook') { } 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 }) 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 } }) this.$router.push({ name: 'Genre', params: { genre: this.item.genre } })
}, },
open_spotify_artist: function () { open_spotify_artist() {
this.$emit('close') this.$emit('close')
this.$router.push({ this.$router.push({
path: '/music/spotify/artists/' + this.spotify_track.artists[0].id path: '/music/spotify/artists/' + this.spotify_track.artists[0].id
}) })
}, },
open_spotify_album: function () { open_spotify_album() {
this.$emit('close') this.$emit('close')
this.$router.push({ this.$router.push({
path: '/music/spotify/albums/' + this.spotify_track.album.id path: '/music/spotify/albums/' + this.spotify_track.album.id

View File

@ -229,22 +229,22 @@ export default {
}, },
methods: { methods: {
play_track: function () { play_track() {
this.$emit('close') this.$emit('close')
webapi.player_play_uri(this.track.uri, false) webapi.player_play_uri(this.track.uri, false)
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_add(this.track.uri) webapi.queue_add(this.track.uri)
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_add_next(this.track.uri) webapi.queue_add_next(this.track.uri)
}, },
open_album: function () { open_album() {
this.$emit('close') this.$emit('close')
if (this.track.media_kind === 'podcast') { if (this.track.media_kind === 'podcast') {
this.$router.push({ path: '/podcasts/' + this.track.album_id }) this.$router.push({ path: '/podcasts/' + this.track.album_id })
@ -255,32 +255,32 @@ export default {
} }
}, },
open_artist: function () { open_artist() {
this.$emit('close') this.$emit('close')
this.$router.push({ this.$router.push({
path: '/music/artists/' + this.track.album_artist_id path: '/music/artists/' + this.track.album_artist_id
}) })
}, },
open_genre: function () { open_genre() {
this.$router.push({ name: 'Genre', params: { genre: this.track.genre } }) this.$router.push({ name: 'Genre', params: { genre: this.track.genre } })
}, },
open_spotify_artist: function () { open_spotify_artist() {
this.$emit('close') this.$emit('close')
this.$router.push({ this.$router.push({
path: '/music/spotify/artists/' + this.spotify_track.artists[0].id path: '/music/spotify/artists/' + this.spotify_track.artists[0].id
}) })
}, },
open_spotify_album: function () { open_spotify_album() {
this.$emit('close') this.$emit('close')
this.$router.push({ this.$router.push({
path: '/music/spotify/albums/' + this.spotify_track.album.id path: '/music/spotify/albums/' + this.spotify_track.album.id
}) })
}, },
mark_new: function () { mark_new() {
webapi webapi
.library_track_update(this.track.id, { play_count: 'reset' }) .library_track_update(this.track.id, { play_count: 'reset' })
.then(() => { .then(() => {
@ -289,7 +289,7 @@ export default {
}) })
}, },
mark_played: function () { mark_played() {
webapi webapi
.library_track_update(this.track.id, { play_count: 'increment' }) .library_track_update(this.track.id, { play_count: 'increment' })
.then(() => { .then(() => {

View File

@ -412,12 +412,12 @@ export default {
} }
}, },
// on app mounted // On app mounted
mounted() { mounted() {
this.setupAudio() this.setupAudio()
}, },
// on app destroyed // On app destroyed
unmounted() { unmounted() {
this.closeAudio() this.closeAudio()
}, },
@ -427,11 +427,11 @@ export default {
this.show_outputs_menu = false this.show_outputs_menu = false
}, },
set_volume: function (newVolume) { set_volume(newVolume) {
webapi.player_volume(newVolume) webapi.player_volume(newVolume)
}, },
toggle_mute_volume: function () { toggle_mute_volume() {
if (this.player.volume > 0) { if (this.player.volume > 0) {
this.set_volume(0) this.set_volume(0)
} else { } else {
@ -439,7 +439,7 @@ export default {
} }
}, },
setupAudio: function () { setupAudio() {
const a = _audio.setupAudio() const a = _audio.setupAudio()
a.addEventListener('waiting', (e) => { a.addEventListener('waiting', (e) => {
@ -465,13 +465,13 @@ export default {
}) })
}, },
// close active audio // Close active audio
closeAudio: function () { closeAudio() {
_audio.stopAudio() _audio.stopAudio()
this.playing = false this.playing = false
}, },
playChannel: function () { playChannel() {
if (this.playing) { if (this.playing) {
return return
} }
@ -482,7 +482,7 @@ export default {
_audio.setVolume(this.stream_volume / 100) _audio.setVolume(this.stream_volume / 100)
}, },
togglePlay: function () { togglePlay() {
if (this.loading) { if (this.loading) {
return return
} }
@ -492,7 +492,7 @@ export default {
return this.playChannel() return this.playChannel()
}, },
set_stream_volume: function (newVolume) { set_stream_volume(newVolume) {
this.stream_volume = newVolume this.stream_volume = newVolume
_audio.setVolume(this.stream_volume / 100) _audio.setVolume(this.stream_volume / 100)
} }

View File

@ -47,7 +47,7 @@ export default {
}, },
methods: { methods: {
open_link: function () { open_link() {
if (this.show_burger_menu) { if (this.show_burger_menu) {
this.$store.commit(types.SHOW_BURGER_MENU, false) this.$store.commit(types.SHOW_BURGER_MENU, false)
} }
@ -57,7 +57,7 @@ export default {
this.$router.push({ path: this.to }) this.$router.push({ path: this.to })
}, },
full_path: function () { full_path() {
const resolved = this.$router.resolve(this.to) const resolved = this.$router.resolve(this.to)
return resolved.href return resolved.href
} }

View File

@ -67,15 +67,15 @@ export default {
}, },
methods: { methods: {
play_next: function () { play_next() {
webapi.player_next() webapi.player_next()
}, },
set_volume: function (newVolume) { set_volume(newVolume) {
webapi.player_output_volume(this.output.id, newVolume) webapi.player_output_volume(this.output.id, newVolume)
}, },
set_enabled: function () { set_enabled() {
const values = { const values = {
selected: !this.output.selected selected: !this.output.selected
} }

View File

@ -37,7 +37,7 @@ export default {
}, },
methods: { methods: {
remove: function (notification) { remove(notification) {
this.$store.commit(types.DELETE_NOTIFICATION, notification) this.$store.commit(types.DELETE_NOTIFICATION, notification)
} }
} }

View File

@ -29,7 +29,7 @@ export default {
}, },
methods: { methods: {
toggle_consume_mode: function () { toggle_consume_mode() {
webapi.player_consume(!this.is_consume) webapi.player_consume(!this.is_consume)
} }
} }

View File

@ -29,7 +29,7 @@ export default {
}, },
methods: { methods: {
play_next: function () { play_next() {
if (this.disabled) { if (this.disabled) {
return return
} }

View File

@ -50,7 +50,7 @@ export default {
}, },
methods: { methods: {
toggle_play_pause: function () { toggle_play_pause() {
if (this.disabled) { if (this.disabled) {
if (this.show_disabled_message) { if (this.show_disabled_message) {
this.$store.dispatch('add_notification', { this.$store.dispatch('add_notification', {

View File

@ -29,7 +29,7 @@ export default {
}, },
methods: { methods: {
play_previous: function () { play_previous() {
if (this.disabled) { if (this.disabled) {
return return
} }

View File

@ -43,7 +43,7 @@ export default {
}, },
methods: { methods: {
toggle_repeat_mode: function () { toggle_repeat_mode() {
if (this.is_repeat_all) { if (this.is_repeat_all) {
webapi.player_repeat('single') webapi.player_repeat('single')
} else if (this.is_repeat_single) { } else if (this.is_repeat_single) {

View File

@ -43,7 +43,7 @@ export default {
}, },
methods: { methods: {
seek: function () { seek() {
if (!this.disabled) { if (!this.disabled) {
webapi.player_seek(this.seek_ms * -1) webapi.player_seek(this.seek_ms * -1)
} }

View File

@ -43,7 +43,7 @@ export default {
}, },
methods: { methods: {
seek: function () { seek() {
if (!this.disabled) { if (!this.disabled) {
webapi.player_seek(this.seek_ms) webapi.player_seek(this.seek_ms)
} }

View File

@ -35,7 +35,7 @@ export default {
}, },
methods: { methods: {
toggle_shuffle_mode: function () { toggle_shuffle_mode() {
webapi.player_shuffle(!this.is_shuffle) webapi.player_shuffle(!this.is_shuffle)
} }
} }

View File

@ -118,7 +118,7 @@ export default {
}) })
}, },
clear_status: function () { clear_status() {
this.statusUpdate = '' this.statusUpdate = ''
} }
} }

View File

@ -125,7 +125,7 @@ export default {
}) })
}, },
clear_status: function () { clear_status() {
this.statusUpdate = '' this.statusUpdate = ''
} }
} }

View File

@ -124,7 +124,7 @@ export default {
}) })
}, },
clear_status: function () { clear_status() {
this.statusUpdate = '' this.statusUpdate = ''
} }
} }

View File

@ -15,7 +15,7 @@ export default {
props: ['artist'], props: ['artist'],
methods: { methods: {
open_artist: function () { open_artist() {
this.$router.push({ path: '/music/spotify/artists/' + this.artist.id }) this.$router.push({ path: '/music/spotify/artists/' + this.artist.id })
} }
} }

View File

@ -16,7 +16,7 @@ export default {
props: ['playlist'], props: ['playlist'],
methods: { methods: {
open_playlist: function () { open_playlist() {
this.$router.push({ this.$router.push({
path: '/music/spotify/playlists/' + this.playlist.id path: '/music/spotify/playlists/' + this.playlist.id
}) })

View File

@ -39,7 +39,7 @@ export default {
name: 'SpotifyListItemTrack', name: 'SpotifyListItemTrack',
props: ['track', 'position', 'album', 'context_uri'], props: ['track', 'position', 'album', 'context_uri'],
methods: { methods: {
play: function () { play() {
webapi.player_play_uri(this.context_uri, false, this.position) webapi.player_play_uri(this.context_uri, false, this.position)
} }
} }

View File

@ -108,7 +108,7 @@ export default {
}, },
computed: { computed: {
artwork_url: function () { artwork_url() {
if (this.album.images && this.album.images.length > 0) { if (this.album.images && this.album.images.length > 0) {
return this.album.images[0].url return this.album.images[0].url
} }
@ -117,36 +117,36 @@ export default {
}, },
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_uri(this.album.uri, false) webapi.player_play_uri(this.album.uri, false)
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_add(this.album.uri) webapi.queue_add(this.album.uri)
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_add_next(this.album.uri) webapi.queue_add_next(this.album.uri)
}, },
open_album: function () { open_album() {
this.$router.push({ path: '/music/spotify/albums/' + this.album.id }) this.$router.push({ path: '/music/spotify/albums/' + this.album.id })
}, },
open_artist: function () { open_artist() {
this.$router.push({ this.$router.push({
path: '/music/spotify/artists/' + this.album.artists[0].id path: '/music/spotify/artists/' + this.album.artists[0].id
}) })
}, },
artwork_loaded: function () { artwork_loaded() {
this.artwork_visible = true this.artwork_visible = true
}, },
artwork_error: function () { artwork_error() {
this.artwork_visible = false this.artwork_visible = false
} }
} }

View File

@ -83,22 +83,22 @@ export default {
emits: ['close'], emits: ['close'],
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_uri(this.artist.uri, false) webapi.player_play_uri(this.artist.uri, false)
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_add(this.artist.uri) webapi.queue_add(this.artist.uri)
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_add_next(this.artist.uri) webapi.queue_add_next(this.artist.uri)
}, },
open_artist: function () { open_artist() {
this.$router.push({ path: '/music/spotify/artists/' + this.artist.id }) this.$router.push({ path: '/music/spotify/artists/' + this.artist.id })
} }
} }

View File

@ -88,22 +88,22 @@ export default {
emits: ['close'], emits: ['close'],
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_uri(this.playlist.uri, false) webapi.player_play_uri(this.playlist.uri, false)
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_add(this.playlist.uri) webapi.queue_add(this.playlist.uri)
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_add_next(this.playlist.uri) webapi.queue_add_next(this.playlist.uri)
}, },
open_playlist: function () { open_playlist() {
this.$router.push({ this.$router.push({
path: '/music/spotify/playlists/' + this.playlist.id path: '/music/spotify/playlists/' + this.playlist.id
}) })

View File

@ -118,26 +118,26 @@ export default {
emits: ['close'], emits: ['close'],
methods: { methods: {
play: function () { play() {
this.$emit('close') this.$emit('close')
webapi.player_play_uri(this.track.uri, false) webapi.player_play_uri(this.track.uri, false)
}, },
queue_add: function () { queue_add() {
this.$emit('close') this.$emit('close')
webapi.queue_add(this.track.uri) webapi.queue_add(this.track.uri)
}, },
queue_add_next: function () { queue_add_next() {
this.$emit('close') this.$emit('close')
webapi.queue_add_next(this.track.uri) webapi.queue_add_next(this.track.uri)
}, },
open_album: function () { open_album() {
this.$router.push({ path: '/music/spotify/albums/' + this.album.id }) this.$router.push({ path: '/music/spotify/albums/' + this.album.id })
}, },
open_artist: function () { open_artist() {
this.$router.push({ this.$router.push({
path: '/music/spotify/artists/' + this.album.artists[0].id path: '/music/spotify/artists/' + this.album.artists[0].id
}) })

View File

@ -50,7 +50,7 @@ export default {
return this.$store.state.spotify.webapi_token_valid return this.$store.state.spotify.webapi_token_valid
}, },
route_query: function () { route_query() {
if (!this.query) { if (!this.query) {
return null return null
} }
@ -65,7 +65,7 @@ export default {
}, },
methods: { methods: {
search_library: function () { search_library() {
this.$store.commit(types.SEARCH_PATH, '/search/library') this.$store.commit(types.SEARCH_PATH, '/search/library')
this.$router.push({ this.$router.push({
path: this.$store.state.search_path, 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.$store.commit(types.SEARCH_PATH, '/search/spotify')
this.$router.push({ this.$router.push({
path: this.$store.state.search_path, path: this.$store.state.search_path,

View File

@ -4,7 +4,7 @@ import i18n from '@/i18n'
const { t, locale } = i18n.global const { t, locale } = i18n.global
export const filters = { export const filters = {
durationInHours: function (value_ms) { durationInHours(value_ms) {
const seconds = Math.floor(value_ms / 1000) const seconds = Math.floor(value_ms / 1000)
if (seconds > 3600) { if (seconds > 3600) {
return Duration.fromObject({ seconds: seconds }) return Duration.fromObject({ seconds: seconds })
@ -16,7 +16,7 @@ export const filters = {
.toFormat('mm:ss') .toFormat('mm:ss')
}, },
durationInDays: function (value_ms) { durationInDays(value_ms) {
const minutes = Math.floor(value_ms / 60000) const minutes = Math.floor(value_ms / 60000)
if (minutes > 1440) { if (minutes > 1440) {
// 60 * 24 // 60 * 24
@ -33,29 +33,29 @@ export const filters = {
.toHuman() .toHuman()
}, },
date: function (value) { date(value) {
return DateTime.fromISO(value) return DateTime.fromISO(value)
.setLocale(locale.value) .setLocale(locale.value)
.toLocaleString(DateTime.DATE_FULL) .toLocaleString(DateTime.DATE_FULL)
}, },
datetime: function (value) { datetime(value) {
return DateTime.fromISO(value) return DateTime.fromISO(value)
.setLocale(locale.value) .setLocale(locale.value)
.toLocaleString(DateTime.DATETIME_MED) .toLocaleString(DateTime.DATETIME_MED)
}, },
timeFromNow: function (value) { timeFromNow(value) {
var diff = DateTime.now().diff(DateTime.fromISO(value)) const diff = DateTime.now().diff(DateTime.fromISO(value))
return this.durationInDays(diff.as('milliseconds')) return this.durationInDays(diff.as('milliseconds'))
}, },
number: function (value) { number(value) {
return value.toLocaleString(locale.value) return value.toLocaleString(locale.value)
}, },
channels: function (value) { channels(value) {
if (value === 1) { if (value === 1) {
return t('filter.mono') return t('filter.mono')
} }

View File

@ -51,14 +51,14 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_album(to.params.album_id), webapi.library_album(to.params.album_id),
webapi.library_album_tracks(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.album = response[0].data
vm.tracks = new GroupByList(response[1].data) vm.tracks = new GroupByList(response[1].data)
} }
@ -90,12 +90,12 @@ export default {
}, },
methods: { methods: {
open_artist: function () { open_artist() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ path: '/music/artists/' + this.album.artist_id }) this.$router.push({ path: '/music/artists/' + this.album.artist_id })
}, },
play: function () { play() {
webapi.player_play_uri(this.album.uri, true) webapi.player_play_uri(this.album.uri, true)
} }
} }

View File

@ -80,14 +80,14 @@ import ListAlbums from '@/components/ListAlbums.vue'
import DropdownMenu from '@/components/DropdownMenu.vue' import DropdownMenu from '@/components/DropdownMenu.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { byName, byYear, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName, byYear } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return webapi.library_albums('music') return webapi.library_albums('music')
}, },
set: function (vm, response) { set(vm, response) {
vm.albums_list = new GroupByList(response.data) vm.albums_list = new GroupByList(response.data)
} }
} }

View File

@ -61,17 +61,17 @@ import ModalDialogArtist from '@/components/ModalDialogArtist.vue'
import DropdownMenu from '@/components/DropdownMenu.vue' import DropdownMenu from '@/components/DropdownMenu.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { byName, byYear, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName, byYear } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_artist(to.params.artist_id), webapi.library_artist(to.params.artist_id),
webapi.library_artist_albums(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.artist = response[0].data
vm.albums_list = new GroupByList(response[1].data) vm.albums_list = new GroupByList(response[1].data)
} }
@ -142,13 +142,13 @@ export default {
}, },
methods: { methods: {
open_tracks: function () { open_tracks() {
this.$router.push({ this.$router.push({
path: '/music/artists/' + this.artist.id + '/tracks' path: '/music/artists/' + this.artist.id + '/tracks'
}) })
}, },
play: function () { play() {
webapi.player_play_uri( webapi.player_play_uri(
this.albums.items.map((a) => a.uri).join(','), this.albums.items.map((a) => a.uri).join(','),
true true

View File

@ -71,17 +71,17 @@ import ListTracks from '@/components/ListTracks.vue'
import ModalDialogArtist from '@/components/ModalDialogArtist.vue' import ModalDialogArtist from '@/components/ModalDialogArtist.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { byName, byRating, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName, byRating } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_artist(to.params.artist_id), webapi.library_artist(to.params.artist_id),
webapi.library_artist_tracks(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.artist = response[0].data
vm.tracks_list = new GroupByList(response[1].data.tracks) vm.tracks_list = new GroupByList(response[1].data.tracks)
} }
@ -154,12 +154,12 @@ export default {
}, },
methods: { methods: {
open_artist: function () { open_artist() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ path: '/music/artists/' + this.artist.id }) 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) webapi.player_play_uri(this.tracks_list.map((a) => a.uri).join(','), true)
} }
} }

View File

@ -80,14 +80,14 @@ import ListArtists from '@/components/ListArtists.vue'
import DropdownMenu from '@/components/DropdownMenu.vue' import DropdownMenu from '@/components/DropdownMenu.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { byName, byYear, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName, byYear } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return webapi.library_artists('music') return webapi.library_artists('music')
}, },
set: function (vm, response) { set(vm, response) {
vm.artists_list = new GroupByList(response.data) vm.artists_list = new GroupByList(response.data)
} }
} }

View File

@ -54,14 +54,14 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_album(to.params.album_id), webapi.library_album(to.params.album_id),
webapi.library_album_tracks(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.album = response[0].data
vm.tracks = new GroupByList(response[1].data) vm.tracks = new GroupByList(response[1].data)
} }
@ -93,12 +93,12 @@ export default {
}, },
methods: { methods: {
open_artist: function () { open_artist() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ path: '/audiobooks/artists/' + this.album.artist_id }) this.$router.push({ path: '/audiobooks/artists/' + this.album.artist_id })
}, },
play: function () { play() {
webapi.player_play_uri(this.album.uri, false) webapi.player_play_uri(this.album.uri, false)
} }
} }

View File

@ -25,14 +25,14 @@ import IndexButtonList from '@/components/IndexButtonList.vue'
import ContentWithHeading from '@/templates/ContentWithHeading.vue' import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ListAlbums from '@/components/ListAlbums.vue' import ListAlbums from '@/components/ListAlbums.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import { byName, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return webapi.library_albums('audiobook') return webapi.library_albums('audiobook')
}, },
set: function (vm, response) { set(vm, response) {
vm.albums = new GroupByList(response.data) vm.albums = new GroupByList(response.data)
vm.albums.group(byName('name_sort', true)) vm.albums.group(byName('name_sort', true))
} }

View File

@ -44,14 +44,14 @@ import webapi from '@/webapi'
import { GroupByList } from '../lib/GroupByList' import { GroupByList } from '../lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_artist(to.params.artist_id), webapi.library_artist(to.params.artist_id),
webapi.library_artist_albums(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.artist = response[0].data
vm.albums = new GroupByList(response[1].data) vm.albums = new GroupByList(response[1].data)
} }
@ -89,7 +89,7 @@ export default {
}, },
methods: { methods: {
play: function () { play() {
webapi.player_play_uri( webapi.player_play_uri(
this.albums.items.map((a) => a.uri).join(','), this.albums.items.map((a) => a.uri).join(','),
false false

View File

@ -26,14 +26,14 @@ import TabsAudiobooks from '@/components/TabsAudiobooks.vue'
import IndexButtonList from '@/components/IndexButtonList.vue' import IndexButtonList from '@/components/IndexButtonList.vue'
import ListArtists from '@/components/ListArtists.vue' import ListArtists from '@/components/ListArtists.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import { byName, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return webapi.library_artists('audiobook') return webapi.library_artists('audiobook')
}, },
set: function (vm, response) { set(vm, response) {
vm.artists_list = new GroupByList(response.data) vm.artists_list = new GroupByList(response.data)
} }
} }

View File

@ -58,7 +58,7 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.search({ webapi.search({
type: 'album', 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_added = new GroupByList(response[0].data.albums)
vm.recently_played = new GroupByList(response[1].data.tracks) vm.recently_played = new GroupByList(response[1].data.tracks)
} }
@ -110,7 +110,7 @@ export default {
}, },
methods: { methods: {
open_browse: function (type) { open_browse(type) {
this.$router.push({ path: '/music/browse/' + type }) this.$router.push({ path: '/music/browse/' + type })
} }
} }

View File

@ -19,10 +19,10 @@ import TabsMusic from '@/components/TabsMusic.vue'
import ListAlbums from '@/components/ListAlbums.vue' import ListAlbums from '@/components/ListAlbums.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import store from '@/store' import store from '@/store'
import { byDateSinceToday, GroupByList } from '@/lib/GroupByList' import { GroupByList, byDateSinceToday } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
const limit = store.getters.settings_option_recently_added_limit const limit = store.getters.settings_option_recently_added_limit
return webapi.search({ return webapi.search({
type: 'album', 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 = new GroupByList(response.data.albums)
vm.recently_added.group( vm.recently_added.group(
byDateSinceToday('time_added', { byDateSinceToday('time_added', {

View File

@ -24,7 +24,7 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return webapi.search({ return webapi.search({
type: 'track', type: 'track',
expression: expression:
@ -33,7 +33,7 @@ const dataObject = {
}) })
}, },
set: function (vm, response) { set(vm, response) {
vm.recently_played = new GroupByList(response.data.tracks) vm.recently_played = new GroupByList(response.data.tracks)
} }
} }

View File

@ -55,14 +55,14 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_composer(to.params.composer), webapi.library_composer(to.params.composer),
webapi.library_composer_albums(to.params.composer) webapi.library_composer_albums(to.params.composer)
]) ])
}, },
set: function (vm, response) { set(vm, response) {
vm.composer = response[0].data vm.composer = response[0].data
vm.albums_list = new GroupByList(response[1].data.albums) vm.albums_list = new GroupByList(response[1].data.albums)
} }
@ -98,14 +98,14 @@ export default {
}, },
methods: { methods: {
open_tracks: function () { open_tracks() {
this.$router.push({ this.$router.push({
name: 'ComposerTracks', name: 'ComposerTracks',
params: { composer: this.composer.name } params: { composer: this.composer.name }
}) })
}, },
play: function () { play() {
webapi.player_play_expression( webapi.player_play_expression(
'composer is "' + this.composer.name + '" and media_kind is music', 'composer is "' + this.composer.name + '" and media_kind is music',
true true

View File

@ -73,17 +73,17 @@ import ListTracks from '@/components/ListTracks.vue'
import ModalDialogComposer from '@/components/ModalDialogComposer.vue' import ModalDialogComposer from '@/components/ModalDialogComposer.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { byName, byRating, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName, byRating } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_composer(to.params.composer), webapi.library_composer(to.params.composer),
webapi.library_composer_tracks(to.params.composer) webapi.library_composer_tracks(to.params.composer)
]) ])
}, },
set: function (vm, response) { set(vm, response) {
vm.composer = response[0].data vm.composer = response[0].data
vm.tracks_list = new GroupByList(response[1].data.tracks) vm.tracks_list = new GroupByList(response[1].data.tracks)
} }
@ -156,7 +156,7 @@ export default {
}, },
methods: { methods: {
open_albums: function () { open_albums() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ this.$router.push({
name: 'ComposerAlbums', name: 'ComposerAlbums',
@ -164,7 +164,7 @@ export default {
}) })
}, },
play: function () { play() {
webapi.player_play_expression(this.expression, true) webapi.player_play_expression(this.expression, true)
} }
} }

View File

@ -25,14 +25,14 @@ import TabsMusic from '@/components/TabsMusic.vue'
import IndexButtonList from '@/components/IndexButtonList.vue' import IndexButtonList from '@/components/IndexButtonList.vue'
import ListComposers from '@/components/ListComposers.vue' import ListComposers from '@/components/ListComposers.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import { byName, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return webapi.library_composers('music') return webapi.library_composers('music')
}, },
set: function (vm, response) { set(vm, response) {
vm.composers = new GroupByList(response.data) vm.composers = new GroupByList(response.data)
vm.composers.group(byName('name_sort')) vm.composers.group(byName('name_sort'))
} }

View File

@ -49,14 +49,14 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
if (to.query.directory) { if (to.query.directory) {
return webapi.library_files(to.query.directory) return webapi.library_files(to.query.directory)
} }
return Promise.resolve() return Promise.resolve()
}, },
set: function (vm, response) { set(vm, response) {
if (response) { if (response) {
vm.dirs = response.data.directories vm.dirs = response.data.directories
vm.playlists = new GroupByList(response.data.playlists) vm.playlists = new GroupByList(response.data.playlists)
@ -119,7 +119,7 @@ export default {
}, },
methods: { methods: {
play: function () { play() {
webapi.player_play_expression(this.play_expression, false) webapi.player_play_expression(this.play_expression, false)
} }
} }

View File

@ -52,17 +52,17 @@ import IndexButtonList from '@/components/IndexButtonList.vue'
import ListAlbums from '@/components/ListAlbums.vue' import ListAlbums from '@/components/ListAlbums.vue'
import ModalDialogGenre from '@/components/ModalDialogGenre.vue' import ModalDialogGenre from '@/components/ModalDialogGenre.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import { byName, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_genre(to.params.genre), webapi.library_genre(to.params.genre),
webapi.library_genre_albums(to.params.genre) webapi.library_genre_albums(to.params.genre)
]) ])
}, },
set: function (vm, response) { set(vm, response) {
vm.genre = response[0].data vm.genre = response[0].data
vm.albums_list = new GroupByList(response[1].data.albums) vm.albums_list = new GroupByList(response[1].data.albums)
vm.albums_list.group(byName('name_sort', true)) vm.albums_list.group(byName('name_sort', true))
@ -105,7 +105,7 @@ export default {
}, },
methods: { methods: {
open_tracks: function () { open_tracks() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ this.$router.push({
name: 'GenreTracks', name: 'GenreTracks',
@ -113,7 +113,7 @@ export default {
}) })
}, },
play: function () { play() {
webapi.player_play_expression( webapi.player_play_expression(
'genre is "' + this.genre.name + '" and media_kind is music', 'genre is "' + this.genre.name + '" and media_kind is music',
true true

View File

@ -67,17 +67,17 @@ import ListTracks from '@/components/ListTracks.vue'
import ModalDialogGenre from '@/components/ModalDialogGenre.vue' import ModalDialogGenre from '@/components/ModalDialogGenre.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import * as types from '@/store/mutation_types' import * as types from '@/store/mutation_types'
import { byName, byRating, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName, byRating } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_genre(to.params.genre), webapi.library_genre(to.params.genre),
webapi.library_genre_tracks(to.params.genre) webapi.library_genre_tracks(to.params.genre)
]) ])
}, },
set: function (vm, response) { set(vm, response) {
vm.genre = response[0].data vm.genre = response[0].data
vm.tracks_list = new GroupByList(response[1].data.tracks) vm.tracks_list = new GroupByList(response[1].data.tracks)
} }
@ -150,12 +150,12 @@ export default {
}, },
methods: { methods: {
open_genre: function () { open_genre() {
this.show_details_modal = false this.show_details_modal = false
this.$router.push({ name: 'Genre', params: { genre: this.genre.name } }) this.$router.push({ name: 'Genre', params: { genre: this.genre.name } })
}, },
play: function () { play() {
webapi.player_play_expression(this.expression, true) webapi.player_play_expression(this.expression, true)
} }
} }

View File

@ -25,14 +25,14 @@ import TabsMusic from '@/components/TabsMusic.vue'
import IndexButtonList from '@/components/IndexButtonList.vue' import IndexButtonList from '@/components/IndexButtonList.vue'
import ListGenres from '@/components/ListGenres.vue' import ListGenres from '@/components/ListGenres.vue'
import webapi from '@/webapi' import webapi from '@/webapi'
import { byName, GroupByList } from '@/lib/GroupByList' import { GroupByList, byName } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return webapi.library_genres('music') return webapi.library_genres('music')
}, },
set: function (vm, response) { set(vm, response) {
vm.genres = response.data vm.genres = response.data
vm.genres = new GroupByList(response.data) vm.genres = new GroupByList(response.data)
vm.genres.group(byName('name_sort')) vm.genres.group(byName('name_sort'))

View File

@ -161,7 +161,7 @@ export default {
} }
}, },
mounted: function () {}, mounted() {},
created() { created() {
this.item_progress_ms = this.state.item_progress_ms this.item_progress_ms = this.state.item_progress_ms
@ -181,27 +181,27 @@ export default {
}, },
methods: { methods: {
tick: function () { tick() {
if (!this.is_dragged) { if (!this.is_dragged) {
this.item_progress_ms += 1000 this.item_progress_ms += 1000
} }
}, },
start_dragging: function () { start_dragging() {
this.is_dragged = true this.is_dragged = true
}, },
end_dragging: function () { end_dragging() {
this.is_dragged = false this.is_dragged = false
}, },
seek: function (newPosition) { seek(newPosition) {
webapi.player_seek_to_pos(newPosition).catch(() => { webapi.player_seek_to_pos(newPosition).catch(() => {
this.item_progress_ms = this.state.item_progress_ms this.item_progress_ms = this.state.item_progress_ms
}) })
}, },
open_dialog: function (item) { open_dialog(item) {
this.selected_item = item this.selected_item = item
this.show_details_modal = true this.show_details_modal = true
} }

View File

@ -41,14 +41,14 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_playlist(to.params.playlist_id), webapi.library_playlist(to.params.playlist_id),
webapi.library_playlist_tracks(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.playlist = response[0].data
vm.tracks = new GroupByList(response[1].data) vm.tracks = new GroupByList(response[1].data)
} }
@ -89,7 +89,7 @@ export default {
}, },
methods: { methods: {
play: function () { play() {
webapi.player_play_uri(this.uris, true) webapi.player_play_uri(this.uris, true)
} }
} }

View File

@ -20,14 +20,14 @@ import webapi from '@/webapi'
import { GroupByList, noop } from '@/lib/GroupByList' import { GroupByList, noop } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_playlist(to.params.playlist_id), webapi.library_playlist(to.params.playlist_id),
webapi.library_playlist_folder(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.playlist = response[0].data
vm.playlists_list = new GroupByList(response[1].data) vm.playlists_list = new GroupByList(response[1].data)
} }

View File

@ -64,14 +64,14 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_album(to.params.album_id), webapi.library_album(to.params.album_id),
webapi.library_podcast_episodes(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.album = response[0].data
vm.tracks = new GroupByList(response[1].data.tracks) vm.tracks = new GroupByList(response[1].data.tracks)
} }
@ -116,11 +116,11 @@ export default {
}, },
methods: { methods: {
play: function () { play() {
webapi.player_play_uri(this.album.uri, false) webapi.player_play_uri(this.album.uri, false)
}, },
open_remove_podcast_dialog: function () { open_remove_podcast_dialog() {
webapi webapi
.library_track_playlists(this.tracks.items[0].id) .library_track_playlists(this.tracks.items[0].id)
.then(({ data }) => { .then(({ data }) => {
@ -132,7 +132,7 @@ export default {
}) })
}, },
remove_podcast: function () { remove_podcast() {
this.show_remove_podcast_modal = false this.show_remove_podcast_modal = false
webapi webapi
.library_playlist_delete(this.rss_playlist_to_remove.id) .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 }) => { webapi.library_podcast_episodes(this.album.id).then(({ data }) => {
this.tracks = new GroupByList(data.tracks) this.tracks = new GroupByList(data.tracks)
}) })

View File

@ -66,14 +66,14 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return Promise.all([ return Promise.all([
webapi.library_albums('podcast'), webapi.library_albums('podcast'),
webapi.library_podcasts_new_episodes() webapi.library_podcasts_new_episodes()
]) ])
}, },
set: function (vm, response) { set(vm, response) {
vm.albums = new GroupByList(response[0].data) vm.albums = new GroupByList(response[0].data)
vm.new_episodes = new GroupByList(response[1].data.tracks) vm.new_episodes = new GroupByList(response[1].data.tracks)
} }
@ -118,31 +118,31 @@ export default {
}, },
methods: { methods: {
mark_all_played: function () { mark_all_played() {
this.new_episodes.items.forEach((ep) => { this.new_episodes.items.forEach((ep) => {
webapi.library_track_update(ep.id, { play_count: 'increment' }) webapi.library_track_update(ep.id, { play_count: 'increment' })
}) })
this.new_episodes.items = {} this.new_episodes.items = {}
}, },
open_add_podcast_dialog: function (item) { open_add_podcast_dialog(item) {
this.show_url_modal = true this.show_url_modal = true
}, },
reload_new_episodes: function () { reload_new_episodes() {
webapi.library_podcasts_new_episodes().then(({ data }) => { webapi.library_podcasts_new_episodes().then(({ data }) => {
this.new_episodes = new GroupByList(data.tracks) this.new_episodes = new GroupByList(data.tracks)
}) })
}, },
reload_podcasts: function () { reload_podcasts() {
webapi.library_albums('podcast').then(({ data }) => { webapi.library_albums('podcast').then(({ data }) => {
this.albums = new GroupByList(data) this.albums = new GroupByList(data)
this.reload_new_episodes() this.reload_new_episodes()
}) })
}, },
update_rss: function () { update_rss() {
this.$store.commit(types.UPDATE_DIALOG_SCAN_KIND, 'rss') this.$store.commit(types.UPDATE_DIALOG_SCAN_KIND, 'rss')
this.$store.commit(types.SHOW_UPDATE_DIALOG, true) this.$store.commit(types.SHOW_UPDATE_DIALOG, true)
} }

View File

@ -162,19 +162,19 @@ export default {
}, },
methods: { methods: {
queue_clear: function () { queue_clear() {
webapi.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) this.$store.commit(types.SHOW_ONLY_NEXT_ITEMS, !this.show_only_next_items)
}, },
remove: function (item) { remove(item) {
webapi.queue_remove(item.id) webapi.queue_remove(item.id)
}, },
move_item: function (e) { move_item(e) {
const oldPosition = !this.show_only_next_items const oldPosition = !this.show_only_next_items
? e.oldIndex ? e.oldIndex
: e.oldIndex + this.current_position : e.oldIndex + this.current_position
@ -185,16 +185,16 @@ export default {
} }
}, },
open_dialog: function (item) { open_dialog(item) {
this.selected_item = item this.selected_item = item
this.show_details_modal = true this.show_details_modal = true
}, },
open_add_stream_dialog: function (item) { open_add_stream_dialog(item) {
this.show_url_modal = true this.show_url_modal = true
}, },
save_dialog: function (item) { save_dialog(item) {
if (this.queue_items.length > 0) { if (this.queue_items.length > 0) {
this.show_pls_save_modal = true this.show_pls_save_modal = true
} }

View File

@ -22,11 +22,11 @@ import webapi from '@/webapi'
import { GroupByList } from '@/lib/GroupByList' import { GroupByList } from '@/lib/GroupByList'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
return webapi.library_radio_streams() return webapi.library_radio_streams()
}, },
set: function (vm, response) { set(vm, response) {
vm.tracks = new GroupByList(response.data.tracks) vm.tracks = new GroupByList(response.data.tracks)
} }
} }

View File

@ -345,13 +345,6 @@ export default {
}, },
show_all_podcasts_button() { show_all_podcasts_button() {
return this.podcasts.total > this.podcasts.items.length 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) this.search(this.$route)
}, },
methods: { methods: {
search: function (route) { search(route) {
if (!route.query.query || route.query.query === '') { if (!route.query.query || route.query.query === '') {
this.search_query = '' this.search_query = ''
this.$refs.search_field.focus() this.$refs.search_field.focus()
@ -380,7 +373,7 @@ export default {
this.$store.commit(types.ADD_RECENT_SEARCH, route.query.query) this.$store.commit(types.ADD_RECENT_SEARCH, route.query.query)
}, },
searchMusic: function (query) { searchMusic(query) {
if ( if (
query.type.indexOf('track') < 0 && query.type.indexOf('track') < 0 &&
query.type.indexOf('artist') < 0 && query.type.indexOf('artist') < 0 &&
@ -415,7 +408,7 @@ export default {
}) })
}, },
searchAudiobooks: function (query) { searchAudiobooks(query) {
if (query.type.indexOf('audiobook') < 0) { if (query.type.indexOf('audiobook') < 0) {
return return
} }
@ -446,7 +439,7 @@ export default {
}) })
}, },
searchPodcasts: function (query) { searchPodcasts(query) {
if (query.type.indexOf('podcast') < 0) { if (query.type.indexOf('podcast') < 0) {
return return
} }
@ -477,7 +470,7 @@ export default {
}) })
}, },
new_search: function () { new_search() {
if (!this.search_query) { if (!this.search_query) {
return return
} }
@ -494,7 +487,7 @@ export default {
this.$refs.search_field.blur() this.$refs.search_field.blur()
}, },
open_search_tracks: function () { open_search_tracks() {
this.$router.push({ this.$router.push({
path: '/search/library', path: '/search/library',
query: { query: {
@ -504,7 +497,7 @@ export default {
}) })
}, },
open_search_artists: function () { open_search_artists() {
this.$router.push({ this.$router.push({
path: '/search/library', path: '/search/library',
query: { query: {
@ -514,7 +507,7 @@ export default {
}) })
}, },
open_search_albums: function () { open_search_albums() {
this.$router.push({ this.$router.push({
path: '/search/library', path: '/search/library',
query: { query: {
@ -524,7 +517,7 @@ export default {
}) })
}, },
open_search_composers: function () { open_search_composers() {
this.$router.push({ this.$router.push({
path: '/search/library', path: '/search/library',
query: { query: {
@ -534,7 +527,7 @@ export default {
}) })
}, },
open_search_playlists: function () { open_search_playlists() {
this.$router.push({ this.$router.push({
path: '/search/library', path: '/search/library',
query: { query: {
@ -544,7 +537,7 @@ export default {
}) })
}, },
open_search_audiobooks: function () { open_search_audiobooks() {
this.$router.push({ this.$router.push({
path: '/search/library', path: '/search/library',
query: { query: {
@ -554,7 +547,7 @@ export default {
}) })
}, },
open_search_podcasts: function () { open_search_podcasts() {
this.$router.push({ this.$router.push({
path: '/search/library', path: '/search/library',
query: { query: {
@ -564,43 +557,43 @@ export default {
}) })
}, },
open_composer: function (composer) { open_composer(composer) {
this.$router.push({ this.$router.push({
name: 'ComposerAlbums', name: 'ComposerAlbums',
params: { composer: composer.name } params: { composer: composer.name }
}) })
}, },
open_playlist: function (playlist) { open_playlist(playlist) {
this.$router.push({ path: '/playlists/' + playlist.id + '/tracks' }) this.$router.push({ path: '/playlists/' + playlist.id + '/tracks' })
}, },
open_recent_search: function (query) { open_recent_search(query) {
this.search_query = query this.search_query = query
this.new_search() this.new_search()
}, },
open_track_dialog: function (track) { open_track_dialog(track) {
this.selected_track = track this.selected_track = track
this.show_track_details_modal = true this.show_track_details_modal = true
}, },
open_album_dialog: function (album) { open_album_dialog(album) {
this.selected_album = album this.selected_album = album
this.show_album_details_modal = true this.show_album_details_modal = true
}, },
open_artist_dialog: function (artist) { open_artist_dialog(artist) {
this.selected_artist = artist this.selected_artist = artist
this.show_artist_details_modal = true this.show_artist_details_modal = true
}, },
open_composer_dialog: function (composer) { open_composer_dialog(composer) {
this.selected_composer = composer this.selected_composer = composer
this.show_composer_details_modal = true this.show_composer_details_modal = true
}, },
open_playlist_dialog: function (playlist) { open_playlist_dialog(playlist) {
this.selected_playlist = playlist this.selected_playlist = playlist
this.show_playlist_details_modal = true this.show_playlist_details_modal = true
} }

View File

@ -80,7 +80,7 @@ import webapi from '@/webapi'
import SpotifyWebApi from 'spotify-web-api-js' import SpotifyWebApi from 'spotify-web-api-js'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
const spotifyApi = new SpotifyWebApi() const spotifyApi = new SpotifyWebApi()
spotifyApi.setAccessToken(store.state.spotify.webapi_token) spotifyApi.setAccessToken(store.state.spotify.webapi_token)
return spotifyApi.getAlbum(to.params.album_id, { return spotifyApi.getAlbum(to.params.album_id, {
@ -88,7 +88,7 @@ const dataObject = {
}) })
}, },
set: function (vm, response) { set(vm, response) {
vm.album = response vm.album = response
} }
} }
@ -128,7 +128,7 @@ export default {
}, },
computed: { computed: {
artwork_url: function () { artwork_url() {
if (this.album.images && this.album.images.length > 0) { if (this.album.images && this.album.images.length > 0) {
return this.album.images[0].url return this.album.images[0].url
} }
@ -137,18 +137,18 @@ export default {
}, },
methods: { methods: {
open_artist: function () { open_artist() {
this.$router.push({ this.$router.push({
path: '/music/spotify/artists/' + this.album.artists[0].id path: '/music/spotify/artists/' + this.album.artists[0].id
}) })
}, },
play: function () { play() {
this.show_details_modal = false this.show_details_modal = false
webapi.player_play_uri(this.album.uri, true) webapi.player_play_uri(this.album.uri, true)
}, },
open_track_dialog: function (track) { open_track_dialog(track) {
this.selected_track = track this.selected_track = track
this.show_track_details_modal = true this.show_track_details_modal = true
} }

View File

@ -91,7 +91,7 @@ const dataObject = {
]) ])
}, },
set: function (vm, response) { set(vm, response) {
vm.artist = response[0] vm.artist = response[0]
vm.albums = [] vm.albums = []
@ -149,7 +149,7 @@ export default {
}, },
methods: { methods: {
load_next: function ({ loaded }) { load_next({ loaded }) {
const spotifyApi = new SpotifyWebApi() const spotifyApi = new SpotifyWebApi()
spotifyApi.setAccessToken(this.$store.state.spotify.webapi_token) spotifyApi.setAccessToken(this.$store.state.spotify.webapi_token)
spotifyApi spotifyApi
@ -164,27 +164,27 @@ export default {
}) })
}, },
append_albums: function (data) { append_albums(data) {
this.albums = this.albums.concat(data.items) this.albums = this.albums.concat(data.items)
this.total = data.total this.total = data.total
this.offset += data.limit this.offset += data.limit
}, },
play: function () { play() {
this.show_details_modal = false this.show_details_modal = false
webapi.player_play_uri(this.artist.uri, true) webapi.player_play_uri(this.artist.uri, true)
}, },
open_album: function (album) { open_album(album) {
this.$router.push({ path: '/music/spotify/albums/' + album.id }) this.$router.push({ path: '/music/spotify/albums/' + album.id })
}, },
open_dialog: function (album) { open_dialog(album) {
this.selected_album = album this.selected_album = album
this.show_details_modal = true this.show_details_modal = true
}, },
artwork_url: function (album) { artwork_url(album) {
if (album.images && album.images.length > 0) { if (album.images && album.images.length > 0) {
return album.images[0].url return album.images[0].url
} }

View File

@ -105,7 +105,7 @@ import * as types from '@/store/mutation_types'
import SpotifyWebApi from 'spotify-web-api-js' import SpotifyWebApi from 'spotify-web-api-js'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
if ( if (
store.state.spotify_new_releases.length > 0 && store.state.spotify_new_releases.length > 0 &&
store.state.spotify_featured_playlists.length > 0 store.state.spotify_featured_playlists.length > 0
@ -127,7 +127,7 @@ const dataObject = {
]) ])
}, },
set: function (vm, response) { set(vm, response) {
if (response) { if (response) {
store.commit(types.SPOTIFY_NEW_RELEASES, response[0].albums.items) store.commit(types.SPOTIFY_NEW_RELEASES, response[0].albums.items)
store.commit( store.commit(
@ -191,21 +191,21 @@ export default {
}, },
methods: { methods: {
open_album: function (album) { open_album(album) {
this.$router.push({ path: '/music/spotify/albums/' + album.id }) this.$router.push({ path: '/music/spotify/albums/' + album.id })
}, },
open_album_dialog: function (album) { open_album_dialog(album) {
this.selected_album = album this.selected_album = album
this.show_album_details_modal = true this.show_album_details_modal = true
}, },
open_playlist_dialog: function (playlist) { open_playlist_dialog(playlist) {
this.selected_playlist = playlist this.selected_playlist = playlist
this.show_playlist_details_modal = true this.show_playlist_details_modal = true
}, },
artwork_url: function (album) { artwork_url(album) {
if (album.images && album.images.length > 0) { if (album.images && album.images.length > 0) {
return album.images[0].url return album.images[0].url
} }

View File

@ -39,7 +39,7 @@ import * as types from '@/store/mutation_types'
import SpotifyWebApi from 'spotify-web-api-js' import SpotifyWebApi from 'spotify-web-api-js'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
if (store.state.spotify_featured_playlists.length > 0) { if (store.state.spotify_featured_playlists.length > 0) {
return Promise.resolve() return Promise.resolve()
} }
@ -52,7 +52,7 @@ const dataObject = {
}) })
}, },
set: function (vm, response) { set(vm, response) {
if (response) { if (response) {
store.commit(types.SPOTIFY_FEATURED_PLAYLISTS, response.playlists.items) store.commit(types.SPOTIFY_FEATURED_PLAYLISTS, response.playlists.items)
} }
@ -95,7 +95,7 @@ export default {
}, },
methods: { methods: {
open_playlist_dialog: function (playlist) { open_playlist_dialog(playlist) {
this.selected_playlist = playlist this.selected_playlist = playlist
this.show_playlist_details_modal = true this.show_playlist_details_modal = true
} }

View File

@ -51,7 +51,7 @@ import * as types from '@/store/mutation_types'
import SpotifyWebApi from 'spotify-web-api-js' import SpotifyWebApi from 'spotify-web-api-js'
const dataObject = { const dataObject = {
load: function (to) { load(to) {
if (store.state.spotify_new_releases.length > 0) { if (store.state.spotify_new_releases.length > 0) {
return Promise.resolve() return Promise.resolve()
} }
@ -64,7 +64,7 @@ const dataObject = {
}) })
}, },
set: function (vm, response) { set(vm, response) {
if (response) { if (response) {
store.commit(types.SPOTIFY_NEW_RELEASES, response.albums.items) store.commit(types.SPOTIFY_NEW_RELEASES, response.albums.items)
} }
@ -115,16 +115,16 @@ export default {
}, },
methods: { methods: {
open_album: function (album) { open_album(album) {
this.$router.push({ path: '/music/spotify/albums/' + album.id }) this.$router.push({ path: '/music/spotify/albums/' + album.id })
}, },
open_album_dialog: function (album) { open_album_dialog(album) {
this.selected_album = album this.selected_album = album
this.show_album_details_modal = true this.show_album_details_modal = true
}, },
artwork_url: function (album) { artwork_url(album) {
if (album.images && album.images.length > 0) { if (album.images && album.images.length > 0) {
return album.images[0].url return album.images[0].url
} }

View File

@ -83,7 +83,7 @@ const dataObject = {
]) ])
}, },
set: function (vm, response) { set(vm, response) {
vm.playlist = response[0] vm.playlist = response[0]
vm.tracks = [] vm.tracks = []
vm.total = 0 vm.total = 0
@ -130,7 +130,7 @@ export default {
}, },
methods: { methods: {
load_next: function ({ loaded }) { load_next({ loaded }) {
const spotifyApi = new SpotifyWebApi() const spotifyApi = new SpotifyWebApi()
spotifyApi.setAccessToken(this.$store.state.spotify.webapi_token) spotifyApi.setAccessToken(this.$store.state.spotify.webapi_token)
spotifyApi spotifyApi
@ -144,18 +144,18 @@ export default {
}) })
}, },
append_tracks: function (data) { append_tracks(data) {
this.tracks = this.tracks.concat(data.items) this.tracks = this.tracks.concat(data.items)
this.total = data.total this.total = data.total
this.offset += data.limit this.offset += data.limit
}, },
play: function () { play() {
this.show_details_modal = false this.show_details_modal = false
webapi.player_play_uri(this.playlist.uri, true) webapi.player_play_uri(this.playlist.uri, true)
}, },
open_track_dialog: function (track) { open_track_dialog(track) {
this.selected_track = track this.selected_track = track
this.show_track_details_modal = true this.show_track_details_modal = true
} }

View File

@ -379,20 +379,20 @@ export default {
} }
}, },
mounted: function () { mounted() {
this.query = this.$route.query this.query = this.$route.query
this.search() this.search()
}, },
methods: { methods: {
reset: function () { reset() {
this.tracks = { items: [], total: 0 } this.tracks = { items: [], total: 0 }
this.artists = { items: [], total: 0 } this.artists = { items: [], total: 0 }
this.albums = { items: [], total: 0 } this.albums = { items: [], total: 0 }
this.playlists = { items: [], total: 0 } this.playlists = { items: [], total: 0 }
}, },
search: function () { search() {
this.reset() this.reset()
// If no search query present reset and focus search field // If no search query present reset and focus search field
@ -415,7 +415,7 @@ export default {
this.search_all() this.search_all()
}, },
spotify_search: function () { spotify_search() {
return webapi.spotify().then(({ data }) => { return webapi.spotify().then(({ data }) => {
this.search_param.market = data.webapi_country this.search_param.market = data.webapi_country
@ -429,7 +429,7 @@ export default {
}) })
}, },
search_all: function () { search_all() {
this.spotify_search().then((data) => { this.spotify_search().then((data) => {
this.tracks = data.tracks ? data.tracks : { items: [], total: 0 } this.tracks = data.tracks ? data.tracks : { items: [], total: 0 }
this.artists = data.artists ? data.artists : { 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.spotify_search().then((data) => {
this.tracks.items = this.tracks.items.concat(data.tracks.items) this.tracks.items = this.tracks.items.concat(data.tracks.items)
this.tracks.total = data.tracks.total 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.spotify_search().then((data) => {
this.artists.items = this.artists.items.concat(data.artists.items) this.artists.items = this.artists.items.concat(data.artists.items)
this.artists.total = data.artists.total 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.spotify_search().then((data) => {
this.albums.items = this.albums.items.concat(data.albums.items) this.albums.items = this.albums.items.concat(data.albums.items)
this.albums.total = data.albums.total 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.spotify_search().then((data) => {
this.playlists.items = this.playlists.items.concat(data.playlists.items) this.playlists.items = this.playlists.items.concat(data.playlists.items)
this.playlists.total = data.playlists.total this.playlists.total = data.playlists.total
@ -480,7 +480,7 @@ export default {
}) })
}, },
new_search: function () { new_search() {
if (!this.search_query) { if (!this.search_query) {
return return
} }
@ -497,7 +497,7 @@ export default {
this.$refs.search_field.blur() this.$refs.search_field.blur()
}, },
open_search_tracks: function () { open_search_tracks() {
this.$router.push({ this.$router.push({
path: '/search/spotify', path: '/search/spotify',
query: { query: {
@ -507,7 +507,7 @@ export default {
}) })
}, },
open_search_artists: function () { open_search_artists() {
this.$router.push({ this.$router.push({
path: '/search/spotify', path: '/search/spotify',
query: { query: {
@ -517,7 +517,7 @@ export default {
}) })
}, },
open_search_albums: function () { open_search_albums() {
this.$router.push({ this.$router.push({
path: '/search/spotify', path: '/search/spotify',
query: { query: {
@ -527,7 +527,7 @@ export default {
}) })
}, },
open_search_playlists: function () { open_search_playlists() {
this.$router.push({ this.$router.push({
path: '/search/spotify', path: '/search/spotify',
query: { query: {
@ -537,36 +537,36 @@ export default {
}) })
}, },
open_recent_search: function (query) { open_recent_search(query) {
this.search_query = query this.search_query = query
this.new_search() this.new_search()
}, },
open_track_dialog: function (track) { open_track_dialog(track) {
this.selected_track = track this.selected_track = track
this.show_track_details_modal = true this.show_track_details_modal = true
}, },
open_album_dialog: function (album) { open_album_dialog(album) {
this.selected_album = album this.selected_album = album
this.show_album_details_modal = true this.show_album_details_modal = true
}, },
open_artist_dialog: function (artist) { open_artist_dialog(artist) {
this.selected_artist = artist this.selected_artist = artist
this.show_artist_details_modal = true this.show_artist_details_modal = true
}, },
open_playlist_dialog: function (playlist) { open_playlist_dialog(playlist) {
this.selected_playlist = playlist this.selected_playlist = playlist
this.show_playlist_details_modal = true this.show_playlist_details_modal = true
}, },
open_album: function (album) { open_album(album) {
this.$router.push({ path: '/music/spotify/albums/' + album.id }) this.$router.push({ path: '/music/spotify/albums/' + album.id })
}, },
artwork_url: function (album) { artwork_url(album) {
if (album.images && album.images.length > 0) { if (album.images && album.images.length > 0) {
return album.images[0].url return album.images[0].url
} }

View File

@ -83,11 +83,11 @@ export default {
}) })
}, },
scroll_to_top: function () { scroll_to_top() {
window.scrollTo({ top: 0, behavior: 'smooth' }) window.scrollTo({ top: 0, behavior: 'smooth' })
}, },
scroll_to_content: function () { scroll_to_content() {
if (this.$route.meta.has_tabs) { if (this.$route.meta.has_tabs) {
this.$scrollTo('#top', { offset: -140 }) this.$scrollTo('#top', { offset: -140 })
} else { } else {
@ -95,7 +95,7 @@ export default {
} }
}, },
visibilityChanged: function (isVisible) { visibilityChanged(isVisible) {
this.options_visible = isVisible this.options_visible = isVisible
} }
} }