feat(p12-w2): track-cardinal high-res waveform fetch + bridge rewire
Add GET api/track/{trackEntryKey}/waveform/high-res (+ proxy), ITrackDataService.GetTrackWaveform; rewire visualizer to resolve the current track's EntryKey and re-fetch on track change. Retire the client mix-waveform read path.
This commit is contained in:
@@ -83,27 +83,4 @@ public class ReleaseClient
|
||||
? ApiResult<ReleaseDto>.CreatePassResult(release)
|
||||
: ApiResult<ReleaseDto>.CreateFailResult("Failed to deserialize response");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the high-res waveform datum for a Mix release, addressed by its public EntryKey. A 404
|
||||
/// means no datum is stored (not yet generated, or not a Mix) — a valid state, so it returns a pass
|
||||
/// result with a null value. Any other non-success status is a genuine failure.
|
||||
/// </summary>
|
||||
public async Task<ApiResult<WaveformProfileDto?>> GetMixWaveform(string entryKey)
|
||||
{
|
||||
var response = await _http.GetAsync($"api/release/{Uri.EscapeDataString(entryKey)}/mix/waveform");
|
||||
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
return ApiResult<WaveformProfileDto?>.CreatePassResult(null);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return ApiResult<WaveformProfileDto?>.CreateFailResult($"HTTP {(int)response.StatusCode}");
|
||||
|
||||
var json = await response.Content.ReadAsStringAsync();
|
||||
var profile = JsonSerializer.Deserialize<WaveformProfileDto>(json, JsonOptions);
|
||||
|
||||
return profile is not null
|
||||
? ApiResult<WaveformProfileDto?>.CreatePassResult(profile)
|
||||
: ApiResult<WaveformProfileDto?>.CreateFailResult("Failed to deserialize response");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,33 @@ public class TrackClient
|
||||
: ApiResult<List<GenreSummaryDto>>.CreateFailResult("Failed to deserialize response");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the per-track high-res waveform datum, addressed by the track's EntryKey (phase-12 §5b).
|
||||
/// A 404 means no high-res datum is stored (a track not yet backfilled) — a valid state, so it
|
||||
/// returns a pass result with a null value and the visualizer blanks gracefully. Any other
|
||||
/// non-success status is a genuine failure.
|
||||
/// </summary>
|
||||
public async Task<ApiResult<WaveformProfileDto?>> GetTrackWaveform(string trackEntryKey)
|
||||
{
|
||||
var response = await _http.GetAsync($"api/track/{Uri.EscapeDataString(trackEntryKey)}/waveform/high-res");
|
||||
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.NotFound)
|
||||
return ApiResult<WaveformProfileDto?>.CreatePassResult(null);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
return ApiResult<WaveformProfileDto?>.CreateFailResult($"HTTP {(int)response.StatusCode}");
|
||||
|
||||
var json = await response.Content.ReadAsStringAsync();
|
||||
var profile = JsonSerializer.Deserialize<WaveformProfileDto>(json, new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
});
|
||||
|
||||
return profile is not null
|
||||
? ApiResult<WaveformProfileDto?>.CreatePassResult(profile)
|
||||
: ApiResult<WaveformProfileDto?>.CreateFailResult("Failed to deserialize response");
|
||||
}
|
||||
|
||||
public async Task<ApiResult<TrackDto>> GetTrack(string entryKey)
|
||||
{
|
||||
var response = await _http.GetAsync($"api/track/meta/by-key/{Uri.EscapeDataString(entryKey)}");
|
||||
|
||||
Reference in New Issue
Block a user