* fix: support reading alternative book formats using bookType query param * feat: add streaming reader support for alternative EPUB formats * refactor: extract tabs section into MetadataTabsComponent * feat: implement per-file reading progress tracking * feat: add configurable format priority with cascading fallback * refactor: redesign library creator with single-page layout * refactor: unify reading progress into ReadingProgressService * refactor: improve delete options with clearer file format and book deletion * refactor: improve book format matching with normalization and fuzzy fallback * feat: add folder-based audiobook support with ZIP downloads and preparing state * fix: display unique format types in metadata viewer * refactor: auto-attach files to single book in folder during rescan * feat: implement folder-centric book file grouping with fuzzy matching * refactor: consolidate book grouping with organization mode support * fix: use folder hash for folder-based audiobooks in auto-attach * fix: delete only BookFileEntity on file removal, not entire book * fix: set folderBased flag and correct file size for auto-attached audiobook folders * fix: use count query to avoid lazy initialization in file delete handler * fix: preserve book metadata when file is moved by detecting hash match * fix: skip books with no files in restoration to avoid NPE * fix: round all progress percentages to one decimal place before sending to UI * style: improve library creator dialog spacing and layout * fix: migrate FOLDER_AS_BOOK to BOOK_PER_FOLDER for backwards compatibility * fix: FileMoveService now handles multi-file BookEntity properly * style: redesign metadata-picker and file-mover UI components * style: redesign file-naming-pattern UI and improve theme contrast * style: relax spacing in library-creator component * style: tighten directory-picker layout for consistency * fix: PathPatternResolver now respects folderBased flag for audiobooks * style: move checkmark column to left side and add pending status in file-mover * refactor: consolidate BookFileType into BookType and add audiobook styling * feat: show 'Continue Reading' button for in-progress books * fix: preserve dots in folder names during grouping and prevent duplicate attachments * style: reduce gap between download-all button and primary file section * style: shorten 'Continue Reading' button to 'Read' on mobile * feat: add DISK_TYPE config to disable file moves on network storage * style: standardize settings pages with shared styles and consistent spacing * style: revamp settings pages with modern card-based layouts * style: revamp OPDS, auth, and task management settings layouts * fix: update FileMoveService tests to include AppProperties parameter * fix: derive BookFileType from extension when uploading additional book files * feat: show format type and size in download button with dropdown for alternatives * feat: add audiobook streaming player with HTTP Range support * feat: add M4B chapter extraction and chapter navigation * feat: add audiobook bookmarks and sleep timer * refactor: split AudiobookReaderService into focused services * feat: add Media Session API for background audio playback * feat: display file extensions in format tags with distinct colors and add audiobook upload support * feat: require bookFileId for viewer settings API * fix: show split button for audiobooks with readable alternatives * feat: improve reading sessions table with book type badges and better formatting * feat: add audiobook play button in files tab * feat: use file extension for format display and meaningful tab values * feat: add extension field to BookFile DTO * feat: use extension field for book card format pill * fix: use mixed orientation for format priority drag-drop to support multi-line layout * feat: add attach book files feature to consolidate single-file books * fix: increase drag handle size for format priority chips * fix: add missing BookFileRepository mock to BookServiceDeleteTests * feat: add delete buttons to files tab and move shelf to other items menu * feat: add physical books support for cataloging books without digital files * refactor: redesign icon-picker component with improved styling * refactor: redesign metadata-picker component with improved layout and alignment * refactor: move Add Physical Book to top of library menu * refactor: use p-autoComplete for authors/categories in add-physical-book dialog * feat: add square cover search and display support for audiobooks * fix: navigate to first page when opening unread ebooks * fix: exclude API requests from service worker interception * feat: support fileless books with automatic file attachment * fix: bypass service worker for audiobook streaming requests * refactor: remove alphabetical filter sorting, default to count, limit filters to 100 --------- Co-authored-by: acx10 <acx10@users.noreply.github.com>
400 lines
12 KiB
HTML
400 lines
12 KiB
HTML
@if (isLoading) {
|
|
<div class="loading-container">
|
|
<p-progressSpinner strokeWidth="3" />
|
|
<span class="loading-text">Loading audiobook...</span>
|
|
</div>
|
|
} @else {
|
|
<div class="audiobook-reader">
|
|
<!-- Hidden audio element -->
|
|
<audio
|
|
#audioElement
|
|
[src]="audioSrc"
|
|
(loadedmetadata)="onAudioLoaded()"
|
|
(timeupdate)="onTimeUpdate()"
|
|
(progress)="onProgress()"
|
|
(ended)="onAudioEnded()"
|
|
(error)="onAudioError()"
|
|
preload="metadata"
|
|
></audio>
|
|
|
|
<!-- Header -->
|
|
<header class="reader-header">
|
|
<p-button
|
|
icon="pi pi-arrow-left"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="closeReader()"
|
|
pTooltip="Back"
|
|
tooltipPosition="bottom"
|
|
/>
|
|
<div class="header-info">
|
|
<h1 class="book-title">{{ audiobookInfo.title || 'Untitled' }}</h1>
|
|
<span class="book-author">{{ audiobookInfo.author || 'Unknown Author' }}</span>
|
|
</div>
|
|
<div class="header-actions">
|
|
<p-button
|
|
icon="pi pi-bookmark"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="toggleBookmarkList()"
|
|
pTooltip="Bookmarks"
|
|
tooltipPosition="bottom"
|
|
/>
|
|
<p-button
|
|
icon="pi pi-list"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="toggleTrackList()"
|
|
pTooltip="Chapters/Tracks"
|
|
tooltipPosition="bottom"
|
|
/>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Main content -->
|
|
<main class="reader-main">
|
|
<!-- Cover art -->
|
|
<div class="cover-container">
|
|
<div class="cover-wrapper">
|
|
@if (coverUrl) {
|
|
<img
|
|
[src]="coverUrl"
|
|
(error)="onCoverError()"
|
|
alt="Cover"
|
|
class="cover-image"
|
|
/>
|
|
} @else {
|
|
<div class="cover-placeholder">
|
|
<i class="pi pi-headphones"></i>
|
|
</div>
|
|
}
|
|
@if (audioLoading) {
|
|
<div class="cover-loading">
|
|
<p-progressSpinner strokeWidth="3" />
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Track/Chapter info -->
|
|
<div class="track-info">
|
|
@if (audiobookInfo.folderBased && currentTrack) {
|
|
<span class="track-title">{{ currentTrack.title }}</span>
|
|
<span class="track-number">Track {{ currentTrackIndex + 1 }} of {{ audiobookInfo.tracks?.length }}</span>
|
|
} @else if (getCurrentChapter()) {
|
|
<span class="track-title">{{ getCurrentChapter()?.title }}</span>
|
|
@if (hasMultipleChapters()) {
|
|
<span class="track-number">Chapter {{ getCurrentChapterIndex() + 1 }} of {{ audiobookInfo.chapters?.length }}</span>
|
|
}
|
|
}
|
|
</div>
|
|
|
|
<!-- Progress bar -->
|
|
<div class="progress-container">
|
|
<div class="time-display">
|
|
<span class="current-time">{{ formatTime(currentTime) }}</span>
|
|
<span class="duration">{{ formatTime(duration) }}</span>
|
|
</div>
|
|
<div class="progress-bar-wrapper">
|
|
<div class="buffered-bar" [style.width.%]="getBufferedPercent()"></div>
|
|
<p-slider
|
|
[(ngModel)]="currentTime"
|
|
[min]="0"
|
|
[max]="duration || 100"
|
|
[step]="1"
|
|
(onChange)="seek($event)"
|
|
styleClass="progress-slider"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Playback controls -->
|
|
<div class="playback-controls">
|
|
@if (audiobookInfo.folderBased) {
|
|
<p-button
|
|
icon="pi pi-step-backward"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="previousTrack()"
|
|
[disabled]="currentTrackIndex === 0"
|
|
pTooltip="Previous Track"
|
|
tooltipPosition="top"
|
|
size="large"
|
|
/>
|
|
} @else if (hasMultipleChapters()) {
|
|
<p-button
|
|
icon="pi pi-step-backward"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="previousChapter()"
|
|
[disabled]="!canGoPreviousChapter()"
|
|
pTooltip="Previous Chapter"
|
|
tooltipPosition="top"
|
|
size="large"
|
|
/>
|
|
}
|
|
|
|
<p-button
|
|
icon="pi pi-replay"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="seekRelative(-30)"
|
|
pTooltip="-30s"
|
|
tooltipPosition="top"
|
|
size="large"
|
|
/>
|
|
|
|
<p-button
|
|
[icon]="isPlaying ? 'pi pi-pause' : 'pi pi-play'"
|
|
[rounded]="true"
|
|
severity="contrast"
|
|
(onClick)="togglePlay()"
|
|
[disabled]="audioLoading"
|
|
styleClass="play-button"
|
|
size="large"
|
|
/>
|
|
|
|
<p-button
|
|
icon="pi pi-forward"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="seekRelative(30)"
|
|
pTooltip="+30s"
|
|
tooltipPosition="top"
|
|
size="large"
|
|
/>
|
|
|
|
@if (audiobookInfo.folderBased) {
|
|
<p-button
|
|
icon="pi pi-step-forward"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="nextTrack()"
|
|
[disabled]="!audiobookInfo.tracks || currentTrackIndex >= audiobookInfo.tracks.length - 1"
|
|
pTooltip="Next Track"
|
|
tooltipPosition="top"
|
|
size="large"
|
|
/>
|
|
} @else if (hasMultipleChapters()) {
|
|
<p-button
|
|
icon="pi pi-step-forward"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="nextChapter()"
|
|
[disabled]="!canGoNextChapter()"
|
|
pTooltip="Next Chapter"
|
|
tooltipPosition="top"
|
|
size="large"
|
|
/>
|
|
}
|
|
</div>
|
|
|
|
<!-- Secondary controls -->
|
|
<div class="secondary-controls">
|
|
<!-- Volume -->
|
|
<div class="volume-control">
|
|
<p-button
|
|
[icon]="getVolumeIcon()"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="toggleMute()"
|
|
size="small"
|
|
/>
|
|
<p-slider
|
|
[(ngModel)]="volume"
|
|
[min]="0"
|
|
[max]="1"
|
|
[step]="0.01"
|
|
(onChange)="setVolume($event)"
|
|
styleClass="volume-slider"
|
|
/>
|
|
</div>
|
|
|
|
<!-- Playback speed -->
|
|
<div class="speed-control">
|
|
<p-selectButton
|
|
[options]="playbackRates"
|
|
[ngModel]="playbackRate"
|
|
(ngModelChange)="setPlaybackRate($event)"
|
|
optionLabel="label"
|
|
optionValue="value"
|
|
size="small"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Extra controls row -->
|
|
<div class="extra-controls">
|
|
<!-- Add bookmark button -->
|
|
<p-button
|
|
icon="pi pi-bookmark-fill"
|
|
label="Add Bookmark"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="addBookmark()"
|
|
size="small"
|
|
/>
|
|
|
|
<!-- Sleep timer -->
|
|
<p-button
|
|
#sleepTimerBtn
|
|
icon="pi pi-moon"
|
|
[label]="sleepTimerActive ? formatSleepTimerRemaining() : 'Sleep Timer'"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
[styleClass]="sleepTimerActive ? 'sleep-timer-active' : ''"
|
|
(onClick)="sleepTimerMenu.toggle($event)"
|
|
size="small"
|
|
/>
|
|
<p-menu
|
|
#sleepTimerMenu
|
|
[model]="sleepTimerOptions"
|
|
[popup]="true"
|
|
appendTo="body"
|
|
/>
|
|
</div>
|
|
|
|
<!-- Audio details -->
|
|
<div class="audio-details">
|
|
@if (audiobookInfo.narrator) {
|
|
<span class="detail-item">
|
|
<i class="pi pi-user"></i>
|
|
Narrated by {{ audiobookInfo.narrator }}
|
|
</span>
|
|
}
|
|
@if (audiobookInfo.bitrate) {
|
|
<span class="detail-item">
|
|
<i class="pi pi-sliders-h"></i>
|
|
{{ audiobookInfo.bitrate }} kbps
|
|
</span>
|
|
}
|
|
@if (audiobookInfo.durationMs) {
|
|
<span class="detail-item">
|
|
<i class="pi pi-clock"></i>
|
|
{{ formatDuration(audiobookInfo.durationMs) }} total
|
|
</span>
|
|
}
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Track/Chapter list sidebar -->
|
|
@if (showTrackList) {
|
|
<aside class="track-list-sidebar">
|
|
<div class="sidebar-header">
|
|
<h2>{{ audiobookInfo.folderBased ? 'Tracks' : 'Chapters' }}</h2>
|
|
<p-button
|
|
icon="pi pi-times"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="toggleTrackList()"
|
|
/>
|
|
</div>
|
|
<div class="sidebar-content">
|
|
@if (audiobookInfo.folderBased && audiobookInfo.tracks) {
|
|
<ul class="track-list">
|
|
@for (track of audiobookInfo.tracks; track track.index) {
|
|
<li
|
|
class="track-item"
|
|
[class.active]="track.index === currentTrackIndex"
|
|
(click)="selectTrack(track)"
|
|
>
|
|
<span class="track-index">{{ track.index + 1 }}</span>
|
|
<div class="track-details">
|
|
<span class="track-name">{{ track.title }}</span>
|
|
<span class="track-duration">{{ formatDuration(track.durationMs) }}</span>
|
|
</div>
|
|
@if (track.index === currentTrackIndex && isPlaying) {
|
|
<i class="pi pi-volume-up playing-indicator"></i>
|
|
}
|
|
</li>
|
|
}
|
|
</ul>
|
|
} @else if (audiobookInfo.chapters) {
|
|
<ul class="track-list">
|
|
@for (chapter of audiobookInfo.chapters; track chapter.index) {
|
|
<li
|
|
class="track-item"
|
|
[class.active]="getCurrentChapter()?.index === chapter.index"
|
|
(click)="selectChapter(chapter)"
|
|
>
|
|
<span class="track-index">{{ chapter.index + 1 }}</span>
|
|
<div class="track-details">
|
|
<span class="track-name">{{ chapter.title }}</span>
|
|
<span class="track-duration">{{ formatDuration(chapter.durationMs) }}</span>
|
|
</div>
|
|
@if (getCurrentChapter()?.index === chapter.index && isPlaying) {
|
|
<i class="pi pi-volume-up playing-indicator"></i>
|
|
}
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
</div>
|
|
</aside>
|
|
}
|
|
|
|
<!-- Bookmark list sidebar -->
|
|
@if (showBookmarkList) {
|
|
<aside class="track-list-sidebar bookmark-sidebar">
|
|
<div class="sidebar-header">
|
|
<h2>Bookmarks</h2>
|
|
<p-button
|
|
icon="pi pi-times"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="secondary"
|
|
(onClick)="toggleBookmarkList()"
|
|
/>
|
|
</div>
|
|
<div class="sidebar-content">
|
|
@if (bookmarks.length === 0) {
|
|
<div class="empty-bookmarks">
|
|
<i class="pi pi-bookmark"></i>
|
|
<p>No bookmarks yet</p>
|
|
<span>Add a bookmark to save your place</span>
|
|
</div>
|
|
} @else {
|
|
<ul class="track-list">
|
|
@for (bookmark of bookmarks; track bookmark.id) {
|
|
<li
|
|
class="track-item bookmark-item"
|
|
(click)="goToBookmark(bookmark)"
|
|
>
|
|
<i class="pi pi-bookmark-fill bookmark-icon"></i>
|
|
<div class="track-details">
|
|
<span class="track-name">{{ bookmark.title }}</span>
|
|
<span class="track-duration">{{ formatBookmarkPosition(bookmark) }}</span>
|
|
</div>
|
|
<p-button
|
|
icon="pi pi-trash"
|
|
[rounded]="true"
|
|
[text]="true"
|
|
severity="danger"
|
|
size="small"
|
|
(onClick)="deleteBookmark($event, bookmark.id)"
|
|
pTooltip="Delete"
|
|
tooltipPosition="left"
|
|
/>
|
|
</li>
|
|
}
|
|
</ul>
|
|
}
|
|
</div>
|
|
</aside>
|
|
}
|
|
</div>
|
|
}
|