feat: add sound scanning and normalization features to SettingsPage; implement UI components and state management
This commit is contained in:
@@ -23,6 +23,36 @@ export interface MessageResponse {
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface ScanResults {
|
||||
added: number
|
||||
updated: number
|
||||
deleted: number
|
||||
skipped: number
|
||||
errors: string[]
|
||||
files_added: string[]
|
||||
files_updated: string[]
|
||||
files_deleted: string[]
|
||||
files_skipped: string[]
|
||||
}
|
||||
|
||||
export interface NormalizationResults {
|
||||
processed: number
|
||||
normalized: number
|
||||
skipped: number
|
||||
errors: number
|
||||
error_details: string[]
|
||||
}
|
||||
|
||||
export interface ScanResponse {
|
||||
message: string
|
||||
results: ScanResults
|
||||
}
|
||||
|
||||
export interface NormalizationResponse {
|
||||
message: string
|
||||
results: NormalizationResults
|
||||
}
|
||||
|
||||
export class AdminService {
|
||||
async listUsers(limit = 100, offset = 0): Promise<User[]> {
|
||||
return apiClient.get<User[]>(`/api/v1/admin/users/`, {
|
||||
@@ -49,6 +79,33 @@ export class AdminService {
|
||||
async listPlans(): Promise<Plan[]> {
|
||||
return apiClient.get<Plan[]>(`/api/v1/admin/users/plans/list`)
|
||||
}
|
||||
|
||||
// Sound Management
|
||||
async scanSounds(): Promise<ScanResponse> {
|
||||
return apiClient.post<ScanResponse>(`/api/v1/admin/sounds/scan`)
|
||||
}
|
||||
|
||||
async normalizeAllSounds(force = false, onePass?: boolean): Promise<NormalizationResponse> {
|
||||
const params = new URLSearchParams()
|
||||
if (force) params.append('force', 'true')
|
||||
if (onePass !== undefined) params.append('one_pass', onePass.toString())
|
||||
|
||||
const queryString = params.toString()
|
||||
const url = queryString ? `/api/v1/admin/sounds/normalize/all?${queryString}` : `/api/v1/admin/sounds/normalize/all`
|
||||
|
||||
return apiClient.post<NormalizationResponse>(url)
|
||||
}
|
||||
|
||||
async normalizeSoundsByType(soundType: 'SDB' | 'TTS' | 'EXT', force = false, onePass?: boolean): Promise<NormalizationResponse> {
|
||||
const params = new URLSearchParams()
|
||||
if (force) params.append('force', 'true')
|
||||
if (onePass !== undefined) params.append('one_pass', onePass.toString())
|
||||
|
||||
const queryString = params.toString()
|
||||
const url = queryString ? `/api/v1/admin/sounds/normalize/type/${soundType}?${queryString}` : `/api/v1/admin/sounds/normalize/type/${soundType}`
|
||||
|
||||
return apiClient.post<NormalizationResponse>(url)
|
||||
}
|
||||
}
|
||||
|
||||
export const adminService = new AdminService()
|
||||
Reference in New Issue
Block a user