2022-01-09 12:29:24 -05:00
|
|
|
<template>
|
|
|
|
<modal-dialog
|
2022-02-19 00:39:14 -05:00
|
|
|
:show="show"
|
|
|
|
title="Update library"
|
|
|
|
:ok_action="library.updating ? '' : 'Rescan'"
|
|
|
|
close_action="Close"
|
|
|
|
@ok="update_library"
|
|
|
|
@close="close()"
|
|
|
|
>
|
|
|
|
<template #modal-content>
|
2022-01-09 12:29:24 -05:00
|
|
|
<div v-if="!library.updating">
|
|
|
|
<p class="mb-3">Scan for new, deleted and modified files</p>
|
2022-02-19 00:39:14 -05:00
|
|
|
<div v-if="spotify_enabled || rss.tracks > 0" class="field">
|
2022-01-09 12:29:24 -05:00
|
|
|
<div class="control">
|
|
|
|
<div class="select is-small">
|
|
|
|
<select v-model="update_dialog_scan_kind">
|
|
|
|
<option value="">Update everything</option>
|
|
|
|
<option value="files">Only update local library</option>
|
2022-02-19 00:39:14 -05:00
|
|
|
<option v-if="spotify_enabled" value="spotify">
|
|
|
|
Only update Spotify
|
|
|
|
</option>
|
|
|
|
<option v-if="rss.tracks > 0" value="rss">
|
|
|
|
Only update RSS feeds
|
|
|
|
</option>
|
2022-01-09 12:29:24 -05:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="field">
|
|
|
|
<label class="checkbox is-size-7 is-small">
|
2022-02-19 00:39:14 -05:00
|
|
|
<input v-model="rescan_metadata" type="checkbox" />
|
2022-01-09 12:29:24 -05:00
|
|
|
Rescan metadata for unmodified files
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<p class="mb-3">Library update in progress ...</p>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</modal-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 00:18:01 -05:00
|
|
|
import ModalDialog from '@/components/ModalDialog.vue'
|
2022-01-09 12:29:24 -05:00
|
|
|
import * as types from '@/store/mutation_types'
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ModalDialogUpdate',
|
|
|
|
components: { ModalDialog },
|
|
|
|
props: ['show'],
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
data() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return {
|
|
|
|
rescan_metadata: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2022-02-19 00:39:14 -05:00
|
|
|
library() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return this.$store.state.library
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
rss() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return this.$store.state.rss_count
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
spotify_enabled() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return this.$store.state.spotify.webapi_token_valid
|
|
|
|
},
|
|
|
|
|
|
|
|
update_dialog_scan_kind: {
|
2022-02-19 00:39:14 -05:00
|
|
|
get() {
|
2022-01-09 12:29:24 -05:00
|
|
|
return this.$store.state.update_dialog_scan_kind
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
set(value) {
|
2022-01-09 12:29:24 -05:00
|
|
|
this.$store.commit(types.UPDATE_DIALOG_SCAN_KIND, value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2022-02-19 00:39:14 -05:00
|
|
|
update_library() {
|
2022-01-09 12:29:24 -05:00
|
|
|
if (this.rescan_metadata) {
|
|
|
|
webapi.library_rescan(this.update_dialog_scan_kind)
|
|
|
|
} else {
|
|
|
|
webapi.library_update(this.update_dialog_scan_kind)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
close() {
|
2022-01-09 12:29:24 -05:00
|
|
|
this.update_dialog_scan_kind = ''
|
|
|
|
this.$emit('close')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
<style></style>
|