mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 15:32:37 -07:00
parent
74125286b5
commit
d6684eb1de
3 changed files with 40 additions and 20 deletions
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
|
@ -77,13 +78,6 @@ namespace Ombi.Api
|
|||
|
||||
var response = client.Execute(request);
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
Log.Error(response.ErrorException);
|
||||
var message = "Error retrieving response. Check inner details for more info.";
|
||||
throw new ApiRequestException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using Ombi.Api.Models.Tv;
|
||||
using RestSharp;
|
||||
|
@ -90,8 +91,10 @@ namespace Ombi.Api
|
|||
};
|
||||
request.AddUrlSegment("id", theTvDbId.ToString());
|
||||
request.AddHeader("Content-Type", "application/json");
|
||||
|
||||
var obj = Api.Execute<TvMazeShow>(request, new Uri(Uri));
|
||||
try
|
||||
{
|
||||
var result = Api.Execute(request, new Uri(Uri));
|
||||
var obj = JsonConvert.DeserializeObject<TvMazeShow>(result.Content);
|
||||
|
||||
var episodes = EpisodeLookup(obj.id).ToList();
|
||||
|
||||
|
@ -106,6 +109,12 @@ namespace Ombi.Api
|
|||
|
||||
return obj;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<TvMazeSeasons> GetSeasons(int id)
|
||||
{
|
||||
|
|
|
@ -437,6 +437,11 @@ namespace Ombi.UI.Modules
|
|||
{
|
||||
var show = anticipatedShow.Show;
|
||||
var theTvDbId = int.Parse(show.Ids.Tvdb.ToString());
|
||||
var result = TvApi.ShowLookupByTheTvDbId(theTvDbId);
|
||||
if (result == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var model = new SearchTvShowViewModel
|
||||
{
|
||||
|
@ -466,6 +471,12 @@ namespace Ombi.UI.Modules
|
|||
{
|
||||
var show = watched.Show;
|
||||
var theTvDbId = int.Parse(show.Ids.Tvdb.ToString());
|
||||
var result = TvApi.ShowLookupByTheTvDbId(theTvDbId);
|
||||
if (result == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var model = new SearchTvShowViewModel
|
||||
{
|
||||
FirstAired = show.FirstAired?.ToString("yyyy-MM-ddTHH:mm:ss"),
|
||||
|
@ -494,6 +505,12 @@ namespace Ombi.UI.Modules
|
|||
{
|
||||
var show = watched.Show;
|
||||
var theTvDbId = int.Parse(show.Ids.Tvdb.ToString());
|
||||
var result = TvApi.ShowLookupByTheTvDbId(theTvDbId);
|
||||
if (result == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var model = new SearchTvShowViewModel
|
||||
{
|
||||
FirstAired = show.FirstAired?.ToString("yyyy-MM-ddTHH:mm:ss"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue