Skip to content

fix: filetype, filesize in library, magic shelf, opds#2806

Open
WorldTeacher wants to merge 8 commits intobooklore-app:developfrom
WorldTeacher:filetype-filesize-fix
Open

fix: filetype, filesize in library, magic shelf, opds#2806
WorldTeacher wants to merge 8 commits intobooklore-app:developfrom
WorldTeacher:filetype-filesize-fix

Conversation

@WorldTeacher
Copy link
Collaborator

📝 Description

This fixes the filetype and filesize filters in

  • OPDS
  • Library View
  • Magic Shelves

Linked Issue: Fixes #2651

Required. Every PR must reference an approved issue. If no issue exists, open one and wait for maintainer approval before submitting a PR. Unsolicited PRs without a linked issue will be closed.

🏷️ Type of Change

  • Bug fix
  • New feature
  • Enhancement to existing feature
  • Refactor (no behavior change)
  • Breaking change (existing functionality affected)
  • Documentation update

🔧 Changes

  • changed filesize: use book.primaryFile?.fileSizeKb instead of book.fileSizeKb
  • changed filetype: use book.primaryFile?.bookType instead of book['bookType']
  • added filesize for OPDS feed as feed.append(" length=\"").append(bookFile.getFileSizeKb() * 1024).append("\"");
  • changed the BookRuleEvaluatorService FILE_SIZE to fix filesize
  • added file size ranges: 100-250 MB, 2-5GB, which were missing from the ranges
  • added / updated tests to test for filesize and filetype

🧪 Testing (MANDATORY)

PRs without this section filled out will be closed. "Tests pass" or "Tested locally" is not sufficient. You must provide specifics.

Manual testing steps you performed:

  1. ran local tests for front- and backend
  2. verified a docker image can be run
  3. tested all filters in the library, magic shelf and opds feed

Regression testing:

  • as no other areas were touched, existing features did not change

Edge cases covered:

  • none / unclear

Test output:

Backend test output (./gradlew test)
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Management of bidirectional association persistent attributes is deprecated and will be removed. Set the value to 'false' to get rid of this warning

