+
+
+
+
remove
- 30m
+ 30m
-
+
-
{{ $secondsToTimestamp(remaining) }}
+
{{ $secondsToTimestamp(remaining) }}
-
+
-
+
add
- 30m
+ 30m
{{ $strings.ButtonCancel }}
@@ -47,52 +49,13 @@ export default {
props: {
value: Boolean,
timerSet: Boolean,
- timerTime: Number,
- remaining: Number
+ timerType: String,
+ remaining: Number,
+ hasChapters: Boolean
},
data() {
return {
- customTime: null,
- sleepTimes: [
- {
- seconds: 60 * 5,
- text: '5 minutes'
- },
- {
- seconds: 60 * 15,
- text: '15 minutes'
- },
- {
- seconds: 60 * 20,
- text: '20 minutes'
- },
- {
- seconds: 60 * 30,
- text: '30 minutes'
- },
- {
- seconds: 60 * 45,
- text: '45 minutes'
- },
- {
- seconds: 60 * 60,
- text: '60 minutes'
- },
- {
- seconds: 60 * 90,
- text: '90 minutes'
- },
- {
- seconds: 60 * 120,
- text: '2 hours'
- }
- ]
- }
- },
- watch: {
- show(newVal) {
- if (newVal) {
- }
+ customTime: null
}
},
computed: {
@@ -103,6 +66,54 @@ export default {
set(val) {
this.$emit('input', val)
}
+ },
+ sleepTimes() {
+ const times = [
+ {
+ seconds: 60 * 5,
+ text: this.$getString('LabelTimeDurationXMinutes', ['5']),
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ },
+ {
+ seconds: 60 * 15,
+ text: this.$getString('LabelTimeDurationXMinutes', ['15']),
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ },
+ {
+ seconds: 60 * 20,
+ text: this.$getString('LabelTimeDurationXMinutes', ['20']),
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ },
+ {
+ seconds: 60 * 30,
+ text: this.$getString('LabelTimeDurationXMinutes', ['30']),
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ },
+ {
+ seconds: 60 * 45,
+ text: this.$getString('LabelTimeDurationXMinutes', ['45']),
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ },
+ {
+ seconds: 60 * 60,
+ text: this.$getString('LabelTimeDurationXMinutes', ['60']),
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ },
+ {
+ seconds: 60 * 90,
+ text: this.$getString('LabelTimeDurationXMinutes', ['90']),
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ },
+ {
+ seconds: 60 * 120,
+ text: this.$getString('LabelTimeDurationXHours', ['2']),
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ }
+ ]
+ if (this.hasChapters) {
+ times.push({ seconds: -1, text: this.$strings.LabelEndOfChapter, timerType: this.$constants.SleepTimerTypes.CHAPTER })
+ }
+ return times
}
},
methods: {
@@ -113,10 +124,14 @@ export default {
}
const timeInSeconds = Math.round(Number(this.customTime) * 60)
- this.setTime(timeInSeconds)
+ const time = {
+ seconds: timeInSeconds,
+ timerType: this.$constants.SleepTimerTypes.COUNTDOWN
+ }
+ this.setTime(time)
},
- setTime(seconds) {
- this.$emit('set', seconds)
+ setTime(time) {
+ this.$emit('set', time)
},
increment(amount) {
this.$emit('increment', amount)
@@ -130,4 +145,4 @@ export default {
}
}
}
-
\ No newline at end of file
+
diff --git a/client/components/player/PlayerPlaybackControls.vue b/client/components/player/PlayerPlaybackControls.vue
index 664385bd..76397e98 100644
--- a/client/components/player/PlayerPlaybackControls.vue
+++ b/client/components/player/PlayerPlaybackControls.vue
@@ -96,10 +96,10 @@ export default {
let formattedTime = ''
if (amount <= 60) {
- formattedTime = this.$getString('LabelJumpAmountSeconds', [amount])
+ formattedTime = this.$getString('LabelTimeDurationXSeconds', [amount])
} else {
const minutes = Math.floor(amount / 60)
- formattedTime = this.$getString('LabelJumpAmountMinutes', [minutes])
+ formattedTime = this.$getString('LabelTimeDurationXMinutes', [minutes])
}
return `${prefix} - ${formattedTime}`
diff --git a/client/components/player/PlayerUi.vue b/client/components/player/PlayerUi.vue
index 21d1b7aa..68452061 100644
--- a/client/components/player/PlayerUi.vue
+++ b/client/components/player/PlayerUi.vue
@@ -13,7 +13,7 @@
snooze
snooze
-
{{ sleepTimerRemainingString }}
+
{{ sleepTimerRemainingString }}
@@ -72,12 +72,14 @@ export default {
type: Array,
default: () => []
},
+ currentChapter: Object,
bookmarks: {
type: Array,
default: () => []
},
sleepTimerSet: Boolean,
sleepTimerRemaining: Number,
+ sleepTimerType: String,
isPodcast: Boolean,
hideBookmarks: Boolean,
hideSleepTimer: Boolean
@@ -104,16 +106,20 @@ export default {
},
computed: {
sleepTimerRemainingString() {
- var rounded = Math.round(this.sleepTimerRemaining)
- if (rounded < 90) {
- return `${rounded}s`
+ if (this.sleepTimerType === this.$constants.SleepTimerTypes.CHAPTER) {
+ return 'EoC'
+ } else {
+ var rounded = Math.round(this.sleepTimerRemaining)
+ if (rounded < 90) {
+ return `${rounded}s`
+ }
+ var minutesRounded = Math.round(rounded / 60)
+ if (minutesRounded <= 90) {
+ return `${minutesRounded}m`
+ }
+ var hoursRounded = Math.round(minutesRounded / 60)
+ return `${hoursRounded}h`
}
- var minutesRounded = Math.round(rounded / 60)
- if (minutesRounded < 90) {
- return `${minutesRounded}m`
- }
- var hoursRounded = Math.round(minutesRounded / 60)
- return `${hoursRounded}h`
},
token() {
return this.$store.getters['user/getToken']
@@ -138,9 +144,6 @@ export default {
if (!duration) return 0
return Math.round((100 * time) / duration)
},
- currentChapter() {
- return this.chapters.find((chapter) => chapter.start <= this.currentTime && this.currentTime < chapter.end)
- },
currentChapterName() {
return this.currentChapter ? this.currentChapter.title : ''
},
diff --git a/client/plugins/constants.js b/client/plugins/constants.js
index f001f6ce..d89fbbbd 100644
--- a/client/plugins/constants.js
+++ b/client/plugins/constants.js
@@ -32,12 +32,18 @@ const PlayMethod = {
LOCAL: 3
}
+const SleepTimerTypes = {
+ COUNTDOWN: 'countdown',
+ CHAPTER: 'chapter'
+}
+
const Constants = {
SupportedFileTypes,
DownloadStatus,
BookCoverAspectRatio,
BookshelfView,
- PlayMethod
+ PlayMethod,
+ SleepTimerTypes
}
const KeyNames = {
diff --git a/client/strings/en-us.json b/client/strings/en-us.json
index eaaa5d7c..a0933d4d 100644
--- a/client/strings/en-us.json
+++ b/client/strings/en-us.json
@@ -292,6 +292,7 @@
"LabelEmbeddedCover": "Embedded Cover",
"LabelEnable": "Enable",
"LabelEnd": "End",
+ "LabelEndOfChapter": "End of Chapter",
"LabelEpisode": "Episode",
"LabelEpisodeTitle": "Episode Title",
"LabelEpisodeType": "Episode Type",
@@ -345,8 +346,6 @@
"LabelIntervalEveryHour": "Every hour",
"LabelInvert": "Invert",
"LabelItem": "Item",
- "LabelJumpAmountMinutes": "{0} minutes",
- "LabelJumpAmountSeconds": "{0} seconds",
"LabelJumpBackwardAmount": "Jump backward amount",
"LabelJumpForwardAmount": "Jump forward amount",
"LabelLanguage": "Language",
@@ -565,6 +564,10 @@
"LabelThemeDark": "Dark",
"LabelThemeLight": "Light",
"LabelTimeBase": "Time Base",
+ "LabelTimeDurationXHours": "{0} hours",
+ "LabelTimeDurationXMinutes": "{0} minutes",
+ "LabelTimeDurationXSeconds": "{0} seconds",
+ "LabelTimeInMinutes": "Time in minutes",
"LabelTimeListened": "Time Listened",
"LabelTimeListenedToday": "Time Listened Today",
"LabelTimeRemaining": "{0} remaining",