mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-12 04:11:43 +00:00
Sleep timer cleanup
This commit is contained in:
parent
e2b521f116
commit
518bc27537
2 changed files with 9 additions and 21 deletions
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
<modals-bookmarks-modal v-model="showBookmarksModal" :bookmarks="bookmarks" :current-time="bookmarkCurrentTime" :library-item-id="libraryItemId" @select="selectBookmark" />
|
<modals-bookmarks-modal v-model="showBookmarksModal" :bookmarks="bookmarks" :current-time="bookmarkCurrentTime" :library-item-id="libraryItemId" @select="selectBookmark" />
|
||||||
|
|
||||||
<modals-sleep-timer-modal v-model="showSleepTimerModal" :timer-set="sleepTimerSet" :timer-time="sleepTimerTime" :timer-type="sleepTimerType" :remaining="sleepTimerRemaining" @set="setSleepTimer" @cancel="cancelSleepTimer" @increment="incrementSleepTimer" @decrement="decrementSleepTimer" />
|
<modals-sleep-timer-modal v-model="showSleepTimerModal" :timer-set="sleepTimerSet" :timer-type="sleepTimerType" :remaining="sleepTimerRemaining" @set="setSleepTimer" @cancel="cancelSleepTimer" @increment="incrementSleepTimer" @decrement="decrementSleepTimer" />
|
||||||
|
|
||||||
<modals-player-queue-items-modal v-model="showPlayerQueueItemsModal" :library-item-id="libraryItemId" />
|
<modals-player-queue-items-modal v-model="showPlayerQueueItemsModal" :library-item-id="libraryItemId" />
|
||||||
|
|
||||||
|
|
@ -83,7 +83,6 @@ export default {
|
||||||
showPlayerQueueItemsModal: false,
|
showPlayerQueueItemsModal: false,
|
||||||
showPlayerSettingsModal: false,
|
showPlayerSettingsModal: false,
|
||||||
sleepTimerSet: false,
|
sleepTimerSet: false,
|
||||||
sleepTimerTime: 0,
|
|
||||||
sleepTimerRemaining: 0,
|
sleepTimerRemaining: 0,
|
||||||
sleepTimerType: null,
|
sleepTimerType: null,
|
||||||
sleepTimer: null,
|
sleepTimer: null,
|
||||||
|
|
@ -93,13 +92,6 @@ export default {
|
||||||
coverAspectRatio: 1
|
coverAspectRatio: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
currentTime(newTime) {
|
|
||||||
if (this.sleepTimerType === this.$constants.SleepTimerTypes.CHAPTER && this.sleepTimerSet) {
|
|
||||||
this.checkChapterEnd(newTime)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
isSquareCover() {
|
isSquareCover() {
|
||||||
return this.coverAspectRatio === 1
|
return this.coverAspectRatio === 1
|
||||||
|
|
@ -231,7 +223,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
runSleepTimer(time) {
|
runSleepTimer(time) {
|
||||||
this.sleepTimerTime = time.seconds
|
|
||||||
this.sleepTimerRemaining = time.seconds
|
this.sleepTimerRemaining = time.seconds
|
||||||
|
|
||||||
var lastTick = Date.now()
|
var lastTick = Date.now()
|
||||||
|
|
@ -247,6 +238,7 @@ export default {
|
||||||
}, 1000)
|
}, 1000)
|
||||||
},
|
},
|
||||||
checkChapterEnd(time) {
|
checkChapterEnd(time) {
|
||||||
|
if (!this.currentChapter) return
|
||||||
const chapterEndTime = this.currentChapter.end
|
const chapterEndTime = this.currentChapter.end
|
||||||
const tolerance = 0.75
|
const tolerance = 0.75
|
||||||
if (time >= chapterEndTime - tolerance) {
|
if (time >= chapterEndTime - tolerance) {
|
||||||
|
|
@ -308,6 +300,10 @@ export default {
|
||||||
if (this.$refs.audioPlayer) {
|
if (this.$refs.audioPlayer) {
|
||||||
this.$refs.audioPlayer.setCurrentTime(time)
|
this.$refs.audioPlayer.setCurrentTime(time)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.sleepTimerType === this.$constants.SleepTimerTypes.CHAPTER && this.sleepTimerSet) {
|
||||||
|
this.checkChapterEnd(newTime)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setDuration(duration) {
|
setDuration(duration) {
|
||||||
this.totalDuration = duration
|
this.totalDuration = duration
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-full p-4">
|
<div class="w-full p-4">
|
||||||
<div v-if="timerType === this.$constants.SleepTimerTypes.COUNTDOWN" class="mb-4 flex items-center justify-center">
|
<div v-if="timerType === $constants.SleepTimerTypes.COUNTDOWN" class="mb-4 flex items-center justify-center">
|
||||||
<ui-btn :padding-x="2" small :disabled="remaining < 30 * 60" class="flex items-center mr-4" @click="decrement(30 * 60)">
|
<ui-btn :padding-x="2" small :disabled="remaining < 30 * 60" class="flex items-center mr-4" @click="decrement(30 * 60)">
|
||||||
<span class="material-symbols text-lg">remove</span>
|
<span class="material-symbols text-lg">remove</span>
|
||||||
<span class="pl-1 text-base font-mono">30m</span>
|
<span class="pl-1 text-base font-mono">30m</span>
|
||||||
|
|
@ -47,10 +47,8 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
value: Boolean,
|
value: Boolean,
|
||||||
timerSet: Boolean,
|
timerSet: Boolean,
|
||||||
timerTime: Number,
|
|
||||||
timerType: String,
|
timerType: String,
|
||||||
remaining: Number,
|
remaining: Number
|
||||||
currentChapter: Object
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -100,12 +98,6 @@ export default {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
show(newVal) {
|
|
||||||
if (newVal) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
show: {
|
show: {
|
||||||
get() {
|
get() {
|
||||||
|
|
@ -145,4 +137,4 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue