Fixed chapter parsing for m4b books. Added volume for audiobooks bound to 9 (decrese) and 0 (increase).
This commit is contained in:
27
bookstorm.py
27
bookstorm.py
@@ -1153,7 +1153,7 @@ class BookReader:
|
||||
# Help
|
||||
if self.book and hasattr(self.book, 'isAudioBook') and self.book.isAudioBook:
|
||||
# Audio book help
|
||||
self.speechEngine.speak("SPACE: play pause. n: next chapter. p: previous chapter. LEFT RIGHT arrows: seek 5 seconds. UP DOWN arrows: seek 1 minute. SHIFT LEFT RIGHT: seek 30 seconds. SHIFT UP DOWN: seek 5 minutes. s: save bookmark. k: bookmarks menu. r: recent books. b: browse books. a: audiobookshelf. o: options menu. i: current info. Right bracket: increase playback speed. Left bracket: decrease playback speed. Backspace: reset playback speed. SHIFT HOME: clear bookmark and jump to beginning. CONTROL: stop speech. t: time remaining. h: help. q: quit or sleep timer")
|
||||
self.speechEngine.speak("SPACE: play pause. n: next chapter. p: previous chapter. LEFT RIGHT arrows: seek 5 seconds. UP DOWN arrows: seek 1 minute. SHIFT LEFT RIGHT: seek 30 seconds. SHIFT UP DOWN: seek 5 minutes. s: save bookmark. k: bookmarks menu. r: recent books. b: browse books. a: audiobookshelf. o: options menu. i: current info. Right bracket: increase playback speed. Left bracket: decrease playback speed. Backspace: reset playback speed. 0: increase volume. 9: decrease volume. SHIFT HOME: clear bookmark and jump to beginning. CONTROL: stop speech. t: time remaining. h: help. q: quit or sleep timer")
|
||||
else:
|
||||
# Text book help
|
||||
self.speechEngine.speak("SPACE: play pause. n: next paragraph. p: previous paragraph. Shift N: next chapter. Shift P: previous chapter. LEFT RIGHT arrows: previous next paragraph. SHIFT LEFT RIGHT: previous next chapter. UP DOWN arrows: skip 5 paragraphs. SHIFT UP DOWN: first last paragraph. s: save bookmark. k: bookmarks menu. r: recent books. b: browse books. a: audiobookshelf. o: options menu. i: current info. Page Up Down: adjust speech rate. Right bracket: increase playback speed. Left bracket: decrease playback speed. Backspace: reset playback speed. SHIFT HOME: clear bookmark and jump to beginning. CONTROL: stop speech. t: time remaining. h: help. q: quit or sleep timer")
|
||||
@@ -1219,6 +1219,22 @@ class BookReader:
|
||||
else:
|
||||
self.speechEngine.speak("No book loaded")
|
||||
|
||||
elif event.key == pygame.K_0:
|
||||
# Increase volume (audio books only - mpv handles volume control)
|
||||
if self.book and hasattr(self.book, 'isAudioBook') and self.book.isAudioBook:
|
||||
newVolume = self.audioPlayer.increase_volume(5)
|
||||
self.speechEngine.speak(f"Volume {newVolume}")
|
||||
else:
|
||||
self.speechEngine.speak("Volume control only works for audio books")
|
||||
|
||||
elif event.key == pygame.K_9:
|
||||
# Decrease volume (audio books only - mpv handles volume control)
|
||||
if self.book and hasattr(self.book, 'isAudioBook') and self.book.isAudioBook:
|
||||
newVolume = self.audioPlayer.decrease_volume(5)
|
||||
self.speechEngine.speak(f"Volume {newVolume}")
|
||||
else:
|
||||
self.speechEngine.speak("Volume control only works for audio books")
|
||||
|
||||
elif event.key == pygame.K_HOME and shiftPressed:
|
||||
# Shift+Home: Clear bookmark and jump to beginning of book
|
||||
if not self.book:
|
||||
@@ -2109,15 +2125,16 @@ class BookReader:
|
||||
Args:
|
||||
bookPath: Path to new book file
|
||||
"""
|
||||
# Save bookmark for current book BEFORE stopping playback
|
||||
# (so we can capture the current audio position)
|
||||
if self.book:
|
||||
self.save_bookmark(speakFeedback=False)
|
||||
|
||||
# Stop current playback
|
||||
self.audioPlayer.stop()
|
||||
self._cancel_buffer()
|
||||
self.isPlaying = False
|
||||
|
||||
# Save bookmark for current book
|
||||
if self.book:
|
||||
self.save_bookmark()
|
||||
|
||||
# Update book path and config
|
||||
self.bookPath = Path(bookPath)
|
||||
self.config.set_last_book(bookPath)
|
||||
|
||||
Reference in New Issue
Block a user