[PR #1808] feat: Added option to have the sleep timer handle multiple chapters #1702

Open
opened 2026-04-25 00:00:43 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1808
Author: @indeedhat
Created: 2/20/2026
Status: 🔄 Open

Base: masterHead: multi-chapter-sleep-timer


📝 Commits (5)

  • 238d01a feat: Added option to have the sleep timer handle multiple chapters
  • 9d081f4 fix: title case in strings
  • 9424b44 fix: shake to reset breaks chapter sleep
  • ab70c57 fix: make multi chapter sleep play nice with shake to reset
  • 4d24ec3 fix: when swapping between books the chapter sleep timer does not get

📊 Changes

9 files changed (+172 additions, -34 deletions)

View changed files

📝 android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt (+2 -0)
📝 android/app/src/main/java/com/audiobookshelf/app/data/PlaybackSession.kt (+6 -0)
📝 android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt (+54 -29)
📝 android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt (+18 -0)
📝 components/app/AudioPlayerContainer.vue (+49 -2)
📝 components/modals/SleepTimerModal.vue (+19 -2)
📝 pages/settings.vue (+17 -0)
📝 store/index.js (+4 -1)
📝 strings/en-us.json (+3 -0)

📄 Description

Brief summary

Adds the option for the sleep timer to handle multiple chapters.
If enabled in the settings you will get additional [+]/[-] buttons to increment/decrement the timer by whole chapters.

Which issue is fixed?

N/A

Pull Request Type

Android only

In-depth Description

Often times i want to use the sleep timer to go to the end of the next chapter or the one after that, with the existing setup of 5 minute increments this is pretty hard to achieve, i basically have to work out the expected end time and set a manual timer.

With this PR i have updated the sleep timer UI/logic so that you can increment either by the original 5 minute intervals or to the end of the next chapter. This functionality needs to first be enabled in the settings.

When enabled you get a new set of [+][-] buttons in the sleep timer modal for chapter inc/dec.

  • If your current sleep timer is set for the end of a chapter then incrementing will increase it to the end of the next chapter.
  • If your current timer does not line up with the end of a chapter then it will increment to the end of the chapter the timer ends within.
  • Decrementing will always go back to the end of the previous chapter

How have you tested this?

This has been tested both in an android emulator in AndroidStudio and on my personal device.

EDIT:
manual tests:

  • single m4b file books
  • one mp3 per chapter books
  • swapping between books resets timer to end of current chapter
  • skipping past end of sleep timer pauses playback
  • shake to reset extends sleep timer by a chapter if its in the last 10 seconds
  • shake to reset extends sleep timer by a chapter if recently finished
  • sleep timer does not go past the end of the book
  • pressing play after timer has just finished extends timer by chapter
  • skipping forward by time increments or full chapters updates remaining time
  • when mixing end of chapter and +/- 5 minute increments +/- chapter correctly gets the appropriate chapter boundary

Screenshots

Settings Page
Screenshot_20260220_185704

Settings Page Info
Screenshot_20260220_185814

Sleep Timer
Screenshot_20260220_190055


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1808 **Author:** [@indeedhat](https://github.com/indeedhat) **Created:** 2/20/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `multi-chapter-sleep-timer` --- ### 📝 Commits (5) - [`238d01a`](https://github.com/advplyr/audiobookshelf-app/commit/238d01afbf9a5d19726d5e51663dd97e4f7081a0) feat: Added option to have the sleep timer handle multiple chapters - [`9d081f4`](https://github.com/advplyr/audiobookshelf-app/commit/9d081f48779aca3376795f325a864b2dc56ef72f) fix: title case in strings - [`9424b44`](https://github.com/advplyr/audiobookshelf-app/commit/9424b442877005b91c47cd6695eafef1d39ff233) fix: shake to reset breaks chapter sleep - [`ab70c57`](https://github.com/advplyr/audiobookshelf-app/commit/ab70c5714486b4e733dae8270ba4726705ff1f78) fix: make multi chapter sleep play nice with shake to reset - [`4d24ec3`](https://github.com/advplyr/audiobookshelf-app/commit/4d24ec31b7023174211e31b23a8b88a59a17ad36) fix: when swapping between books the chapter sleep timer does not get ### 📊 Changes **9 files changed** (+172 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt` (+2 -0) 📝 `android/app/src/main/java/com/audiobookshelf/app/data/PlaybackSession.kt` (+6 -0) 📝 `android/app/src/main/java/com/audiobookshelf/app/managers/SleepTimerManager.kt` (+54 -29) 📝 `android/app/src/main/java/com/audiobookshelf/app/player/PlayerNotificationService.kt` (+18 -0) 📝 `components/app/AudioPlayerContainer.vue` (+49 -2) 📝 `components/modals/SleepTimerModal.vue` (+19 -2) 📝 `pages/settings.vue` (+17 -0) 📝 `store/index.js` (+4 -1) 📝 `strings/en-us.json` (+3 -0) </details> ### 📄 Description ## Brief summary Adds the option for the sleep timer to handle multiple chapters. If enabled in the settings you will get additional [+]/[-] buttons to increment/decrement the timer by whole chapters. ## Which issue is fixed? N/A ## Pull Request Type Android only ## In-depth Description Often times i want to use the sleep timer to go to the end of the next chapter or the one after that, with the existing setup of 5 minute increments this is pretty hard to achieve, i basically have to work out the expected end time and set a manual timer. With this PR i have updated the sleep timer UI/logic so that you can increment either by the original 5 minute intervals or to the end of the next chapter. This functionality needs to first be enabled in the settings. When enabled you get a new set of [+][-] buttons in the sleep timer modal for chapter inc/dec. - If your current sleep timer is set for the end of a chapter then incrementing will increase it to the end of the next chapter. - If your current timer does not line up with the end of a chapter then it will increment to the end of the chapter the timer ends within. - Decrementing will always go back to the end of the previous chapter ## How have you tested this? This has been tested both in an android emulator in AndroidStudio and on my personal device. EDIT: manual tests: - single m4b file books - one mp3 per chapter books - swapping between books resets timer to end of current chapter - skipping past end of sleep timer pauses playback - shake to reset extends sleep timer by a chapter if its in the last 10 seconds - shake to reset extends sleep timer by a chapter if recently finished - sleep timer does not go past the end of the book - pressing play after timer has just finished extends timer by chapter - skipping forward by time increments or full chapters updates remaining time - when mixing end of chapter and +/- 5 minute increments +/- chapter correctly gets the appropriate chapter boundary ## Screenshots Settings Page <img width="1080" height="2400" alt="Screenshot_20260220_185704" src="https://github.com/user-attachments/assets/9af0c8c3-517a-4de3-adad-6dccc294842d" /> Settings Page Info <img width="1080" height="2400" alt="Screenshot_20260220_185814" src="https://github.com/user-attachments/assets/fde20378-95a2-47b4-bdf5-573236aa753d" /> Sleep Timer <img width="1080" height="2400" alt="Screenshot_20260220_190055" src="https://github.com/user-attachments/assets/3937560c-06a3-46f5-98f1-f0f4ae922c34" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:00:43 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1702