refactor(download): rename Want/Request to Request/Download, unify downloads flow, add auto-download guardrails
The durable "I asked for this" record was called Want, and the one-shot search-and-grab attempt was called Request — names that didn't match what either actually did. Want is now Request, and the old Request/Item is now Download/DownloadItem, with a table-rename migration (download_wants -> download_requests, old download_requests -> download_downloads) safe against both fresh installs and existing data. Every anchored manual download now upserts/reuses a durable Request before running, so a "download now" that finds nothing is picked up by the background reconciler automatically instead of just failing with no trace — the gap that caused this session's repeated "no candidates found" failures on the same album. Also adds auto-download guardrails (file-size min/max with a preferred target, allowed file types) that gate what the pipeline may grab unattended, live-editable from a new settings section. The frontend's wanted-view becomes downloads-view, with a new Downloads tab showing attempt/transfer history that previously had no UI at all. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y2Agd9af5hE7qzti2ackiS
This commit is contained in:
+5
@@ -1,8 +1,11 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {download} from '../models';
|
||||
import {tracklist} from '../models';
|
||||
import {context} from '../models';
|
||||
|
||||
export function GetDownloadPreferences():Promise<download.AutoDownloadPrefs>;
|
||||
|
||||
export function GetFavoritesIconStyle():Promise<string>;
|
||||
|
||||
export function GetFavoritesPlaylistID():Promise<number>;
|
||||
@@ -29,6 +32,8 @@ export function Save():Promise<void>;
|
||||
|
||||
export function SetContext(arg1:context.Context):Promise<void>;
|
||||
|
||||
export function SetDownloadPreferences(arg1:download.AutoDownloadPrefs):Promise<void>;
|
||||
|
||||
export function SetFavoritesIconStyle(arg1:string):Promise<void>;
|
||||
|
||||
export function SetFavoritesPlaylistID(arg1:number):Promise<void>;
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function GetDownloadPreferences() {
|
||||
return window['go']['config']['Config']['GetDownloadPreferences']();
|
||||
}
|
||||
|
||||
export function GetFavoritesIconStyle() {
|
||||
return window['go']['config']['Config']['GetFavoritesIconStyle']();
|
||||
}
|
||||
@@ -54,6 +58,10 @@ export function SetContext(arg1) {
|
||||
return window['go']['config']['Config']['SetContext'](arg1);
|
||||
}
|
||||
|
||||
export function SetDownloadPreferences(arg1) {
|
||||
return window['go']['config']['Config']['SetDownloadPreferences'](arg1);
|
||||
}
|
||||
|
||||
export function SetFavoritesIconStyle(arg1) {
|
||||
return window['go']['config']['Config']['SetFavoritesIconStyle'](arg1);
|
||||
}
|
||||
|
||||
+13
-11
@@ -5,7 +5,7 @@ import {context} from '../models';
|
||||
|
||||
export function AddProvider(arg1:string,arg2:string,arg3:Record<string, string>):Promise<number>;
|
||||
|
||||
export function AddWant(arg1:download.WantRequest):Promise<number>;
|
||||
export function AddRequest(arg1:download.RequestInput):Promise<number>;
|
||||
|
||||
export function Cancel(arg1:string):Promise<void>;
|
||||
|
||||
@@ -13,35 +13,37 @@ export function Candidates(arg1:string):Promise<Array<download.Candidate>>;
|
||||
|
||||
export function ClearFinished():Promise<void>;
|
||||
|
||||
export function ClearSatisfiedWants():Promise<void>;
|
||||
export function ClearSatisfiedRequests():Promise<void>;
|
||||
|
||||
export function DeleteProvider(arg1:number):Promise<void>;
|
||||
|
||||
export function ImportExternalWants(arg1:number,arg2:number):Promise<number>;
|
||||
export function ImportExternalRequests(arg1:number,arg2:number):Promise<number>;
|
||||
|
||||
export function IsWanted(arg1:string,arg2:number):Promise<boolean>;
|
||||
export function IsRequested(arg1:string,arg2:number):Promise<boolean>;
|
||||
|
||||
export function ListDownloads(arg1:number):Promise<Array<download.DownloadView>>;
|
||||
|
||||
export function ListProviders():Promise<Array<download.Config>>;
|
||||
|
||||
export function ListRequests(arg1:number):Promise<Array<download.RequestView>>;
|
||||
export function ListRequests():Promise<Array<download.Request>>;
|
||||
|
||||
export function ListWants():Promise<Array<download.Want>>;
|
||||
|
||||
export function PauseWant(arg1:number,arg2:boolean):Promise<void>;
|
||||
export function PauseRequest(arg1:number,arg2:boolean):Promise<void>;
|
||||
|
||||
export function Pick(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function ProviderKinds():Promise<Array<download.Descriptor>>;
|
||||
|
||||
export function ReconcileWanted():Promise<download.Summary>;
|
||||
export function ReconcileRequests():Promise<download.Summary>;
|
||||
|
||||
export function RemoveWant(arg1:number):Promise<void>;
|
||||
export function RemoveRequest(arg1:number):Promise<void>;
|
||||
|
||||
export function SetContext(arg1:context.Context):Promise<void>;
|
||||
|
||||
export function SetPreferences(arg1:download.AutoDownloadPrefs):Promise<void>;
|
||||
|
||||
export function SetReconciler(arg1:download.Reconciler):Promise<void>;
|
||||
|
||||
export function Start(arg1:download.SearchRequest):Promise<download.StartResult>;
|
||||
export function StartDownload(arg1:download.SearchRequest):Promise<download.StartResult>;
|
||||
|
||||
export function TestProvider(arg1:number):Promise<void>;
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ export function AddProvider(arg1, arg2, arg3) {
|
||||
return window['go']['download']['Service']['AddProvider'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function AddWant(arg1) {
|
||||
return window['go']['download']['Service']['AddWant'](arg1);
|
||||
export function AddRequest(arg1) {
|
||||
return window['go']['download']['Service']['AddRequest'](arg1);
|
||||
}
|
||||
|
||||
export function Cancel(arg1) {
|
||||
@@ -22,36 +22,36 @@ export function ClearFinished() {
|
||||
return window['go']['download']['Service']['ClearFinished']();
|
||||
}
|
||||
|
||||
export function ClearSatisfiedWants() {
|
||||
return window['go']['download']['Service']['ClearSatisfiedWants']();
|
||||
export function ClearSatisfiedRequests() {
|
||||
return window['go']['download']['Service']['ClearSatisfiedRequests']();
|
||||
}
|
||||
|
||||
export function DeleteProvider(arg1) {
|
||||
return window['go']['download']['Service']['DeleteProvider'](arg1);
|
||||
}
|
||||
|
||||
export function ImportExternalWants(arg1, arg2) {
|
||||
return window['go']['download']['Service']['ImportExternalWants'](arg1, arg2);
|
||||
export function ImportExternalRequests(arg1, arg2) {
|
||||
return window['go']['download']['Service']['ImportExternalRequests'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function IsWanted(arg1, arg2) {
|
||||
return window['go']['download']['Service']['IsWanted'](arg1, arg2);
|
||||
export function IsRequested(arg1, arg2) {
|
||||
return window['go']['download']['Service']['IsRequested'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function ListDownloads(arg1) {
|
||||
return window['go']['download']['Service']['ListDownloads'](arg1);
|
||||
}
|
||||
|
||||
export function ListProviders() {
|
||||
return window['go']['download']['Service']['ListProviders']();
|
||||
}
|
||||
|
||||
export function ListRequests(arg1) {
|
||||
return window['go']['download']['Service']['ListRequests'](arg1);
|
||||
export function ListRequests() {
|
||||
return window['go']['download']['Service']['ListRequests']();
|
||||
}
|
||||
|
||||
export function ListWants() {
|
||||
return window['go']['download']['Service']['ListWants']();
|
||||
}
|
||||
|
||||
export function PauseWant(arg1, arg2) {
|
||||
return window['go']['download']['Service']['PauseWant'](arg1, arg2);
|
||||
export function PauseRequest(arg1, arg2) {
|
||||
return window['go']['download']['Service']['PauseRequest'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function Pick(arg1, arg2) {
|
||||
@@ -62,24 +62,28 @@ export function ProviderKinds() {
|
||||
return window['go']['download']['Service']['ProviderKinds']();
|
||||
}
|
||||
|
||||
export function ReconcileWanted() {
|
||||
return window['go']['download']['Service']['ReconcileWanted']();
|
||||
export function ReconcileRequests() {
|
||||
return window['go']['download']['Service']['ReconcileRequests']();
|
||||
}
|
||||
|
||||
export function RemoveWant(arg1) {
|
||||
return window['go']['download']['Service']['RemoveWant'](arg1);
|
||||
export function RemoveRequest(arg1) {
|
||||
return window['go']['download']['Service']['RemoveRequest'](arg1);
|
||||
}
|
||||
|
||||
export function SetContext(arg1) {
|
||||
return window['go']['download']['Service']['SetContext'](arg1);
|
||||
}
|
||||
|
||||
export function SetPreferences(arg1) {
|
||||
return window['go']['download']['Service']['SetPreferences'](arg1);
|
||||
}
|
||||
|
||||
export function SetReconciler(arg1) {
|
||||
return window['go']['download']['Service']['SetReconciler'](arg1);
|
||||
}
|
||||
|
||||
export function Start(arg1) {
|
||||
return window['go']['download']['Service']['Start'](arg1);
|
||||
export function StartDownload(arg1) {
|
||||
return window['go']['download']['Service']['StartDownload'](arg1);
|
||||
}
|
||||
|
||||
export function TestProvider(arg1) {
|
||||
|
||||
+146
-125
@@ -297,12 +297,31 @@ export namespace autotagservice {
|
||||
|
||||
export namespace download {
|
||||
|
||||
export class AutoDownloadPrefs {
|
||||
minSizeMb: number;
|
||||
maxSizeMb: number;
|
||||
preferredSizeMb: number;
|
||||
allowedFormats: string[];
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new AutoDownloadPrefs(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.minSizeMb = source["minSizeMb"];
|
||||
this.maxSizeMb = source["maxSizeMb"];
|
||||
this.preferredSizeMb = source["preferredSizeMb"];
|
||||
this.allowedFormats = source["allowedFormats"];
|
||||
}
|
||||
}
|
||||
export class QualityScore {
|
||||
overall: number;
|
||||
formatRank: number;
|
||||
bitrate: number;
|
||||
health: number;
|
||||
priority: number;
|
||||
sizeFit: number;
|
||||
mixed: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
@@ -316,6 +335,7 @@ export namespace download {
|
||||
this.bitrate = source["bitrate"];
|
||||
this.health = source["health"];
|
||||
this.priority = source["priority"];
|
||||
this.sizeFit = source["sizeFit"];
|
||||
this.mixed = source["mixed"];
|
||||
}
|
||||
}
|
||||
@@ -534,30 +554,9 @@ export namespace download {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
export class ExpectedTrack {
|
||||
position: number;
|
||||
discNumber: number;
|
||||
title: string;
|
||||
artist: string;
|
||||
lengthMillis: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new ExpectedTrack(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.position = source["position"];
|
||||
this.discNumber = source["discNumber"];
|
||||
this.title = source["title"];
|
||||
this.artist = source["artist"];
|
||||
this.lengthMillis = source["lengthMillis"];
|
||||
}
|
||||
}
|
||||
|
||||
export class Item {
|
||||
export class DownloadItem {
|
||||
id: string;
|
||||
requestId: string;
|
||||
downloadId: string;
|
||||
providerId: number;
|
||||
transportId?: number;
|
||||
externalId?: string;
|
||||
@@ -570,13 +569,13 @@ export namespace download {
|
||||
updatedAt: time.Time;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Item(source);
|
||||
return new DownloadItem(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.requestId = source["requestId"];
|
||||
this.downloadId = source["downloadId"];
|
||||
this.providerId = source["providerId"];
|
||||
this.transportId = source["transportId"];
|
||||
this.externalId = source["externalId"];
|
||||
@@ -607,26 +606,32 @@ export namespace download {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export class Reconciler {
|
||||
|
||||
export class ExpectedTrack {
|
||||
position: number;
|
||||
discNumber: number;
|
||||
title: string;
|
||||
artist: string;
|
||||
lengthMillis: number;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Reconciler(source);
|
||||
return new ExpectedTrack(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
|
||||
this.position = source["position"];
|
||||
this.discNumber = source["discNumber"];
|
||||
this.title = source["title"];
|
||||
this.artist = source["artist"];
|
||||
this.lengthMillis = source["lengthMillis"];
|
||||
}
|
||||
}
|
||||
export class RequestView {
|
||||
export class DownloadView {
|
||||
id: string;
|
||||
releaseMbid?: string;
|
||||
releaseGroupMbid?: string;
|
||||
recordingMbid?: string;
|
||||
wantId?: number;
|
||||
requestId?: number;
|
||||
source?: string;
|
||||
artist: string;
|
||||
album: string;
|
||||
@@ -636,10 +641,10 @@ export namespace download {
|
||||
createdAt: time.Time;
|
||||
state: string;
|
||||
error?: string;
|
||||
items: Item[];
|
||||
items: DownloadItem[];
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new RequestView(source);
|
||||
return new DownloadView(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
@@ -648,7 +653,7 @@ export namespace download {
|
||||
this.releaseMbid = source["releaseMbid"];
|
||||
this.releaseGroupMbid = source["releaseGroupMbid"];
|
||||
this.recordingMbid = source["recordingMbid"];
|
||||
this.wantId = source["wantId"];
|
||||
this.requestId = source["requestId"];
|
||||
this.source = source["source"];
|
||||
this.artist = source["artist"];
|
||||
this.album = source["album"];
|
||||
@@ -658,7 +663,7 @@ export namespace download {
|
||||
this.createdAt = this.convertValues(source["createdAt"], time.Time);
|
||||
this.state = source["state"];
|
||||
this.error = source["error"];
|
||||
this.items = this.convertValues(source["items"], Item);
|
||||
this.items = this.convertValues(source["items"], DownloadItem);
|
||||
}
|
||||
|
||||
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
||||
@@ -679,6 +684,108 @@ export namespace download {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export class Reconciler {
|
||||
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Reconciler(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
|
||||
}
|
||||
}
|
||||
export class Request {
|
||||
id: number;
|
||||
mbid: string;
|
||||
entity: string;
|
||||
libraryId: number;
|
||||
artist: string;
|
||||
title: string;
|
||||
scope: string;
|
||||
secondary: boolean;
|
||||
state: string;
|
||||
parentId?: number;
|
||||
attempts: number;
|
||||
lastError?: string;
|
||||
lastTriedAt?: time.Time;
|
||||
nextTryAt?: time.Time;
|
||||
externalIds?: Record<string, string>;
|
||||
createdAt: time.Time;
|
||||
updatedAt: time.Time;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Request(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.mbid = source["mbid"];
|
||||
this.entity = source["entity"];
|
||||
this.libraryId = source["libraryId"];
|
||||
this.artist = source["artist"];
|
||||
this.title = source["title"];
|
||||
this.scope = source["scope"];
|
||||
this.secondary = source["secondary"];
|
||||
this.state = source["state"];
|
||||
this.parentId = source["parentId"];
|
||||
this.attempts = source["attempts"];
|
||||
this.lastError = source["lastError"];
|
||||
this.lastTriedAt = this.convertValues(source["lastTriedAt"], time.Time);
|
||||
this.nextTryAt = this.convertValues(source["nextTryAt"], time.Time);
|
||||
this.externalIds = source["externalIds"];
|
||||
this.createdAt = this.convertValues(source["createdAt"], time.Time);
|
||||
this.updatedAt = this.convertValues(source["updatedAt"], time.Time);
|
||||
}
|
||||
|
||||
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 class RequestInput {
|
||||
mbid: string;
|
||||
entity: string;
|
||||
libraryId: number;
|
||||
artist: string;
|
||||
title: string;
|
||||
scope: string;
|
||||
secondary: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new RequestInput(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.mbid = source["mbid"];
|
||||
this.entity = source["entity"];
|
||||
this.libraryId = source["libraryId"];
|
||||
this.artist = source["artist"];
|
||||
this.title = source["title"];
|
||||
this.scope = source["scope"];
|
||||
this.secondary = source["secondary"];
|
||||
}
|
||||
}
|
||||
export class SearchRequest {
|
||||
libraryId: number;
|
||||
releaseMbid: string;
|
||||
@@ -722,7 +829,7 @@ export namespace download {
|
||||
}
|
||||
}
|
||||
export class StartResult {
|
||||
requestId: string;
|
||||
downloadId: string;
|
||||
candidates: Candidate[];
|
||||
autoPicked: boolean;
|
||||
|
||||
@@ -732,7 +839,7 @@ export namespace download {
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.requestId = source["requestId"];
|
||||
this.downloadId = source["downloadId"];
|
||||
this.candidates = this.convertValues(source["candidates"], Candidate);
|
||||
this.autoPicked = source["autoPicked"];
|
||||
}
|
||||
@@ -775,92 +882,6 @@ export namespace download {
|
||||
this.synced = source["synced"];
|
||||
}
|
||||
}
|
||||
export class Want {
|
||||
id: number;
|
||||
mbid: string;
|
||||
entity: string;
|
||||
libraryId: number;
|
||||
artist: string;
|
||||
title: string;
|
||||
scope: string;
|
||||
secondary: boolean;
|
||||
state: string;
|
||||
parentId?: number;
|
||||
attempts: number;
|
||||
lastError?: string;
|
||||
lastTriedAt?: time.Time;
|
||||
nextTryAt?: time.Time;
|
||||
externalIds?: Record<string, string>;
|
||||
createdAt: time.Time;
|
||||
updatedAt: time.Time;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Want(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.mbid = source["mbid"];
|
||||
this.entity = source["entity"];
|
||||
this.libraryId = source["libraryId"];
|
||||
this.artist = source["artist"];
|
||||
this.title = source["title"];
|
||||
this.scope = source["scope"];
|
||||
this.secondary = source["secondary"];
|
||||
this.state = source["state"];
|
||||
this.parentId = source["parentId"];
|
||||
this.attempts = source["attempts"];
|
||||
this.lastError = source["lastError"];
|
||||
this.lastTriedAt = this.convertValues(source["lastTriedAt"], time.Time);
|
||||
this.nextTryAt = this.convertValues(source["nextTryAt"], time.Time);
|
||||
this.externalIds = source["externalIds"];
|
||||
this.createdAt = this.convertValues(source["createdAt"], time.Time);
|
||||
this.updatedAt = this.convertValues(source["updatedAt"], time.Time);
|
||||
}
|
||||
|
||||
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 class WantRequest {
|
||||
mbid: string;
|
||||
entity: string;
|
||||
libraryId: number;
|
||||
artist: string;
|
||||
title: string;
|
||||
scope: string;
|
||||
secondary: boolean;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new WantRequest(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.mbid = source["mbid"];
|
||||
this.entity = source["entity"];
|
||||
this.libraryId = source["libraryId"];
|
||||
this.artist = source["artist"];
|
||||
this.title = source["title"];
|
||||
this.scope = source["scope"];
|
||||
this.secondary = source["secondary"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user