Hooked in character counts per page for estimation, needs some cleanup.

This commit is contained in:
Joseph Milazzo 2025-07-08 06:06:35 -05:00
parent 9b7eb11359
commit ab6669703d
8 changed files with 105 additions and 27 deletions

View file

@ -662,7 +662,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
this.cdRef.markForCheck();
this.bookService.getBookInfo(this.chapterId).subscribe(async (info) => {
this.bookService.getBookInfo(this.chapterId, true).subscribe(async (info) => {
if (this.readingListMode && info.seriesFormat !== MangaFormat.EPUB) {
// Redirect to the manga reader.
const params = this.readerService.getQueryParamsObject(this.incognitoMode, this.readingListMode, this.readingListId);

View file

@ -1,9 +1,13 @@
import { MangaFormat } from "src/app/_models/manga-format";
import {MangaFormat} from "src/app/_models/manga-format";
export interface BookInfo {
bookTitle: string;
seriesFormat: MangaFormat;
seriesId: number;
libraryId: number;
volumeId: number;
}
bookTitle: string;
seriesFormat: MangaFormat;
seriesId: number;
libraryId: number;
volumeId: number;
/**
* Maps the page number to character count. Only available on epub reader.
*/
pageWordCounts: {[key: number]: number};
}

View file

@ -1,9 +1,9 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { TextResonse } from 'src/app/_types/text-response';
import { environment } from 'src/environments/environment';
import { BookChapterItem } from '../_models/book-chapter-item';
import { BookInfo } from '../_models/book-info';
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {TextResonse} from 'src/app/_types/text-response';
import {environment} from 'src/environments/environment';
import {BookChapterItem} from '../_models/book-chapter-item';
import {BookInfo} from '../_models/book-info';
export interface FontFamily {
/**
@ -28,7 +28,8 @@ export class BookService {
getFontFamilies(): Array<FontFamily> {
return [{title: 'default', family: 'default'}, {title: 'EBGaramond', family: 'EBGaramond'}, {title: 'Fira Sans', family: 'Fira_Sans'},
{title: 'Lato', family: 'Lato'}, {title: 'Libre Baskerville', family: 'Libre_Baskerville'}, {title: 'Merriweather', family: 'Merriweather'},
{title: 'Nanum Gothic', family: 'Nanum_Gothic'}, {title: 'Open Dyslexic', family: 'OpenDyslexic2'}, {title: 'RocknRoll One', family: 'RocknRoll_One'}, {title: 'Fast Font Serif (Bionic)', family: 'FastFontSerif'}, {title: 'Fast Font Sans (Bionic)', family: 'FastFontSans'}];
{title: 'Nanum Gothic', family: 'Nanum_Gothic'}, {title: 'Open Dyslexic', family: 'OpenDyslexic2'}, {title: 'RocknRoll One', family: 'RocknRoll_One'},
{title: 'Fast Font Serif (Bionic)', family: 'FastFontSerif'}, {title: 'Fast Font Sans (Bionic)', family: 'FastFontSans'}];
}
getBookChapters(chapterId: number) {
@ -39,8 +40,8 @@ export class BookService {
return this.http.get<string>(this.baseUrl + 'book/' + chapterId + '/book-page?page=' + page, TextResonse);
}
getBookInfo(chapterId: number) {
return this.http.get<BookInfo>(this.baseUrl + 'book/' + chapterId + '/book-info');
getBookInfo(chapterId: number, includeWordCounts: boolean = false) {
return this.http.get<BookInfo>(this.baseUrl + `book/${chapterId}/book-info?includeWordCounts=${includeWordCounts}`);
}
getBookPageUrl(chapterId: number, page: number) {