mirror of
https://github.com/booklore-app/booklore.git
synced 2026-02-18 00:17:53 +01:00
Audiobook fixes
This commit is contained in:
@@ -23,5 +23,5 @@ public class MobileBookSummary {
|
||||
private Instant addedOn;
|
||||
private Instant lastReadTime;
|
||||
private Float readProgress;
|
||||
private Boolean hasAudiobook;
|
||||
private String primaryFileType;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public interface MobileBookMapper {
|
||||
@Mapping(target = "addedOn", source = "book.addedOn")
|
||||
@Mapping(target = "lastReadTime", source = "progress.lastReadTime")
|
||||
@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);
|
||||
|
||||
@Mapping(target = "id", source = "book.id")
|
||||
@@ -140,15 +140,6 @@ public interface MobileBookMapper {
|
||||
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")
|
||||
default MobileBookDetail.EpubProgress mapEpubProgress(UserBookProgressEntity progress) {
|
||||
if (progress == null || progress.getEpubProgress() == null) {
|
||||
|
||||
@@ -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 {
|
||||
return this.openDialog(AdditionalFileUploaderComponent, {
|
||||
showHeader: false,
|
||||
|
||||
@@ -624,20 +624,17 @@
|
||||
}
|
||||
}
|
||||
@if (userState.user!.permissions.canEditMetadata || userState.user!.permissions.admin) {
|
||||
@if (refreshMenuItems$ | async; as refreshItems) {
|
||||
<p-splitbutton
|
||||
[label]="isAutoFetching ? 'Fetching...' : 'Fetch Metadata'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
[model]="refreshItems"
|
||||
severity="warn"
|
||||
(onClick)="quickRefresh(book!.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top"
|
||||
class="mobile-icon-only">
|
||||
</p-splitbutton>
|
||||
}
|
||||
<p-button
|
||||
[label]="isAutoFetching ? 'Fetching...' : 'Fetch Metadata'"
|
||||
[icon]="isAutoFetching ? 'pi pi-spin pi-spinner' : 'pi pi-bolt'"
|
||||
[outlined]="true"
|
||||
severity="warn"
|
||||
(onClick)="quickRefresh(book!.id)"
|
||||
[disabled]="isAutoFetching"
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top"
|
||||
class="mobile-icon-only">
|
||||
</p-button>
|
||||
}
|
||||
@if (otherItems$ | async; as otherItems) {
|
||||
@if (otherItems.length > 0) {
|
||||
|
||||
@@ -95,26 +95,11 @@ export class MetadataViewerComponent implements OnInit, OnChanges {
|
||||
navigationState$ = this.bookNavigationService.getNavigationState();
|
||||
|
||||
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(
|
||||
filter((book): book is Book => book !== null),
|
||||
map((book): MenuItem[] => {
|
||||
const items: MenuItem[] = [];
|
||||
const primaryType = book.primaryFile?.bookType;
|
||||
|
||||
// Add streaming reader option for primary file
|
||||
if (primaryType === 'PDF') {
|
||||
items.push({
|
||||
label: 'Streaming Reader',
|
||||
|
||||
Reference in New Issue
Block a user