mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
cleaning up episode/series air date/time
This commit is contained in:
parent
cbe4be814c
commit
42849d3276
18 changed files with 61 additions and 168 deletions
|
@ -1,8 +0,0 @@
|
|||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
{
|
||||
public class Actor
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string character { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
|
||||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
{
|
||||
public class Episode
|
||||
{
|
||||
|
@ -10,9 +8,10 @@ namespace NzbDrone.Core.MetadataSource.Trakt
|
|||
public int tvdb_id { get; set; }
|
||||
public string title { get; set; }
|
||||
public string overview { get; set; }
|
||||
public DateTime? first_aired { get; set; }
|
||||
public int first_aired { get; set; }
|
||||
public string first_aired_iso { get; set; }
|
||||
public int first_aired_utc { get; set; }
|
||||
public string url { get; set; }
|
||||
public string screen { get; set; }
|
||||
public Ratings ratings { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
{
|
||||
public class People
|
||||
{
|
||||
public List<Actor> actors { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
{
|
||||
public class Ratings
|
||||
{
|
||||
public int percentage { get; set; }
|
||||
public int votes { get; set; }
|
||||
public int loved { get; set; }
|
||||
public int hated { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
{
|
||||
|
@ -8,14 +7,18 @@ namespace NzbDrone.Core.MetadataSource.Trakt
|
|||
public string title { get; set; }
|
||||
public int year { get; set; }
|
||||
public string url { get; set; }
|
||||
public DateTime? first_aired { get; set; }
|
||||
public int first_aired { get; set; }
|
||||
public string first_aired_iso { get; set; }
|
||||
public int first_aired_utc { get; set; }
|
||||
public string country { get; set; }
|
||||
public string overview { get; set; }
|
||||
public int runtime { get; set; }
|
||||
public string status { get; set; }
|
||||
public string network { get; set; }
|
||||
public string air_day { get; set; }
|
||||
public string air_day_utc { get; set; }
|
||||
public string air_time { get; set; }
|
||||
public string air_time_utc { get; set; }
|
||||
public string certification { get; set; }
|
||||
public string imdb_id { get; set; }
|
||||
public int tvdb_id { get; set; }
|
||||
|
@ -23,11 +26,6 @@ namespace NzbDrone.Core.MetadataSource.Trakt
|
|||
public int last_updated { get; set; }
|
||||
public string poster { get; set; }
|
||||
public Images images { get; set; }
|
||||
public List<TopWatcher> top_watchers { get; set; }
|
||||
public List<TopEpisode> top_episodes { get; set; }
|
||||
public Ratings ratings { get; set; }
|
||||
public Stats stats { get; set; }
|
||||
public People people { get; set; }
|
||||
public List<string> genres { get; set; }
|
||||
public List<Season> seasons { get; set; }
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
{
|
||||
public class Stats
|
||||
{
|
||||
public int watchers { get; set; }
|
||||
public int plays { get; set; }
|
||||
public int scrobbles { get; set; }
|
||||
public int scrobbles_unique { get; set; }
|
||||
public int checkins { get; set; }
|
||||
public int checkins_unique { get; set; }
|
||||
public int collection { get; set; }
|
||||
public int collection_unique { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
{
|
||||
public class TopEpisode
|
||||
{
|
||||
public int plays { get; set; }
|
||||
public int season { get; set; }
|
||||
public int number { get; set; }
|
||||
public string title { get; set; }
|
||||
public string url { get; set; }
|
||||
public int first_aired { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
namespace NzbDrone.Core.MetadataSource.Trakt
|
||||
{
|
||||
public class TopWatcher
|
||||
{
|
||||
public int plays { get; set; }
|
||||
public string username { get; set; }
|
||||
public bool @protected { get; set; }
|
||||
public object full_name { get; set; }
|
||||
public object gender { get; set; }
|
||||
public string age { get; set; }
|
||||
public object location { get; set; }
|
||||
public object about { get; set; }
|
||||
public int joined { get; set; }
|
||||
public string avatar { get; set; }
|
||||
public string url { get; set; }
|
||||
}
|
||||
}
|
|
@ -52,11 +52,11 @@ namespace NzbDrone.Core.MetadataSource
|
|||
series.TvRageId = show.tvrage_id;
|
||||
series.ImdbId = show.imdb_id;
|
||||
series.Title = show.title;
|
||||
series.FirstAired = show.first_aired;
|
||||
series.FirstAired =FromEpoc(show.first_aired_utc);
|
||||
series.Overview = show.overview;
|
||||
series.Runtime = show.runtime;
|
||||
series.Network = show.network;
|
||||
series.AirTime = show.air_time;
|
||||
series.AirTime = show.air_time_utc;
|
||||
series.TitleSlug = show.url.ToLower().Replace("http://trakt.tv/show/", "");
|
||||
series.Status = GetSeriesStatus(show.status);
|
||||
|
||||
|
@ -75,14 +75,14 @@ namespace NzbDrone.Core.MetadataSource
|
|||
episode.EpisodeNumber = traktEpisode.number;
|
||||
episode.TvDbEpisodeId = traktEpisode.tvdb_id;
|
||||
episode.Title = traktEpisode.title;
|
||||
episode.AirDate = traktEpisode.first_aired;
|
||||
episode.AirDate =FromEpoc(traktEpisode.first_aired_utc);
|
||||
|
||||
return episode;
|
||||
}
|
||||
|
||||
private static string GetPosterThumbnailUrl(string posterUrl)
|
||||
{
|
||||
if(posterUrl.Contains("poster-small.jpg")) return posterUrl;
|
||||
if (posterUrl.Contains("poster-small.jpg")) return posterUrl;
|
||||
|
||||
var extension = Path.GetExtension(posterUrl);
|
||||
var withoutExtension = posterUrl.Substring(0, posterUrl.Length - extension.Length);
|
||||
|
@ -95,5 +95,12 @@ namespace NzbDrone.Core.MetadataSource
|
|||
if (status.Equals("Ended", StringComparison.InvariantCultureIgnoreCase)) return SeriesStatusType.Ended;
|
||||
return SeriesStatusType.Continuing;
|
||||
}
|
||||
|
||||
private static DateTime? FromEpoc(long ticks)
|
||||
{
|
||||
if (ticks == 0) return null;
|
||||
|
||||
return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(ticks);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue