fix: use audiobook thumbnail URL for audiobook entries in notebook (#2763)
This commit is contained in:
@@ -21,6 +21,7 @@ public class NotebookEntry {
|
|||||||
private String color;
|
private String color;
|
||||||
private String style;
|
private String style;
|
||||||
private String chapterTitle;
|
private String chapterTitle;
|
||||||
|
private String primaryBookType;
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
private LocalDateTime updatedAt;
|
private LocalDateTime updatedAt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public interface NotebookEntryRepository extends Repository<AnnotationEntity, Lo
|
|||||||
String getColor();
|
String getColor();
|
||||||
String getStyle();
|
String getStyle();
|
||||||
String getChapterTitle();
|
String getChapterTitle();
|
||||||
|
String getPrimaryBookType();
|
||||||
LocalDateTime getCreatedAt();
|
LocalDateTime getCreatedAt();
|
||||||
LocalDateTime getUpdatedAt();
|
LocalDateTime getUpdatedAt();
|
||||||
}
|
}
|
||||||
@@ -56,6 +57,7 @@ public interface NotebookEntryRepository extends Repository<AnnotationEntity, Lo
|
|||||||
|
|
||||||
@Query(value = "SELECT t.id, t.type, t.book_id AS bookId, t.book_title AS bookTitle, " +
|
@Query(value = "SELECT t.id, t.type, t.book_id AS bookId, t.book_title AS bookTitle, " +
|
||||||
"t.text, t.note, t.color, t.style, t.chapter_title AS chapterTitle, " +
|
"t.text, t.note, t.color, t.style, t.chapter_title AS chapterTitle, " +
|
||||||
|
"(SELECT bf.book_type FROM book_file bf WHERE bf.book_id = t.book_id ORDER BY bf.id LIMIT 1) AS primaryBookType, " +
|
||||||
"t.created_at AS createdAt, t.updated_at AS updatedAt " +
|
"t.created_at AS createdAt, t.updated_at AS updatedAt " +
|
||||||
"FROM (" + ENTRIES_UNION + ") t" + ENTRIES_FILTER,
|
"FROM (" + ENTRIES_UNION + ") t" + ENTRIES_FILTER,
|
||||||
countQuery = "SELECT COUNT(*) FROM (" + ENTRIES_UNION + ") t" + ENTRIES_FILTER,
|
countQuery = "SELECT COUNT(*) FROM (" + ENTRIES_UNION + ") t" + ENTRIES_FILTER,
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class NotebookService {
|
|||||||
.color(p.getColor())
|
.color(p.getColor())
|
||||||
.style(p.getStyle())
|
.style(p.getStyle())
|
||||||
.chapterTitle(p.getChapterTitle())
|
.chapterTitle(p.getChapterTitle())
|
||||||
|
.primaryBookType(p.getPrimaryBookType())
|
||||||
.createdAt(p.getCreatedAt())
|
.createdAt(p.getCreatedAt())
|
||||||
.updatedAt(p.getUpdatedAt())
|
.updatedAt(p.getUpdatedAt())
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -179,10 +179,13 @@ export class NotebookComponent implements OnInit, OnDestroy {
|
|||||||
const groupMap = new Map<number, BookGroup>();
|
const groupMap = new Map<number, BookGroup>();
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
if (!groupMap.has(entry.bookId)) {
|
if (!groupMap.has(entry.bookId)) {
|
||||||
|
const isAudiobook = entry.primaryBookType === 'AUDIOBOOK';
|
||||||
groupMap.set(entry.bookId, {
|
groupMap.set(entry.bookId, {
|
||||||
bookId: entry.bookId,
|
bookId: entry.bookId,
|
||||||
bookTitle: entry.bookTitle,
|
bookTitle: entry.bookTitle,
|
||||||
thumbnailUrl: this.urlHelper.getThumbnailUrl1(entry.bookId),
|
thumbnailUrl: isAudiobook
|
||||||
|
? this.urlHelper.getAudiobookThumbnailUrl(entry.bookId)
|
||||||
|
: this.urlHelper.getDirectThumbnailUrl(entry.bookId),
|
||||||
entries: [],
|
entries: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export interface NotebookEntry {
|
|||||||
color?: string;
|
color?: string;
|
||||||
style?: string;
|
style?: string;
|
||||||
chapterTitle?: string;
|
chapterTitle?: string;
|
||||||
|
primaryBookType?: string;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt?: string;
|
updatedAt?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -372,7 +372,7 @@ export class ReadingSessionTimelineComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getCoverUrl(bookId: number): string {
|
public getCoverUrl(bookId: number): string {
|
||||||
return this.urlHelperService.getThumbnailUrl1(bookId);
|
return this.urlHelperService.getDirectThumbnailUrl(bookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getTooltipContent(session: TimelineSession): string {
|
public getTooltipContent(session: TimelineSession): string {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class UrlHelperService {
|
|||||||
return this.appendToken(url);
|
return this.appendToken(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
getThumbnailUrl1(bookId: number, coverUpdatedOn?: string): string {
|
getDirectThumbnailUrl(bookId: number, coverUpdatedOn?: string): string {
|
||||||
let url = `${this.mediaBaseUrl}/book/${bookId}/thumbnail`;
|
let url = `${this.mediaBaseUrl}/book/${bookId}/thumbnail`;
|
||||||
if (coverUpdatedOn) {
|
if (coverUpdatedOn) {
|
||||||
url += `?${coverUpdatedOn}`;
|
url += `?${coverUpdatedOn}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user