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:
@@ -16,6 +16,7 @@ app:
|
||||
force-disable-oidc: ${FORCE_DISABLE_OIDC:false}
|
||||
telemetry:
|
||||
base-url: ${TELEMETRY_BASE_URL:https://telemetry.booklore.org}
|
||||
disk-type: ${DISK_TYPE:LOCAL}
|
||||
|
||||
server:
|
||||
forward-headers-strategy: native
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
CREATE TABLE user_book_file_progress (
|
||||
id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
book_file_id BIGINT NOT NULL,
|
||||
position_data VARCHAR(1000),
|
||||
position_href VARCHAR(1000),
|
||||
progress_percent FLOAT,
|
||||
last_read_time TIMESTAMP,
|
||||
CONSTRAINT uk_user_book_file UNIQUE (user_id, book_file_id),
|
||||
CONSTRAINT fk_ubfp_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_ubfp_book_file FOREIGN KEY (book_file_id) REFERENCES book_file(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX idx_ubfp_user_book_file ON user_book_file_progress(user_id, book_file_id);
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
-- Migrate default_book_format (single value) to format_priority (JSON array)
|
||||
-- This allows users to set a prioritized list of preferred formats with cascading fallback
|
||||
|
||||
-- Add new column
|
||||
ALTER TABLE library ADD COLUMN IF NOT EXISTS format_priority TEXT NULL;
|
||||
|
||||
-- Migrate existing data: convert single format to JSON array with that format as first element
|
||||
UPDATE library
|
||||
SET format_priority = CONCAT('["', default_book_format, '"]')
|
||||
WHERE default_book_format IS NOT NULL AND default_book_format != '';
|
||||
|
||||
-- Drop old column
|
||||
ALTER TABLE library DROP COLUMN IF EXISTS default_book_format;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
-- Add is_folder_based column to book_file table for folder-based audiobooks
|
||||
ALTER TABLE book_file ADD COLUMN is_folder_based BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
-- Add organization_mode column and migrate from legacy scan_mode
|
||||
-- FOLDER_AS_BOOK -> BOOK_PER_FOLDER (preserves existing behavior)
|
||||
-- FILE_AS_BOOK/NULL/unknown -> AUTO_DETECT (new default)
|
||||
|
||||
ALTER TABLE library ADD COLUMN organization_mode VARCHAR(50);
|
||||
|
||||
-- Migrate known values
|
||||
UPDATE library SET organization_mode = 'BOOK_PER_FOLDER' WHERE scan_mode = 'FOLDER_AS_BOOK';
|
||||
UPDATE library SET organization_mode = 'AUTO_DETECT' WHERE scan_mode IS NULL OR scan_mode = 'FILE_AS_BOOK';
|
||||
|
||||
-- Safety net: set any remaining NULL values (handles unexpected scan_mode values)
|
||||
UPDATE library SET organization_mode = 'AUTO_DETECT' WHERE organization_mode IS NULL;
|
||||
|
||||
-- Set default and make non-null for future inserts
|
||||
ALTER TABLE library ALTER COLUMN organization_mode SET DEFAULT 'AUTO_DETECT';
|
||||
ALTER TABLE library MODIFY COLUMN organization_mode VARCHAR(50) NOT NULL DEFAULT 'AUTO_DETECT';
|
||||
|
||||
-- Remove legacy column
|
||||
ALTER TABLE library DROP COLUMN scan_mode;
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Add columns for audiobook bookmarks
|
||||
ALTER TABLE book_marks ADD COLUMN IF NOT EXISTS position_ms BIGINT;
|
||||
ALTER TABLE book_marks ADD COLUMN IF NOT EXISTS track_index INTEGER;
|
||||
|
||||
-- Make cfi nullable (audiobook bookmarks don't use cfi)
|
||||
ALTER TABLE book_marks MODIFY COLUMN cfi VARCHAR(1000) NULL;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
-- Make reading session columns nullable for audiobook support
|
||||
-- Audiobooks may not have progress percentage data
|
||||
|
||||
ALTER TABLE reading_sessions
|
||||
ADD COLUMN duration_formatted VARCHAR(50) NULL;
|
||||
|
||||
ALTER TABLE reading_sessions
|
||||
MODIFY COLUMN start_progress FLOAT NULL;
|
||||
|
||||
ALTER TABLE reading_sessions
|
||||
MODIFY COLUMN end_progress FLOAT NULL;
|
||||
|
||||
ALTER TABLE reading_sessions
|
||||
MODIFY COLUMN progress_delta FLOAT NULL;
|
||||
|
||||
ALTER TABLE reading_sessions
|
||||
MODIFY COLUMN start_location VARCHAR(500) NULL;
|
||||
|
||||
ALTER TABLE reading_sessions
|
||||
MODIFY COLUMN end_location VARCHAR(500) NULL;
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Add is_physical column to book table for physical book support
|
||||
ALTER TABLE book ADD COLUMN is_physical BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
||||
-- Make library_path_id nullable for physical books (they don't have a file path)
|
||||
ALTER TABLE book MODIFY COLUMN library_path_id BIGINT NULL;
|
||||
|
||||
-- Add index for physical books
|
||||
CREATE INDEX idx_book_is_physical ON book(is_physical);
|
||||
Reference in New Issue
Block a user