mirror of https://github.com/Kylart/KawAnime.git
Now moves entry to seen lists when entirely watched
This commit is contained in:
parent
aa40c27e9e
commit
870872424c
|
@ -1,15 +1,6 @@
|
||||||
|
import { mapActions, mapMutations } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
|
||||||
parsedName () {
|
|
||||||
const parts = this.videoTitle.split(' - ')
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: parts[0],
|
|
||||||
ep: parts[1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
const { name: refName, ep: refEp } = this.parsedName
|
const { name: refName, ep: refEp } = this.parsedName
|
||||||
const { autoTracking } = this.$store.state.config.config
|
const { autoTracking } = this.$store.state.config.config
|
||||||
|
@ -25,7 +16,25 @@ export default {
|
||||||
providersAutoTracking.some(Boolean) && this.trackProviders(refName, refEp, providersAutoTracking)
|
providersAutoTracking.some(Boolean) && this.trackProviders(refName, refEp, providersAutoTracking)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
parsedName () {
|
||||||
|
const parts = this.videoTitle.split(' - ')
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: parts[0],
|
||||||
|
ep: parts[1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions('watchLists', {
|
||||||
|
localMove: 'move',
|
||||||
|
localAdd: 'add'
|
||||||
|
}),
|
||||||
|
...mapMutations({
|
||||||
|
tellUser: 'setInfoSnackbar'
|
||||||
|
}),
|
||||||
trackLocal (refName, refEp) {
|
trackLocal (refName, refEp) {
|
||||||
// Finding entries with the same name
|
// Finding entries with the same name
|
||||||
const lists = this.$store.state.watchLists.lists
|
const lists = this.$store.state.watchLists.lists
|
||||||
|
@ -48,12 +57,20 @@ export default {
|
||||||
if (isRewatch) return
|
if (isRewatch) return
|
||||||
|
|
||||||
// Updating progress accordingly
|
// Updating progress accordingly
|
||||||
this.$store.dispatch('watchLists/add', {
|
this.localAdd({
|
||||||
...entry,
|
...entry,
|
||||||
progress: +refEp
|
progress: +refEp
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$log(`Updated user local progress for ${refName}.`)
|
this.$log(`Updated user local progress for ${refName}.`)
|
||||||
|
|
||||||
|
// If the entry is fully watched, we should move it to seen
|
||||||
|
if (entry.nbEp && +refEp === +entry.nbEp) {
|
||||||
|
this.$log(`Moving ${entry.name} to \`seen\` list as it reached maximum known episode.`)
|
||||||
|
this.tellUser(`${entry.name} completed. Niiice!`)
|
||||||
|
|
||||||
|
this.localMove({ entry, target: 'seen' })
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
trackProviders (refName, refEp, providers) {
|
trackProviders (refName, refEp, providers) {
|
||||||
|
|
|
@ -16,6 +16,12 @@ export default {
|
||||||
delete (store, entry) {
|
delete (store, entry) {
|
||||||
ipcRenderer.send(eventsList.localLists.update.main, { type: entry.list, data: entry, isDelete: true })
|
ipcRenderer.send(eventsList.localLists.update.main, { type: entry.list, data: entry, isDelete: true })
|
||||||
},
|
},
|
||||||
|
move ({ dispatch }, { entry, target = null }) {
|
||||||
|
dispatch('delete', entry)
|
||||||
|
|
||||||
|
entry.list = target
|
||||||
|
dispatch('add', entry)
|
||||||
|
},
|
||||||
info (store, entries) {
|
info (store, entries) {
|
||||||
ipcRenderer.send(eventsList.localLists.info.main, entries)
|
ipcRenderer.send(eventsList.localLists.info.main, entries)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue