mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Merge branch 'develop' of https://github.com/tidusjar/Ombi into develop
This commit is contained in:
commit
7a6e247314
4 changed files with 22 additions and 6 deletions
|
@ -84,7 +84,7 @@ namespace Ombi.Api.Lidarr
|
||||||
|
|
||||||
public Task<AlbumByArtistResponse> GetAlbumsByArtist(string foreignArtistId)
|
public Task<AlbumByArtistResponse> GetAlbumsByArtist(string foreignArtistId)
|
||||||
{
|
{
|
||||||
var request = new Request(string.Empty, $"https://api.lidarr.audio/api/v0.3/artist/{foreignArtistId}",
|
var request = new Request(string.Empty, $"https://api.lidarr.audio/api/v0.4/artist/{foreignArtistId}",
|
||||||
HttpMethod.Get) {IgnoreBaseUrlAppend = true};
|
HttpMethod.Get) {IgnoreBaseUrlAppend = true};
|
||||||
return Api.Request<AlbumByArtistResponse>(request);
|
return Api.Request<AlbumByArtistResponse>(request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace Ombi.Api
|
||||||
|
|
||||||
// do something with the response
|
// do something with the response
|
||||||
var receivedString = await httpResponseMessage.Content.ReadAsStringAsync();
|
var receivedString = await httpResponseMessage.Content.ReadAsStringAsync();
|
||||||
|
LogDebugContent(receivedString);
|
||||||
if (request.ContentType == ContentType.Json)
|
if (request.ContentType == ContentType.Json)
|
||||||
{
|
{
|
||||||
request.OnBeforeDeserialization?.Invoke(receivedString);
|
request.OnBeforeDeserialization?.Invoke(receivedString);
|
||||||
|
@ -110,7 +111,7 @@ namespace Ombi.Api
|
||||||
}
|
}
|
||||||
// do something with the response
|
// do something with the response
|
||||||
var data = httpResponseMessage.Content;
|
var data = httpResponseMessage.Content;
|
||||||
|
await LogDebugContent(httpResponseMessage);
|
||||||
return await data.ReadAsStringAsync();
|
return await data.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +123,7 @@ namespace Ombi.Api
|
||||||
{
|
{
|
||||||
AddHeadersBody(request, httpRequestMessage);
|
AddHeadersBody(request, httpRequestMessage);
|
||||||
var httpResponseMessage = await _client.SendAsync(httpRequestMessage);
|
var httpResponseMessage = await _client.SendAsync(httpRequestMessage);
|
||||||
|
await LogDebugContent(httpResponseMessage);
|
||||||
if (!httpResponseMessage.IsSuccessStatusCode)
|
if (!httpResponseMessage.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
if (!request.IgnoreErrors)
|
if (!request.IgnoreErrors)
|
||||||
|
@ -132,11 +134,12 @@ namespace Ombi.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddHeadersBody(Request request, HttpRequestMessage httpRequestMessage)
|
private void AddHeadersBody(Request request, HttpRequestMessage httpRequestMessage)
|
||||||
{
|
{
|
||||||
// Add the Json Body
|
// Add the Json Body
|
||||||
if (request.JsonBody != null)
|
if (request.JsonBody != null)
|
||||||
{
|
{
|
||||||
|
LogDebugContent("REQUEST: " + request.JsonBody);
|
||||||
httpRequestMessage.Content = new JsonContent(request.JsonBody);
|
httpRequestMessage.Content = new JsonContent(request.JsonBody);
|
||||||
httpRequestMessage.Content.Headers.ContentType =
|
httpRequestMessage.Content.Headers.ContentType =
|
||||||
new MediaTypeHeaderValue("application/json"); // Emby connect fails if we have the charset in the header
|
new MediaTypeHeaderValue("application/json"); // Emby connect fails if we have the charset in the header
|
||||||
|
@ -153,11 +156,24 @@ namespace Ombi.Api
|
||||||
{
|
{
|
||||||
Logger.LogError(LoggingEvents.Api,
|
Logger.LogError(LoggingEvents.Api,
|
||||||
$"StatusCode: {httpResponseMessage.StatusCode}, Reason: {httpResponseMessage.ReasonPhrase}, RequestUri: {request.FullUri}");
|
$"StatusCode: {httpResponseMessage.StatusCode}, Reason: {httpResponseMessage.ReasonPhrase}, RequestUri: {request.FullUri}");
|
||||||
|
await LogDebugContent(httpResponseMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LogDebugContent(HttpResponseMessage message)
|
||||||
|
{
|
||||||
if (Logger.IsEnabled(LogLevel.Debug))
|
if (Logger.IsEnabled(LogLevel.Debug))
|
||||||
{
|
{
|
||||||
var content = await httpResponseMessage.Content.ReadAsStringAsync();
|
var content = await message.Content.ReadAsStringAsync();
|
||||||
Logger.LogDebug(content);
|
Logger.LogDebug(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LogDebugContent(string message)
|
||||||
|
{
|
||||||
|
if (Logger.IsEnabled(LogLevel.Debug))
|
||||||
|
{
|
||||||
|
Logger.LogDebug(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace Ombi.Schedule.Jobs.Radarr
|
||||||
var movieIds = new List<RadarrCache>();
|
var movieIds = new List<RadarrCache>();
|
||||||
foreach (var m in movies)
|
foreach (var m in movies)
|
||||||
{
|
{
|
||||||
if (m.tmdbId > 0)
|
if (m.tmdbId > 0 && m.monitored)
|
||||||
{
|
{
|
||||||
movieIds.Add(new RadarrCache
|
movieIds.Add(new RadarrCache
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue