Audiobook fixes
This commit is contained in:
@@ -23,5 +23,5 @@ public class MobileBookSummary {
|
|||||||
private Instant addedOn;
|
private Instant addedOn;
|
||||||
private Instant lastReadTime;
|
private Instant lastReadTime;
|
||||||
private Float readProgress;
|
private Float readProgress;
|
||||||
private Boolean hasAudiobook;
|
private String primaryFileType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public interface MobileBookMapper {
|
|||||||
@Mapping(target = "addedOn", source = "book.addedOn")
|
@Mapping(target = "addedOn", source = "book.addedOn")
|
||||||
@Mapping(target = "lastReadTime", source = "progress.lastReadTime")
|
@Mapping(target = "lastReadTime", source = "progress.lastReadTime")
|
||||||
@Mapping(target = "readProgress", source = "progress", qualifiedByName = "mapReadProgress")
|
@Mapping(target = "readProgress", source = "progress", qualifiedByName = "mapReadProgress")
|
||||||
@Mapping(target = "hasAudiobook", source = "book", qualifiedByName = "mapHasAudiobook")
|
@Mapping(target = "primaryFileType", source = "book", qualifiedByName = "mapPrimaryFileType")
|
||||||
MobileBookSummary toSummary(BookEntity book, UserBookProgressEntity progress);
|
MobileBookSummary toSummary(BookEntity book, UserBookProgressEntity progress);
|
||||||
|
|
||||||
@Mapping(target = "id", source = "book.id")
|
@Mapping(target = "id", source = "book.id")
|
||||||
@@ -140,15 +140,6 @@ public interface MobileBookMapper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Named("mapHasAudiobook")
|
|
||||||
default Boolean mapHasAudiobook(BookEntity book) {
|
|
||||||
if (book == null || book.getBookFiles() == null || book.getBookFiles().isEmpty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return book.getBookFiles().stream()
|
|
||||||
.anyMatch(bf -> bf.getBookType() == BookFileType.AUDIOBOOK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Named("mapEpubProgress")
|
@Named("mapEpubProgress")
|
||||||
default MobileBookDetail.EpubProgress mapEpubProgress(UserBookProgressEntity progress) {
|
default MobileBookDetail.EpubProgress mapEpubProgress(UserBookProgressEntity progress) {
|
||||||
if (progress == null || progress.getEpubProgress() == null) {
|
if (progress == null || progress.getEpubProgress() == null) {
|
||||||
|
|||||||
-11
@@ -135,17 +135,6 @@ export class BookDialogHelperService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
openMetadataFetchOptionsDialog(bookId: number): DynamicDialogRef | null {
|
|
||||||
return this.openDialog(MetadataFetchOptionsComponent, {
|
|
||||||
showHeader: false,
|
|
||||||
styleClass: `${DialogSize.SM} ${DialogStyle.MINIMAL}`,
|
|
||||||
data: {
|
|
||||||
bookIds: [bookId],
|
|
||||||
metadataRefreshType: MetadataRefreshType.BOOKS,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
openAdditionalFileUploaderDialog(book: Book): DynamicDialogRef | null {
|
openAdditionalFileUploaderDialog(book: Book): DynamicDialogRef | null {
|
||||||
return this.openDialog(AdditionalFileUploaderComponent, {
|
return this.openDialog(AdditionalFileUploaderComponent, {
|
||||||
showHeader: false,
|
showHeader: false,
|
||||||
|
|||||||
+11
-14
@@ -624,20 +624,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@if (userState.user!.permissions.canEditMetadata || userState.user!.permissions.admin) {
|
@if (userState.user!.permissions.canEditMetadata || userState.user!.permissions.admin) {
|
||||||
@if (refreshMenuItems$ | async; as refreshItems) {
|
<p-button
|
||||||
<p-splitbutton
|
[label]="isAutoFetching ? 'Fetching...' : 'Fetch Metadata'"
|
||||||
[label]="isAutoFetching ? 'Fetching...' : 'Fetch Metadata'"
|
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
[outlined]="true"
|
||||||
[outlined]="true"
|
severity="warn"
|
||||||
[model]="refreshItems"
|
(onClick)="quickRefresh(book!.id)"
|
||||||
severity="warn"
|
[disabled]="isAutoFetching"
|
||||||
(onClick)="quickRefresh(book!.id)"
|
pTooltip="Automatically fetch metadata using default sources"
|
||||||
[disabled]="isAutoFetching"
|
tooltipPosition="top"
|
||||||
pTooltip="Automatically fetch metadata using default sources"
|
class="mobile-icon-only">
|
||||||
tooltipPosition="top"
|
</p-button>
|
||||||
class="mobile-icon-only">
|
|
||||||
</p-splitbutton>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@if (otherItems$ | async; as otherItems) {
|
@if (otherItems$ | async; as otherItems) {
|
||||||
@if (otherItems.length > 0) {
|
@if (otherItems.length > 0) {
|
||||||
|
|||||||
-15
@@ -95,26 +95,11 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
|||||||
navigationState$ = this.bookNavigationService.getNavigationState();
|
navigationState$ = this.bookNavigationService.getNavigationState();
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.refreshMenuItems$ = this.book$.pipe(
|
|
||||||
filter((book): book is Book => book !== null),
|
|
||||||
map((book): MenuItem[] => [
|
|
||||||
{
|
|
||||||
label: 'Custom Fetch',
|
|
||||||
icon: 'pi pi-sync',
|
|
||||||
command: () => {
|
|
||||||
this.bookDialogHelperService.openMetadataFetchOptionsDialog(book.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
])
|
|
||||||
);
|
|
||||||
|
|
||||||
this.readMenuItems$ = this.book$.pipe(
|
this.readMenuItems$ = this.book$.pipe(
|
||||||
filter((book): book is Book => book !== null),
|
filter((book): book is Book => book !== null),
|
||||||
map((book): MenuItem[] => {
|
map((book): MenuItem[] => {
|
||||||
const items: MenuItem[] = [];
|
const items: MenuItem[] = [];
|
||||||
const primaryType = book.primaryFile?.bookType;
|
const primaryType = book.primaryFile?.bookType;
|
||||||
|
|
||||||
// Add streaming reader option for primary file
|
|
||||||
if (primaryType === 'PDF') {
|
if (primaryType === 'PDF') {
|
||||||
items.push({
|
items.push({
|
||||||
label: 'Streaming Reader',
|
label: 'Streaming Reader',
|
||||||
|
|||||||
Reference in New Issue
Block a user