> Task :compileTestJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2026-02-19T20:45:49.271+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler     : Stopping...
2026-02-19T20:45:49.271+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler     : BrokerAvailabilityEvent[available=false, SimpleBrokerMessageHandler [org.springframework.messaging.simp.broker.DefaultSubscriptionRegistry@22c2919b]]
2026-02-19T20:45:49.271+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.s.m.s.b.SimpleBrokerMessageHandler     : Stopped.
2026-02-19T20:45:49.279+01:00  INFO 2179454 --- [booklore-api] [opFolderWatcher] o.b.s.b.BookdropMonitoringService        : Bookdrop monitor thread interrupted
2026-02-19T20:45:49.298+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.b.BookdropMonitoringService        : Stopped bookdrop folder monitor
2026-02-19T20:45:49.598+01:00  INFO 2179454 --- [booklore-api] [opFileProcessor] o.b.s.b.BookdropEventHandlerService      : File processing thread interrupted, shutting down.
2026-02-19T20:45:49.599+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.monitoring.MonitoringService       : Shutting down monitoring service...
2026-02-19T20:45:49.599+01:00  WARN 2179454 --- [booklore-api] [        async-0] o.b.service.monitoring.MonitoringTask    : WatchService has been closed. Stopping monitoring.
2026-02-19T20:45:49.599+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.watcher.LibraryFileEventProcessor  : Shutting down LibraryFileEventProcessor...
2026-02-19T20:45:49.603+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2026-02-19T20:45:49.613+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown initiated...
2026-02-19T20:45:49.613+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown completed.
2026-02-19T20:45:49.617+01:00  INFO 2179454 --- [booklore-api] [opFolderWatcher] o.b.s.b.BookdropMonitoringService        : Bookdrop monitor thread interrupted
2026-02-19T20:45:49.617+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.b.BookdropMonitoringService        : Stopped bookdrop folder monitor
2026-02-19T20:45:49.617+01:00  INFO 2179454 --- [booklore-api] [opFileProcessor] o.b.s.b.BookdropEventHandlerService      : File processing thread interrupted, shutting down.
2026-02-19T20:45:49.618+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.monitoring.MonitoringService       : Shutting down monitoring service...
2026-02-19T20:45:49.618+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.watcher.LibraryFileEventProcessor  : Shutting down LibraryFileEventProcessor...
2026-02-19T20:45:49.618+01:00  WARN 2179454 --- [booklore-api] [        async-0] o.b.service.monitoring.MonitoringTask    : WatchService has been closed. Stopping monitoring.
2026-02-19T20:45:49.623+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2026-02-19T20:45:49.625+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown initiated...
2026-02-19T20:45:49.625+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown completed.
2026-02-19T20:45:49.628+01:00  INFO 2179454 --- [booklore-api] [opFolderWatcher] o.b.s.b.BookdropMonitoringService        : Bookdrop monitor thread interrupted
2026-02-19T20:45:49.628+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.b.BookdropMonitoringService        : Stopped bookdrop folder monitor
2026-02-19T20:45:49.628+01:00  INFO 2179454 --- [booklore-api] [opFileProcessor] o.b.s.b.BookdropEventHandlerService      : File processing thread interrupted, shutting down.
2026-02-19T20:45:49.629+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.monitoring.MonitoringService       : Shutting down monitoring service...
2026-02-19T20:45:49.629+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.watcher.LibraryFileEventProcessor  : Shutting down LibraryFileEventProcessor...
2026-02-19T20:45:49.629+01:00  WARN 2179454 --- [booklore-api] [        async-0] o.b.service.monitoring.MonitoringTask    : WatchService has been closed. Stopping monitoring.
2026-02-19T20:45:49.634+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2026-02-19T20:45:49.638+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown initiated...
2026-02-19T20:45:49.638+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown completed.
2026-02-19T20:45:49.642+01:00  INFO 2179454 --- [booklore-api] [opFolderWatcher] o.b.s.b.BookdropMonitoringService        : Bookdrop monitor thread interrupted
2026-02-19T20:45:49.642+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.b.BookdropMonitoringService        : Stopped bookdrop folder monitor
2026-02-19T20:45:49.642+01:00  INFO 2179454 --- [booklore-api] [opFileProcessor] o.b.s.b.BookdropEventHandlerService      : File processing thread interrupted, shutting down.
2026-02-19T20:45:49.643+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.monitoring.MonitoringService       : Shutting down monitoring service...
2026-02-19T20:45:49.643+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.watcher.LibraryFileEventProcessor  : Shutting down LibraryFileEventProcessor...
2026-02-19T20:45:49.643+01:00  WARN 2179454 --- [booklore-api] [        async-0] o.b.service.monitoring.MonitoringTask    : WatchService has been closed. Stopping monitoring.
2026-02-19T20:45:49.648+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2026-02-19T20:45:49.652+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown initiated...
2026-02-19T20:45:49.653+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown completed.
2026-02-19T20:45:49.656+01:00  INFO 2179454 --- [booklore-api] [opFolderWatcher] o.b.s.b.BookdropMonitoringService        : Bookdrop monitor thread interrupted
2026-02-19T20:45:49.656+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.b.BookdropMonitoringService        : Stopped bookdrop folder monitor
2026-02-19T20:45:49.656+01:00  INFO 2179454 --- [booklore-api] [opFileProcessor] o.b.s.b.BookdropEventHandlerService      : File processing thread interrupted, shutting down.
2026-02-19T20:45:49.657+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.monitoring.MonitoringService       : Shutting down monitoring service...
2026-02-19T20:45:49.657+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.watcher.LibraryFileEventProcessor  : Shutting down LibraryFileEventProcessor...
2026-02-19T20:45:49.657+01:00  WARN 2179454 --- [booklore-api] [        async-0] o.b.service.monitoring.MonitoringTask    : WatchService has been closed. Stopping monitoring.
2026-02-19T20:45:49.662+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2026-02-19T20:45:49.666+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown initiated...
2026-02-19T20:45:49.666+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown completed.
2026-02-19T20:45:49.670+01:00  INFO 2179454 --- [booklore-api] [opFolderWatcher] o.b.s.b.BookdropMonitoringService        : Bookdrop monitor thread interrupted
2026-02-19T20:45:49.685+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.b.BookdropMonitoringService        : Stopped bookdrop folder monitor
2026-02-19T20:45:49.685+01:00  INFO 2179454 --- [booklore-api] [opFileProcessor] o.b.s.b.BookdropEventHandlerService      : File processing thread interrupted, shutting down.
2026-02-19T20:45:49.686+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.monitoring.MonitoringService       : Shutting down monitoring service...
2026-02-19T20:45:49.686+01:00  WARN 2179454 --- [booklore-api] [        async-0] o.b.service.monitoring.MonitoringTask    : WatchService has been closed. Stopping monitoring.
2026-02-19T20:45:49.686+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] o.b.s.watcher.LibraryFileEventProcessor  : Shutting down LibraryFileEventProcessor...
2026-02-19T20:45:49.690+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2026-02-19T20:45:49.693+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown initiated...
2026-02-19T20:45:49.694+01:00  INFO 2179454 --- [booklore-api] [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : BookloreHikariPool - Shutdown completed.

[Incubating] Problems report is available at: file:///home/user/GitHub/booklore/booklore-api/build/reports/problems/problems-report.html

BUILD SUCCESSFUL in 1m 4s
6 actionable tasks: 5 executed, 1 up-to-date
Consider enabling configuration cache to speed up this build: https://docs.gradle.org/9.3.1/userguide/configuration_cache_enabling.html
Frontend test output (ng test)
Initial chunk files                                                            | Names                                                                       |  Raw size
spec-app-features-magic-shelf-component-magic-shelf-component.js               | spec-app-features-magic-shelf-component-magic-shelf-component               |   1.09 MB | 
spec-app-features-magic-shelf-service-book-rule-evaluator.service.js           | spec-app-features-magic-shelf-service-book-rule-evaluator.service           |  64.04 kB | 
chunk-7GUG5YIO.js                                                              | -                                                                           |  60.70 kB | 
spec-app-app.component.js                                                      | spec-app-app.component                                                      |  58.63 kB | 
styles.css                                                                     | styles                                                                      |  30.99 kB | 
chunk-GFQBFBNK.js                                                              | -                                                                           |  24.24 kB | 
spec-app-features-magic-shelf-service-book-rule-evaluator-metadata-presence.js | spec-app-features-magic-shelf-service-book-rule-evaluator-metadata-presence |  23.21 kB | 
chunk-EREA7DEY.js                                                              | -                                                                           |  15.59 kB | 
spec-app-features-magic-shelf-service-magic-shelf-utils.js                     | spec-app-features-magic-shelf-service-magic-shelf-utils                     |  11.36 kB | 
spec-app-core-security-auth-initializer.js                                     | spec-app-core-security-auth-initializer                                     |   8.69 kB | 
chunk-PUIDBMXW.js                                                              | -                                                                           |   6.10 kB | 
chunk-TRPOYXPA.js                                                              | -                                                                           |   4.86 kB | 
chunk-3J3QIHZF.js                                                              | -                                                                           |   2.19 kB | 
chunk-HPNCK62B.js                                                              | -                                                                           |   1.33 kB | 
init-testbed.js                                                                | init-testbed                                                                |   1.27 kB | 
spec-app-app.js                                                                | spec-app-app                                                                | 202 bytes | 
polyfills.js                                                                   | polyfills                                                                   | 121 bytes | 

                                                                               | Initial total                                                               |   1.41 MB

Application bundle generation complete. [3.842 seconds] - 2026-02-19T19:43:59.482Z

Watch mode enabled. Watching for file changes...

 DEV  v4.0.18 /home/user/GitHub/booklore/booklore-ui

 ✓  booklore  src/app/app.spec.ts (1 test) 2ms
 ✓  booklore  src/app/features/magic-shelf/service/magic-shelf-utils.spec.ts (46 tests) 14ms
 ✓  booklore  src/app/core/security/auth-initializer.spec.ts (2 tests) 16ms
 ✓  booklore  src/app/features/magic-shelf/service/book-rule-evaluator-metadata-presence.spec.ts (85 tests) 88ms
 ✓  booklore  src/app/features/magic-shelf/service/book-rule-evaluator.service.spec.ts (195 tests) 173ms
 ✓  booklore  src/app/app.component.spec.ts (7 tests) 195ms
 ✓  booklore  src/app/features/magic-shelf/component/magic-shelf-component.spec.ts (73 tests) 333ms

 Test Files  7 passed (7)
      Tests  409 passed (409)
   Start at  20:43:59
   Duration  1.95s (transform 875ms, setup 1.15s, import 3.34s, tests 821ms, environment 2.30s)

JUNIT report written to /home/user/GitHub/booklore/booklore-ui/test-results/vitest-results.xml

📸 Screen Recording / Screenshots (MANDATORY)

Every PR must include a screen recording or screenshots showing the change working end-to-end in a running local instance (both backend and frontend). This means you must have actually built, run, and tested the code yourself. PRs without visual proof will be closed without review.

previous state can be seen in the linked issue

after applying the PR:
library:
image
magic shelf (both had 0 before:
image
OPDS:
image


✅ Pre-Submission Checklist

All boxes must be checked before requesting review. Incomplete PRs will be closed without review. No exceptions.

  • This PR is linked to an approved issue
  • Code follows project style guidelines and conventions
  • Branch is up to date with develop (merge conflicts resolved)
  • I ran the full stack locally (backend + frontend + database) and verified the change works
  • Automated tests added or updated to cover changes (backend and frontend)
  • All tests pass locally and output is pasted above
  • Screen recording or screenshots are attached above proving the change works
  • PR is a single focused change (one bug fix OR one feature, not multiple unrelated changes)
  • PR is reasonably scoped (PRs over 1000+ changed lines will be closed, split into smaller PRs)
  • No unsolicited refactors, cleanups, or "improvements" are bundled in
  • Flyway migration versioning is correct (if schema was modified)
  • Documentation PR submitted to booklore-docs (if user-facing changes)

🤖 AI-Assisted Contributions

If any part of this PR was generated or assisted by AI tools (Copilot, Claude, ChatGPT, etc.), all items below are mandatory. You are fully responsible for every line you submit. "The AI wrote it" is not an excuse, and AI-generated PRs that clearly haven't been reviewed are the #1 reason PRs get closed.

  • I have read and understand every line of this PR and can explain any part of it during review
  • I personally ran the code and verified it works (not just trusted the AI's output)
  • PR is scoped to a single logical change, not a dump of everything the AI suggested
  • Tests validate actual behavior, not just coverage (AI-generated tests often assert nothing meaningful)
  • No dead code, placeholder comments, TODOs, or unused scaffolding left behind by AI
  • I did not submit refactors, style changes, or "improvements" the AI suggested beyond the scope of the issue

💬 Additional Context (optional)

@WorldTeacher
Copy link
Collaborator Author

@acx10 I'll take a look at the review tmrw

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes broken filesize and filetype filtering functionality in the library view, magic shelves, and OPDS feeds. The root cause was that the code was attempting to access file properties directly on the Book object rather than through the primaryFile nested object. The fix updates all locations to use book.primaryFile?.fileSizeKb and book.primaryFile?.bookType, adds missing file size ranges, implements file size metadata in OPDS feeds, and consolidates comic book format options (CBR/CBZ/CB7) into the unified CBX type.

Changes:

  • Updated all frontend file size and file type references to use book.primaryFile structure across filtering, sorting, and display components
  • Enhanced backend BookRuleEvaluatorService to query the bookFiles table with proper joins for FILE_SIZE and FILE_TYPE fields, including file type mapping (cbr/cbz/cb7→cbx, azw→azw3)
  • Added file size attribute to OPDS acquisition links and expanded file size ranges to include 100-250 MB and 2-5 GB brackets
  • Consolidated magic shelf file type dropdown from separate CBR/CBZ/CB7 options to single CBX option, and updated comprehensive test coverage for both frontend and backend

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
booklore-ui/.../libraries-summary.service.ts Updated total size calculation to use book.primaryFile?.fileSizeKb
booklore-ui/.../book-rule-evaluator.service.ts Changed file type and size extraction to use primaryFile properties
booklore-ui/.../book-rule-evaluator.service.spec.ts Updated test helper to create books with primaryFile structure
booklore-ui/.../magic-shelf-component.ts Consolidated CBR/CBZ/CB7 into single CBX option in file type dropdown
booklore-ui/.../sort.service.ts Updated file size sorting to use book.primaryFile?.fileSizeKb
booklore-ui/.../sidebar-filter.ts Updated file size filtering to use book.primaryFile?.fileSizeKb
booklore-ui/.../book-table.component.ts Updated file size display to use book.primaryFile?.fileSizeKb
booklore-ui/.../book-filter.config.ts Added new file size ranges (100-250 MB, 2-5 GB) and updated extractors
booklore-api/.../OpdsFeedService.java Added file size in bytes to OPDS acquisition links
booklore-api/.../BookRuleEvaluatorService.java Implemented joins to bookFiles table for FILE_SIZE and FILE_TYPE with mapping logic
booklore-api/.../BookRuleEvaluatorServiceIntegrationTest.java Added comprehensive tests for file size and file type filtering with edge cases
Comments suppressed due to low confidence (2)

booklore-api/src/main/java/org/booklore/service/BookRuleEvaluatorService.java:794

  • Each call to getFieldExpression for FILE_SIZE or FILE_TYPE creates a new join to the bookFiles table. If a single magic shelf rule has multiple conditions on fileSize or fileType (e.g., "fileSize > 1000 AND fileSize < 5000"), this will create multiple joins which could lead to inefficient queries or unexpected behavior.

Consider caching the bookFileJoin at the query level (e.g., in the toSpecification method or buildPredicate method) and reusing it, similar to how progressJoin is created once and passed down to all predicate builders.

            case FILE_SIZE -> {
                Join<BookEntity, BookFileEntity> bookFileJoin = root.join("bookFiles", JoinType.LEFT);
                bookFileJoin.on(cb.isTrue(bookFileJoin.get("isBookFormat")));
                yield bookFileJoin.get("fileSizeKb");
            }
            case METADATA_SCORE -> root.get("metadataMatchScore");
            case TITLE -> root.get("metadata").get("title");
            case SUBTITLE -> root.get("metadata").get("subtitle");
            case PUBLISHER -> root.get("metadata").get("publisher");
            case PUBLISHED_DATE -> root.get("metadata").get("publishedDate");
            case PAGE_COUNT -> root.get("metadata").get("pageCount");
            case LANGUAGE -> root.get("metadata").get("language");
            case SERIES_NAME -> root.get("metadata").get("seriesName");
            case SERIES_NUMBER -> root.get("metadata").get("seriesNumber");
            case SERIES_TOTAL -> root.get("metadata").get("seriesTotal");
            case ISBN13 -> root.get("metadata").get("isbn13");
            case ISBN10 -> root.get("metadata").get("isbn10");
            case AMAZON_RATING -> root.get("metadata").get("amazonRating");
            case AMAZON_REVIEW_COUNT -> root.get("metadata").get("amazonReviewCount");
            case GOODREADS_RATING -> root.get("metadata").get("goodreadsRating");
            case GOODREADS_REVIEW_COUNT -> root.get("metadata").get("goodreadsReviewCount");
            case HARDCOVER_RATING -> root.get("metadata").get("hardcoverRating");
            case HARDCOVER_REVIEW_COUNT -> root.get("metadata").get("hardcoverReviewCount");
            case RANOBEDB_RATING -> root.get("metadata").get("ranobedbRating");
            case AGE_RATING -> root.get("metadata").get("ageRating");
            case CONTENT_RATING -> root.get("metadata").get("contentRating");
            case ADDED_ON -> root.get("addedOn");
            case LUBIMYCZYTAC_RATING -> root.get("metadata").get("lubimyczytacRating");
            case DESCRIPTION -> root.get("metadata").get("description");
            case NARRATOR -> root.get("metadata").get("narrator");
            case AUDIBLE_RATING -> root.get("metadata").get("audibleRating");
            case AUDIBLE_REVIEW_COUNT -> root.get("metadata").get("audibleReviewCount");
            case ABRIDGED -> root.get("metadata").get("abridged");
            case AUDIOBOOK_DURATION -> root.join("bookFiles", JoinType.LEFT).get("durationSeconds");
            case IS_PHYSICAL -> root.get("isPhysical");
            case READING_PROGRESS -> {
                Expression<Float> koreader = cb.coalesce(progressJoin.get("koreaderProgressPercent"), 0f);
                Expression<Float> kobo = cb.coalesce(progressJoin.get("koboProgressPercent"), 0f);
                Expression<Float> pdf = cb.coalesce(progressJoin.get("pdfProgressPercent"), 0f);
                Expression<Float> epub = cb.coalesce(progressJoin.get("epubProgressPercent"), 0f);
                Expression<Float> cbx = cb.coalesce(progressJoin.get("cbxProgressPercent"), 0f);
                yield cb.function("GREATEST", Float.class, koreader, kobo, pdf, epub, cbx);
            }
            case FILE_TYPE -> {
                Join<BookEntity, BookFileEntity> bookFileJoin = root.join("bookFiles", JoinType.LEFT);
                bookFileJoin.on(cb.isTrue(bookFileJoin.get("isBookFormat")));
                yield bookFileJoin.get("bookType");
            }

booklore-ui/src/app/features/magic-shelf/component/magic-shelf-component.ts:281

  • The fileType dropdown options are missing the AUDIOBOOK type. According to the BookFileType enum in the backend, AUDIOBOOK is a valid book type that includes extensions like m4b, m4a, mp3, aac, flac, opus, and ogg. Users will not be able to create magic shelf rules that filter for audiobooks without this option.

Consider adding: {label: 'AUDIOBOOK', value: 'audiobook'} to the fileType array.

  fileType: { label: string; value: string }[] = [
    {label: 'PDF', value: 'pdf'},
    {label: 'EPUB', value: 'epub'},
    {label: 'CBX', value: 'cbx'},
    {label: 'FB2', value: 'fb2'},
    {label: 'MOBI', value: 'mobi'},
    {label: 'AZW3', value: 'azw3'}
  ];

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 82 to 87
{id: 4, label: '100–250 MB', min: 102400, max: 256000, sortIndex: 4},
{id: 5, label: '250–500 MB', min: 256000, max: 512000, sortIndex: 5},
{id: 6, label: '0.5–1 GB', min: 512000, max: 1048576, sortIndex: 6},
{id: 7, label: '1–2 GB', min: 1048576, max: 2097152, sortIndex: 7},
{id: 8, label: '2–5 GB', min: 2097152, max: 5242880, sortIndex: 8},
{id: 9, label: '5+ GB', min: 5242880, max: Infinity, sortIndex: 9}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the IDs of existing file size ranges will break saved filters in URLs, bookmarks, and magic shelves. Users who have saved filters or magic shelves with the old range IDs (4-7) will have their filters map to incorrect ranges after this change. For example, a user who filtered for "250-500 MB" (old ID 4) will now be filtering for "100-250 MB" (new ID 4).

To avoid this breaking change, consider:

  1. Keep existing IDs unchanged and insert new ranges with higher IDs, OR
  2. Add a migration mechanism to update saved magic shelves and inform users that bookmarked URLs with filters will need to be recreated

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…torService.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@WorldTeacher
Copy link
Collaborator Author

@acx10 should be ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] FileSize filter for library, magic shelf opds not working

2 participants