feat(18-01): add BatchWriteTrackTags with progress, cancellation, and partial failure

- Add BatchFailure and BatchResult types for structured batch outcomes
- Add cancelBatch channel and suppressEvents flag to TagWriter struct
- Add CancelBatchWrite method for mid-batch cancellation from frontend
- Add BatchWriteTrackTags method processing tracks sequentially
- Emit BatchWriteProgress event per-track with current/total/succeeded/failed
- Suppress per-track TrackMetadataChanged; emit single event after batch
- Wails bindings auto-generated for BatchWriteTrackTags and CancelBatchWrite
- tagwriter namespace with BatchResult/BatchFailure in models.ts
This commit is contained in:
2026-03-18 13:02:30 -04:00
parent 3dba0e143c
commit f557ffd652
4 changed files with 209 additions and 8 deletions
+57
View File
@@ -672,6 +672,63 @@ export namespace sqlcgen {
}
export namespace tagwriter {
export class BatchFailure {
filePath: string;
error: string;
static createFrom(source: any = {}) {
return new BatchFailure(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.filePath = source["filePath"];
this.error = source["error"];
}
}
export class BatchResult {
total: number;
succeeded: number;
failed: number;
cancelled: boolean;
failures: BatchFailure[];
static createFrom(source: any = {}) {
return new BatchResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.total = source["total"];
this.succeeded = source["succeeded"];
this.failed = source["failed"];
this.cancelled = source["cancelled"];
this.failures = this.convertValues(source["failures"], BatchFailure);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
export namespace tracklist {
export class Column {
+5 -1
View File
@@ -1,7 +1,11 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {context} from '../models';
import {tagwriter} from '../models';
import {context} from '../models';
export function BatchWriteTrackTags(arg1:Array<string>,arg2:tagwriter.TagChanges):Promise<tagwriter.BatchResult>;
export function CancelBatchWrite():Promise<void>;
export function SetContext(arg1:context.Context):Promise<void>;
@@ -2,6 +2,14 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function BatchWriteTrackTags(arg1, arg2) {
return window['go']['tagwriter']['TagWriter']['BatchWriteTrackTags'](arg1, arg2);
}
export function CancelBatchWrite() {
return window['go']['tagwriter']['TagWriter']['CancelBatchWrite']();
}
export function SetContext(arg1) {
return window['go']['tagwriter']['TagWriter']['SetContext'](arg1);
}