more consolidation
This commit is contained in:
@@ -135,54 +135,11 @@ public class SRFApiClient : IDisposable
|
||||
{
|
||||
try
|
||||
{
|
||||
var url = $"/mediaComposition/byUrn/{urn}.json";
|
||||
var fullUrl = $"{ApiEndpoints.IntegrationLayerBaseUrl}{url}";
|
||||
_logger.LogInformation("Fetching media composition for URN: {Urn} from {Url}", urn, fullUrl);
|
||||
var fullUrl = $"{ApiEndpoints.IntegrationLayerBaseUrl}/mediaComposition/byUrn/{urn}.json";
|
||||
_logger.LogDebug("Fetching media composition for URN: {Urn} from {Url}", urn, fullUrl);
|
||||
|
||||
// HttpClient consistently fails with 404, use curl directly
|
||||
// This is likely due to routing/network configuration on the Jellyfin server
|
||||
// Use curl - HttpClient returns 404 due to server routing/network configuration
|
||||
return await FetchWithCurlAsync(fullUrl, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
/* HttpClient fallback disabled - always returns 404
|
||||
var response = await _httpClient.GetAsync(url, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Log response headers to diagnose geo-blocking
|
||||
var xLocation = response.Headers.Contains("x-location")
|
||||
? string.Join(", ", response.Headers.GetValues("x-location"))
|
||||
: "not present";
|
||||
|
||||
_logger.LogInformation(
|
||||
"Media composition response for URN {Urn}: StatusCode={StatusCode}, x-location={XLocation}",
|
||||
urn,
|
||||
response.StatusCode,
|
||||
xLocation);
|
||||
|
||||
// If HttpClient fails, try curl as fallback
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogWarning("HttpClient failed with {StatusCode}, trying curl fallback", response.StatusCode);
|
||||
return await FetchWithCurlAsync(fullUrl, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
|
||||
var result = JsonSerializer.Deserialize<MediaComposition>(content, _jsonOptions);
|
||||
|
||||
if (result?.ChapterList != null && result.ChapterList.Count > 0)
|
||||
{
|
||||
_logger.LogInformation(
|
||||
"Successfully fetched media composition for URN: {Urn} - Chapters: {ChapterCount}",
|
||||
urn,
|
||||
result.ChapterList.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogWarning("Media composition for URN {Urn} has no chapters", urn);
|
||||
}
|
||||
|
||||
return result;
|
||||
*/
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user