Remove metadata backup process (#1205)
This commit is contained in:
-2
@@ -12,7 +12,5 @@ import lombok.NoArgsConstructor;
|
||||
public class MetadataPersistenceSettings {
|
||||
private boolean saveToOriginalFile;
|
||||
private boolean convertCbrCb7ToCbz;
|
||||
private boolean backupMetadata;
|
||||
private boolean backupCover;
|
||||
private boolean moveFilesToLibraryPattern;
|
||||
}
|
||||
|
||||
-2
@@ -184,8 +184,6 @@ public class SettingPersistenceHelper {
|
||||
return MetadataPersistenceSettings.builder()
|
||||
.saveToOriginalFile(false)
|
||||
.convertCbrCb7ToCbz(false)
|
||||
.backupMetadata(false)
|
||||
.backupCover(false)
|
||||
.moveFilesToLibraryPattern(false)
|
||||
.build();
|
||||
}
|
||||
|
||||
-14
@@ -77,22 +77,8 @@ public class BookMetadataUpdater {
|
||||
MetadataPersistenceSettings settings = appSettingService.getAppSettings().getMetadataPersistenceSettings();
|
||||
boolean writeToFile = settings.isSaveToOriginalFile();
|
||||
boolean convertCbrCb7ToCbz = settings.isConvertCbrCb7ToCbz();
|
||||
boolean backupEnabled = settings.isBackupMetadata();
|
||||
boolean backupCover = settings.isBackupCover();
|
||||
BookFileType bookType = bookEntity.getBookType();
|
||||
|
||||
if (writeToFile && backupEnabled && (bookType != BookFileType.CBX || convertCbrCb7ToCbz)) {
|
||||
try {
|
||||
MetadataBackupRestore service = metadataBackupRestoreFactory.getService(bookType);
|
||||
if (service != null) {
|
||||
boolean coverBackup = bookType == BookFileType.EPUB && backupCover;
|
||||
service.backupEmbeddedMetadataIfNotExists(bookEntity, coverBackup);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("Metadata backup failed for book ID {}: {}", bookId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
updateBasicFields(newMetadata, metadata, clearFlags);
|
||||
updateAuthorsIfNeeded(newMetadata, metadata, clearFlags);
|
||||
updateCategoriesIfNeeded(newMetadata, metadata, clearFlags, mergeCategories);
|
||||
|
||||
@@ -84,8 +84,6 @@ export interface MetadataPersistenceSettings {
|
||||
moveFilesToLibraryPattern: boolean;
|
||||
saveToOriginalFile: boolean;
|
||||
convertCbrCb7ToCbz: boolean;
|
||||
backupMetadata: boolean;
|
||||
backupCover: boolean;
|
||||
}
|
||||
|
||||
export interface ReviewProviderConfig {
|
||||
|
||||
+1
-33
@@ -451,17 +451,7 @@
|
||||
pTooltip="Automatically fetch metadata using default sources"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
@if (book.bookType === 'CBX') {
|
||||
<p-button label="Restore ComicInfo" icon="pi pi-info-circle" [outlined]="true" severity="info" (onClick)="restoreCbxMetadata()" pTooltip="Retrieve metadata from ComicInfo.xml file" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
}
|
||||
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button label="Restore" icon="pi pi-refresh" [outlined]="true" severity="danger" (onClick)="restoreMetadata()" pTooltip="Revert all changes to original metadata" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
}
|
||||
|
||||
<p-divider layout="vertical"/>
|
||||
<p-button label="Unlock All" icon="pi pi-lock-open" [outlined]="true" severity="success" (onClick)="unlockAll()" pTooltip="Unlock all metadata fields for editing" tooltipPosition="top"></p-button>
|
||||
<p-button label="Lock All" icon="pi pi-lock" [outlined]="true" severity="warn" (onClick)="lockAll()" pTooltip="Lock all metadata fields to prevent changes" tooltipPosition="top"></p-button>
|
||||
<p-divider layout="vertical"/>
|
||||
@@ -491,28 +481,6 @@
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
|
||||
@if (book.bookType === 'CBX') {
|
||||
<p-button
|
||||
icon="pi pi-info-circle"
|
||||
[outlined]="true"
|
||||
severity="warn"
|
||||
(onClick)="restoreCbxMetadata()"
|
||||
pTooltip="Restore ComicInfo"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
|
||||
@if (book.bookType === 'PDF' || book.bookType === 'EPUB') {
|
||||
<p-button
|
||||
icon="pi pi-refresh"
|
||||
[outlined]="true"
|
||||
severity="danger"
|
||||
(onClick)="restoreMetadata()"
|
||||
pTooltip="Restore"
|
||||
tooltipPosition="top">
|
||||
</p-button>
|
||||
}
|
||||
|
||||
<p-button
|
||||
icon="pi pi-lock-open"
|
||||
[outlined]="true"
|
||||
|
||||
-34
@@ -47,40 +47,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item setting-item-indented">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">Backup Metadata</label>
|
||||
<p-toggleswitch
|
||||
[ngModel]="metadataPersistence.backupMetadata"
|
||||
(onChange)="onPersistenceToggle('backupMetadata')"
|
||||
[disabled]="!metadataPersistence.saveToOriginalFile">
|
||||
</p-toggleswitch>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
Save a JSON copy of the current metadata before writing new data to the file.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item setting-item-indented">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">Backup Cover</label>
|
||||
<p-toggleswitch
|
||||
[ngModel]="metadataPersistence.backupCover"
|
||||
(onChange)="onPersistenceToggle('backupCover')"
|
||||
[disabled]="!metadataPersistence.saveToOriginalFile">
|
||||
</p-toggleswitch>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
<i class="pi pi-info-circle"></i>
|
||||
Save a copy of the existing embedded cover image before it is replaced.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
|
||||
+1
-5
@@ -21,9 +21,7 @@ export class MetadataPersistenceSettingsComponent implements OnInit {
|
||||
metadataPersistence: MetadataPersistenceSettings = {
|
||||
saveToOriginalFile: false,
|
||||
convertCbrCb7ToCbz: false,
|
||||
moveFilesToLibraryPattern: false,
|
||||
backupMetadata: true,
|
||||
backupCover: true
|
||||
moveFilesToLibraryPattern: false
|
||||
};
|
||||
|
||||
private readonly appSettingsService = inject(AppSettingsService);
|
||||
@@ -65,8 +63,6 @@ export class MetadataPersistenceSettingsComponent implements OnInit {
|
||||
|
||||
if (!this.metadataPersistence.saveToOriginalFile) {
|
||||
this.metadataPersistence.convertCbrCb7ToCbz = false;
|
||||
this.metadataPersistence.backupMetadata = false;
|
||||
this.metadataPersistence.backupCover = false;
|
||||
}
|
||||
} else {
|
||||
this.metadataPersistence[key] = !this.metadataPersistence[key];
|
||||
|
||||
Reference in New Issue
Block a user