Introduce multi-format book support, including audiobooks (#2486)

* 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>
This commit is contained in:
ACX
2026-01-27 10:12:50 -07:00
committed by GitHub
co-authored by acx10
parent c23e38b5a5
commit 3f334202b6
340 changed files with 23225 additions and 20727 deletions
@@ -1,170 +1,124 @@
.main-container {
width: 100%;
padding: 1rem;
height: calc(100dvh - 10.5rem);
overflow-y: auto;
border-width: 1px;
border-radius: 0.5rem;
@use '../../../shared/styles/settings-shared' as settings;
@media (min-width: 768px) {
height: calc(100dvh - 11.65rem);
}
.file-naming-container {
@include settings.settings-page-container;
}
.enclosing-container {
border-color: var(--p-content-border-color);
background: var(--p-content-background);
}
.settings-header {
margin-top: 1rem;
margin-bottom: 2rem;
}
@include settings.settings-page-header;
@include settings.settings-section-divider;
.settings-title {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 1.25rem;
font-weight: 700;
color: var(--p-text-color);
margin: 0 0 0.75rem 0;
.pi {
color: var(--p-primary-color);
font-size: 1.25rem;
}
@include settings.settings-page-title;
margin-bottom: 0.75rem;
}
.settings-description {
color: var(--p-text-muted-color);
font-size: 0.9rem;
line-height: 1.5;
@include settings.settings-page-description;
}
.warning-notice {
margin-top: -2rem;
margin-bottom: 1rem;
}
.important-warning {
border: 1px solid var(--p-red-900);
border-left: 4px solid var(--p-red-500);
background: rgba(127, 29, 29, 0.2);
padding: 1rem;
border-radius: 6px;
margin-bottom: 2rem;
h4 {
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--p-red-300);
font-weight: 700;
margin: 0 0 0.5rem 0;
font-size: 0.95rem;
}
p {
color: var(--p-red-100);
font-size: 0.85rem;
line-height: 1.5;
margin: 0 0 0.5rem 0;
&:last-child {
margin-bottom: 0;
}
}
strong {
color: var(--p-red-200);
text-decoration: underline;
}
}
.settings-content {
display: flex;
flex-direction: column;
gap: 3rem;
}
.preferences-section {
@media (min-width: 768px) {
padding: 0 1rem;
}
}
.section-header {
margin-bottom: 1rem;
}
.section-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 1.125rem;
font-weight: 600;
color: var(--p-text-color);
margin: 0 0 0.5rem 0;
.pi {
color: var(--p-primary-color);
}
}
.section-description {
color: var(--p-text-muted-color);
font-size: 0.9rem;
line-height: 1.5;
margin: 0;
@include settings.settings-warning-notice;
}
.settings-card {
border: 1px solid var(--p-content-border-color);
border-radius: 8px;
background: var(--p-content-background);
padding: 1.5rem;
@include settings.settings-card;
}
.section-header {
@include settings.settings-section-header;
}
.section-title {
@include settings.settings-section-title;
}
.section-description {
@include settings.settings-section-description;
}
.section-body {
@include settings.settings-section-body;
}
// Empty state
.empty-state {
display: flex;
flex-direction: column;
gap: 1.5rem;
align-items: center;
justify-content: center;
padding: 3rem 2rem;
text-align: center;
color: var(--p-text-muted-color);
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border-radius: 6px;
@media (max-width: 767px) {
padding: 1rem;
gap: 1rem;
.pi {
font-size: 2.5rem;
margin-bottom: 1rem;
opacity: 0.5;
}
.empty-title {
font-size: 1rem;
font-weight: 600;
margin: 0 0 0.5rem 0;
color: var(--p-text-color);
}
.empty-subtitle {
font-size: settings.$settings-section-description-size;
margin: 0;
}
}
.form-field {
// Default pattern card
.default-pattern-card {
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border: 1px solid var(--p-content-border-color);
border-left: 3px solid var(--p-primary-color);
border-radius: 6px;
padding: 1rem;
}
.pattern-input-container {
display: flex;
flex-direction: column;
gap: 0.5rem;
label {
font-weight: 600;
color: var(--p-text-color);
font-size: 0.9rem;
}
}
.pattern-input-group {
.pattern-input-row {
display: flex;
gap: 1rem;
gap: 0.75rem;
align-items: flex-start;
@media (max-width: 768px) {
flex-direction: column;
gap: 0.75rem;
gap: 0.5rem;
p-button {
align-self: flex-end;
}
}
}
.error-message {
color: var(--p-red-500);
font-size: 0.9rem;
margin-top: 0.25rem;
.pattern-input {
flex: 1;
width: 100%;
}
.preview-section {
display: flex;
gap: 0.5rem;
align-items: center;
.error-text {
@include settings.settings-error-text;
}
@media (max-width: 767px) {
.preview-row {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.25rem;
@media (max-width: 768px) {
flex-direction: column;
align-items: flex-start;
gap: 0.25rem;
@@ -172,277 +126,368 @@
}
.preview-label {
display: flex;
align-items: center;
gap: 0.375rem;
color: var(--p-text-muted-color);
font-size: 0.9rem;
font-size: settings.$settings-section-description-size;
white-space: nowrap;
.pi {
font-size: 0.75rem;
}
}
.preview-value {
color: var(--p-green-500);
font-size: 0.8rem;
font-family: monospace;
color: var(--p-green-400);
font-size: settings.$settings-section-description-size;
background: transparent;
padding: 0;
word-break: break-all;
}
.library-patterns {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.library-pattern-item {
// Libraries list
.libraries-list {
display: flex;
flex-direction: column;
gap: 0.75rem;
border: 1px solid var(--p-surface-800);
border-left: 3px solid var(--p-primary-color);
border-radius: 6px;
background: var(--p-surface-900);
padding: 1rem;
}
@media (max-width: 767px) {
padding: 0.75rem;
.library-item {
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border: 1px solid var(--p-content-border-color);
border-left: 3px solid var(--p-content-border-color);
border-radius: 6px;
transition: border-color 0.2s ease, background 0.2s ease;
&:hover {
background: color-mix(in srgb, var(--ground-background) 40%, var(--p-surface-800) 60%);
}
&.has-pattern {
border-left-color: var(--p-primary-color);
}
}
.library-header {
display: flex;
align-items: center;
gap: 0.5rem;
padding-bottom: 0.5rem;
justify-content: space-between;
gap: 1rem;
padding: 0.75rem 1rem;
border-bottom: 1px dashed var(--p-content-border-color);
@media (max-width: 600px) {
flex-wrap: wrap;
}
}
.library-info {
display: flex;
align-items: center;
gap: 0.75rem;
flex: 1;
min-width: 0;
}
.library-icon {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
background: color-mix(in srgb, var(--p-primary-color) 15%, transparent);
color: var(--p-primary-color);
border-radius: 6px;
flex-shrink: 0;
.pi {
color: var(--p-primary-color);
font-size: 0.875rem;
}
}
.library-name {
font-weight: 500;
color: var(--p-text-color);
min-width: 100px;
}
.library-input-group {
display: flex;
gap: 1rem;
align-items: flex-start;
@media (max-width: 768px) {
flex-direction: column;
gap: 0.75rem;
}
}
.form-actions {
display: flex;
justify-content: flex-end;
@media (max-width: 767px) {
justify-content: stretch;
p-button {
width: 100%;
}
}
}
.subsection-title {
font-size: 1rem;
font-weight: 600;
font-size: 0.9375rem;
color: var(--p-text-color);
margin-bottom: 1rem;
}
.placeholders-info {
display: flex;
flex-direction: column;
gap: 1.5rem;
@media (max-width: 767px) {
gap: 1rem;
}
.custom-badge {
display: inline-flex;
align-items: center;
padding: 0.125rem 0.5rem;
background: color-mix(in srgb, var(--p-primary-color) 15%, transparent);
color: var(--p-primary-color);
border-radius: 12px;
font-size: 0.625rem;
font-weight: 700;
text-transform: uppercase;
}
.placeholders-description {
color: var(--p-text-muted-color);
font-size: 0.9rem;
line-height: 1.5;
code {
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
}
.default-badge {
display: inline-flex;
align-items: center;
padding: 0.125rem 0.5rem;
background: color-mix(in srgb, #6b7280 15%, transparent);
color: #6b7280;
border-radius: 12px;
font-size: 0.625rem;
font-weight: 700;
text-transform: uppercase;
}
.library-body {
padding: 0.75rem 1rem;
}
.actions-row {
@include settings.settings-actions-row;
margin-top: 0.5rem;
}
// Placeholders Reference Section
.placeholders-grid {
display: grid;
grid-template-columns: 1fr;
gap: 2rem;
gap: 1rem;
@media (min-width: 768px) {
grid-template-columns: 1fr auto 1fr;
}
@media (max-width: 767px) {
gap: 1.5rem;
grid-template-columns: 1fr 1fr;
}
}
.placeholders-list {
ul {
list-style: disc;
padding-left: 1.5rem;
margin: 0;
.placeholder-group {
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border-radius: 6px;
padding: 1rem;
border-left: 3px solid var(--p-primary-color);
@media (max-width: 767px) {
padding-left: 1rem;
}
li {
color: var(--p-text-color);
font-size: 0.9rem;
margin-bottom: 0.5rem;
}
@media (max-width: 768px) {
padding: 0.75rem;
}
}
.placeholder-code {
color: var(--p-orange-400);
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
font-family: monospace;
}
.optional-blocks-info {
p {
color: var(--p-text-color);
font-size: 0.9rem;
line-height: 1.5;
margin-bottom: 1rem;
}
}
.example-section {
margin-top: 1rem;
}
.example-label {
.group-title {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: settings.$settings-label-size;
font-weight: 600;
color: var(--p-text-color);
margin-bottom: 0.5rem;
}
margin: 0 0 0.75rem 0;
.example-list {
list-style: disc;
padding-left: 1.5rem;
@media (max-width: 767px) {
padding-left: 0;
list-style: none;
}
li {
color: var(--p-text-color);
font-size: 0.9rem;
margin-bottom: 0.25rem;
.pi {
color: var(--p-primary-color);
font-size: 0.875rem;
}
}
.examples-section {
.group-description {
font-size: settings.$settings-section-description-size;
line-height: 1.5;
color: var(--p-text-muted-color);
margin: 0 0 0.75rem 0;
code {
color: var(--p-orange-400);
font-size: settings.$settings-description-size;
}
}
.placeholder-list {
display: flex;
flex-direction: column;
gap: 2rem;
gap: 0.375rem;
}
@media (max-width: 767px) {
gap: 1.5rem;
.placeholder-item {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: settings.$settings-section-description-size;
code {
color: var(--p-orange-400);
font-size: settings.$settings-description-size;
min-width: 130px;
}
span {
color: var(--p-text-muted-color);
}
}
.example-block {
background: color-mix(in srgb, var(--p-surface-800) 30%, transparent);
border-radius: 4px;
padding: 0.75rem;
}
.example-pattern {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
.pattern-prefix {
font-size: settings.$settings-description-size;
color: var(--p-text-muted-color);
}
code {
color: var(--p-orange-400);
font-size: settings.$settings-section-description-size;
}
}
.example-results {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.result-item {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: settings.$settings-section-description-size;
.result-prefix {
font-size: settings.$settings-description-size;
color: var(--p-text-muted-color);
min-width: 70px;
}
code {
color: var(--p-green-400);
font-size: settings.$settings-description-size;
}
}
// Pattern Examples Section
.examples-container {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.example-category {
display: flex;
flex-direction: column;
gap: 1rem;
gap: 0.75rem;
}
.metadata-sample {
.category-header {
margin-bottom: 0.25rem;
}
.category-title {
display: flex;
flex-direction: column;
gap: 0.25rem;
background: var(--p-surface-800);
padding: 1rem;
border-radius: 6px;
margin-bottom: 1rem;
align-items: center;
gap: 0.5rem;
font-size: settings.$settings-label-size;
font-weight: 600;
color: var(--p-text-color);
margin: 0 0 0.5rem 0;
@media (max-width: 767px) {
padding: 0.75rem;
.pi {
font-size: 0.875rem;
}
span {
font-size: 0.9rem;
color: var(--p-text-muted-color);
.pi-check-circle {
color: var(--p-green-400);
}
code {
color: var(--p-text-color);
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
}
.pi-question-circle {
color: var(--p-orange-400);
}
}
.example-list {
.sample-metadata {
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
padding: 0.75rem 1rem;
border-radius: 4px;
border-left: 3px solid var(--p-content-border-color);
}
.metadata-items {
display: flex;
flex-direction: column;
gap: 1rem;
@media (max-width: 767px) {
gap: 0.75rem;
}
}
.example-item {
background: var(--p-surface-800);
padding: 1rem;
border-radius: 6px;
border-left: 3px solid var(--p-primary-color);
@media (max-width: 767px) {
padding: 0.75rem;
}
}
.example-pattern {
font-size: 0.9rem;
margin-bottom: 0.5rem;
flex-wrap: wrap;
gap: 0.5rem 1rem;
font-size: settings.$settings-section-description-size;
color: var(--p-text-muted-color);
strong {
color: var(--p-text-color);
font-weight: 500;
}
code {
color: var(--p-text-muted-color);
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
color: var(--p-text-color);
font-size: settings.$settings-description-size;
}
.not-set {
opacity: 0.6;
font-style: italic;
}
}
.example-output {
font-size: 0.9rem;
margin: 0;
.example-grid {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
strong {
.example-row {
display: grid;
grid-template-columns: 130px 1fr 1fr;
gap: 0.75rem;
padding: 0.625rem 0.75rem;
background: color-mix(in srgb, var(--ground-background) 50%, var(--p-surface-800) 50%);
border-radius: 4px;
font-size: settings.$settings-section-description-size;
align-items: center;
@media (max-width: 1024px) {
grid-template-columns: 1fr;
gap: 0.375rem;
padding: 0.625rem 0.75rem;
}
}
.pattern-label {
color: var(--p-text-muted-color);
font-size: settings.$settings-section-description-size;
white-space: nowrap;
@media (max-width: 1024px) {
font-weight: 500;
color: var(--p-text-color);
}
}
.pattern-col {
code {
color: var(--p-text-muted-color);
padding: 0.125rem 0.25rem;
border-radius: 3px;
font-size: 0.75rem;
color: var(--p-orange-400);
font-size: settings.$settings-description-size;
word-break: break-all;
}
@media (max-width: 1024px) {
padding-left: 0.5rem;
}
}
.full-width {
width: 100%;
.result-col {
code {
color: var(--p-green-400);
font-size: settings.$settings-description-size;
word-break: break-all;
}
@media (max-width: 1024px) {
padding-left: 0.5rem;
border-left: 2px solid var(--p-green-400);
}
}