2015-01-09 01:43:51 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2015-05-07 15:43:52 +00:00
|
|
|
|
using System.Net;
|
2015-01-09 01:43:51 +00:00
|
|
|
|
using NLog;
|
2016-02-28 15:41:22 +00:00
|
|
|
|
using NzbDrone.Common.Cloud;
|
2015-01-09 01:43:51 +00:00
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
|
using NzbDrone.Common.Http;
|
2015-08-12 18:45:44 +00:00
|
|
|
|
using NzbDrone.Core.Exceptions;
|
2015-01-09 01:43:51 +00:00
|
|
|
|
using NzbDrone.Core.MediaCover;
|
|
|
|
|
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
2017-04-28 22:05:35 +00:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using NzbDrone.Core.Music;
|
|
|
|
|
using Newtonsoft.Json;
|
2015-01-09 01:43:51 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.MetadataSource.SkyHook
|
|
|
|
|
{
|
2017-04-30 21:54:01 +00:00
|
|
|
|
public class SkyHookProxy : IProvideSeriesInfo, IProvideArtistInfo, ISearchForNewSeries
|
2015-01-09 01:43:51 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly IHttpClient _httpClient;
|
2015-05-07 15:43:52 +00:00
|
|
|
|
private readonly Logger _logger;
|
2015-01-09 01:43:51 +00:00
|
|
|
|
|
2016-02-28 15:41:22 +00:00
|
|
|
|
private readonly IHttpRequestBuilderFactory _requestBuilder;
|
|
|
|
|
|
2017-03-30 03:49:38 +00:00
|
|
|
|
public SkyHookProxy(IHttpClient httpClient, ILidarrCloudRequestBuilder requestBuilder, Logger logger)
|
2015-01-09 01:43:51 +00:00
|
|
|
|
{
|
|
|
|
|
_httpClient = httpClient;
|
2017-04-28 22:05:35 +00:00
|
|
|
|
_requestBuilder = requestBuilder.Search;
|
2015-05-07 15:43:52 +00:00
|
|
|
|
_logger = logger;
|
2015-01-09 01:43:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-07 16:58:24 +00:00
|
|
|
|
|
|
|
|
|
|
2015-01-09 01:43:51 +00:00
|
|
|
|
public Tuple<Series, List<Episode>> GetSeriesInfo(int tvdbSeriesId)
|
|
|
|
|
{
|
2017-04-28 22:05:35 +00:00
|
|
|
|
Console.WriteLine("[GetSeriesInfo] id:" + tvdbSeriesId);
|
2016-02-28 15:41:22 +00:00
|
|
|
|
var httpRequest = _requestBuilder.Create()
|
|
|
|
|
.SetSegment("route", "shows")
|
|
|
|
|
.Resource(tvdbSeriesId.ToString())
|
|
|
|
|
.Build();
|
|
|
|
|
|
2015-08-12 18:45:44 +00:00
|
|
|
|
httpRequest.AllowAutoRedirect = true;
|
|
|
|
|
httpRequest.SuppressHttpError = true;
|
2015-05-07 15:43:52 +00:00
|
|
|
|
|
2015-01-09 01:43:51 +00:00
|
|
|
|
var httpResponse = _httpClient.Get<ShowResource>(httpRequest);
|
2015-08-12 18:45:44 +00:00
|
|
|
|
|
|
|
|
|
if (httpResponse.HasHttpError)
|
|
|
|
|
{
|
|
|
|
|
if (httpResponse.StatusCode == HttpStatusCode.NotFound)
|
|
|
|
|
{
|
|
|
|
|
throw new SeriesNotFoundException(tvdbSeriesId);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw new HttpException(httpRequest, httpResponse);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-09 01:43:51 +00:00
|
|
|
|
var episodes = httpResponse.Resource.Episodes.Select(MapEpisode);
|
|
|
|
|
var series = MapSeries(httpResponse.Resource);
|
|
|
|
|
|
|
|
|
|
return new Tuple<Series, List<Episode>>(series, episodes.ToList());
|
|
|
|
|
}
|
|
|
|
|
|
2015-05-07 15:43:52 +00:00
|
|
|
|
public List<Series> SearchForNewSeries(string title)
|
|
|
|
|
{
|
2017-05-07 19:32:13 +00:00
|
|
|
|
// TODO: Remove this API
|
|
|
|
|
var tempList = new List<Series>();
|
|
|
|
|
var tempSeries = new Series();
|
|
|
|
|
tempSeries.Title = "AFI";
|
|
|
|
|
tempList.Add(tempSeries);
|
|
|
|
|
return tempList;
|
|
|
|
|
}
|
2017-04-28 22:05:35 +00:00
|
|
|
|
|
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
public Tuple<Artist, List<Track>> GetArtistInfo(string spotifyId)
|
|
|
|
|
{
|
2017-04-28 22:05:35 +00:00
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
_logger.Debug("Getting Artist with SpotifyId of {0}", spotifyId);
|
2017-04-28 22:05:35 +00:00
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
///v1/albums/{id}
|
|
|
|
|
//
|
2017-05-05 17:57:58 +00:00
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
// We need to perform a direct lookup of the artist
|
|
|
|
|
var httpRequest = _requestBuilder.Create()
|
|
|
|
|
.SetSegment("route", "artists/" + spotifyId)
|
|
|
|
|
//.SetSegment("route", "search")
|
|
|
|
|
//.AddQueryParam("type", "artist,album")
|
|
|
|
|
//.AddQueryParam("q", spotifyId.ToString())
|
2017-05-05 18:35:28 +00:00
|
|
|
|
.Build();
|
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
|
2017-04-30 21:54:01 +00:00
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
httpRequest.AllowAutoRedirect = true;
|
|
|
|
|
httpRequest.SuppressHttpError = true;
|
2017-04-30 21:54:01 +00:00
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
var httpResponse = _httpClient.Get<ArtistInfoResource>(httpRequest);
|
2017-05-05 19:33:46 +00:00
|
|
|
|
|
2017-04-30 21:54:01 +00:00
|
|
|
|
|
|
|
|
|
if (httpResponse.HasHttpError)
|
|
|
|
|
{
|
|
|
|
|
if (httpResponse.StatusCode == HttpStatusCode.NotFound)
|
|
|
|
|
{
|
2017-05-07 19:32:13 +00:00
|
|
|
|
throw new ArtistNotFoundException(spotifyId);
|
2017-04-30 21:54:01 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2017-05-07 19:32:13 +00:00
|
|
|
|
throw new HttpException(httpRequest, httpResponse);
|
2017-05-05 18:35:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
Artist artist = new Artist();
|
|
|
|
|
artist.ArtistName = httpResponse.Resource.Name;
|
|
|
|
|
artist.SpotifyId = httpResponse.Resource.Id;
|
|
|
|
|
artist.Genres = httpResponse.Resource.Genres;
|
|
|
|
|
//Artist artist = MapArtists(httpResponse.Resource)[0];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
artist = MapAlbums(artist);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: implement tracks api call
|
|
|
|
|
return new Tuple<Artist, List<Track>>(artist, new List<Track>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Artist MapAlbums(Artist artist)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Find all albums for the artist and all tracks for said album
|
|
|
|
|
///v1/artists/{id}/albums
|
|
|
|
|
var httpRequest = _requestBuilder.Create()
|
|
|
|
|
.SetSegment("route", "artists/" + artist.SpotifyId + "/albums")
|
|
|
|
|
.Build();
|
|
|
|
|
httpRequest.AllowAutoRedirect = true;
|
|
|
|
|
httpRequest.SuppressHttpError = true;
|
|
|
|
|
|
|
|
|
|
var httpResponse = _httpClient.Get<AlbumResultResource>(httpRequest);
|
|
|
|
|
|
|
|
|
|
if (httpResponse.HasHttpError)
|
|
|
|
|
{
|
|
|
|
|
throw new HttpException(httpRequest, httpResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Album> albums = new List<Album>();
|
|
|
|
|
foreach(var albumResource in httpResponse.Resource.Items)
|
2017-05-05 18:35:28 +00:00
|
|
|
|
{
|
2017-05-07 19:32:13 +00:00
|
|
|
|
Album album = new Album();
|
|
|
|
|
album.AlbumId = albumResource.Id;
|
|
|
|
|
album.Title = albumResource.Name;
|
|
|
|
|
album.ArtworkUrl = albumResource.Images[0].Url;
|
|
|
|
|
albums.Add(album);
|
2017-04-30 21:54:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
// TODO: We now need to get all tracks for each album
|
|
|
|
|
|
|
|
|
|
artist.Albums = albums;
|
|
|
|
|
return artist;
|
2017-04-30 21:54:01 +00:00
|
|
|
|
}
|
2017-05-05 19:33:46 +00:00
|
|
|
|
|
2017-04-28 22:05:35 +00:00
|
|
|
|
public List<Artist> SearchForNewArtist(string title)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var lowerTitle = title.ToLowerInvariant();
|
|
|
|
|
Console.WriteLine("Searching for " + lowerTitle);
|
|
|
|
|
|
2017-04-30 13:54:37 +00:00
|
|
|
|
if (lowerTitle.StartsWith("itunes:") || lowerTitle.StartsWith("itunesid:"))
|
|
|
|
|
{
|
|
|
|
|
var slug = lowerTitle.Split(':')[1].Trim();
|
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
if (slug.IsNullOrWhiteSpace() || slug.Any(char.IsWhiteSpace))
|
2017-04-30 13:54:37 +00:00
|
|
|
|
{
|
|
|
|
|
return new List<Artist>();
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-30 21:54:01 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
2017-05-07 19:32:13 +00:00
|
|
|
|
return new List<Artist> { GetArtistInfo(slug).Item1 };
|
2017-04-30 21:54:01 +00:00
|
|
|
|
}
|
|
|
|
|
catch (ArtistNotFoundException)
|
|
|
|
|
{
|
|
|
|
|
return new List<Artist>();
|
|
|
|
|
}
|
2017-04-30 13:54:37 +00:00
|
|
|
|
}
|
2015-05-07 15:43:52 +00:00
|
|
|
|
|
2016-02-28 15:41:22 +00:00
|
|
|
|
var httpRequest = _requestBuilder.Create()
|
2017-04-30 21:54:01 +00:00
|
|
|
|
.SetSegment("route", "search")
|
2017-05-07 19:32:13 +00:00
|
|
|
|
.AddQueryParam("type", "artist,album")
|
|
|
|
|
.AddQueryParam("q", title.ToLower().Trim())
|
2017-04-28 22:05:35 +00:00
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
2015-05-07 15:43:52 +00:00
|
|
|
|
|
2017-04-28 22:05:35 +00:00
|
|
|
|
var httpResponse = _httpClient.Get<ArtistResource>(httpRequest);
|
|
|
|
|
|
2017-05-05 19:33:46 +00:00
|
|
|
|
|
|
|
|
|
List<Artist> artists = MapArtists(httpResponse.Resource);
|
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
return artists;
|
2015-05-07 15:43:52 +00:00
|
|
|
|
}
|
2015-08-12 18:45:44 +00:00
|
|
|
|
catch (HttpException)
|
2015-05-07 15:43:52 +00:00
|
|
|
|
{
|
|
|
|
|
throw new SkyHookException("Search for '{0}' failed. Unable to communicate with SkyHook.", title);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2016-02-11 21:13:42 +00:00
|
|
|
|
_logger.Warn(ex, ex.Message);
|
2015-05-07 15:43:52 +00:00
|
|
|
|
throw new SkyHookException("Search for '{0}' failed. Invalid response received from SkyHook.", title);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-05 17:57:58 +00:00
|
|
|
|
private Artist MapArtistInfo(ArtistInfoResource resource)
|
|
|
|
|
{
|
|
|
|
|
// This expects ArtistInfoResource, thus just need to populate one artist
|
|
|
|
|
Artist artist = new Artist();
|
2017-05-07 19:32:13 +00:00
|
|
|
|
//artist.Overview = resource.artistBio;
|
|
|
|
|
//artist.ArtistName = resource.name;
|
|
|
|
|
//foreach(var genre in resource.genreNames)
|
|
|
|
|
//{
|
|
|
|
|
// artist.Genres.Add(genre);
|
|
|
|
|
//}
|
2017-05-05 17:57:58 +00:00
|
|
|
|
|
|
|
|
|
return artist;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-30 21:54:01 +00:00
|
|
|
|
private List<Artist> MapArtists(ArtistResource resource)
|
|
|
|
|
{
|
2017-05-07 19:32:13 +00:00
|
|
|
|
|
|
|
|
|
|
2017-04-30 21:54:01 +00:00
|
|
|
|
List<Artist> artists = new List<Artist>();
|
2017-05-07 19:32:13 +00:00
|
|
|
|
foreach(var artistResource in resource.Artists.Items)
|
2017-04-30 21:54:01 +00:00
|
|
|
|
{
|
2017-05-07 19:32:13 +00:00
|
|
|
|
Artist artist = new Artist();
|
|
|
|
|
artist.ArtistName = artistResource.Name;
|
|
|
|
|
artist.SpotifyId = artistResource.Id;
|
|
|
|
|
artist.Genres = artistResource.Genres;
|
|
|
|
|
//artist.ArtistSlug = a//TODO implement artistSlug mapping;
|
|
|
|
|
artists.Add(artist);
|
|
|
|
|
}
|
2017-04-30 21:54:01 +00:00
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
// Maybe? Get all the albums for said artist
|
2017-04-30 21:54:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return artists;
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-07 19:32:13 +00:00
|
|
|
|
//private Album MapAlbum(AlbumResource albumQuery)
|
|
|
|
|
//{
|
|
|
|
|
// Album album = new Album();
|
|
|
|
|
|
|
|
|
|
// album.AlbumId = albumQuery.CollectionId;
|
|
|
|
|
// album.Title = albumQuery.CollectionName;
|
|
|
|
|
// album.Year = albumQuery.ReleaseDate.Year;
|
|
|
|
|
// album.ArtworkUrl = albumQuery.ArtworkUrl100;
|
|
|
|
|
// album.Explicitness = albumQuery.CollectionExplicitness;
|
|
|
|
|
// return album;
|
|
|
|
|
//}
|
2017-04-28 22:05:35 +00:00
|
|
|
|
|
2015-01-09 01:43:51 +00:00
|
|
|
|
private static Series MapSeries(ShowResource show)
|
|
|
|
|
{
|
|
|
|
|
var series = new Series();
|
|
|
|
|
series.TvdbId = show.TvdbId;
|
|
|
|
|
|
|
|
|
|
if (show.TvRageId.HasValue)
|
|
|
|
|
{
|
|
|
|
|
series.TvRageId = show.TvRageId.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-09 20:22:28 +00:00
|
|
|
|
if (show.TvMazeId.HasValue)
|
|
|
|
|
{
|
|
|
|
|
series.TvMazeId = show.TvMazeId.Value;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-09 01:43:51 +00:00
|
|
|
|
series.ImdbId = show.ImdbId;
|
|
|
|
|
series.Title = show.Title;
|
|
|
|
|
series.CleanTitle = Parser.Parser.CleanSeriesTitle(show.Title);
|
|
|
|
|
series.SortTitle = SeriesTitleNormalizer.Normalize(show.Title, show.TvdbId);
|
|
|
|
|
|
|
|
|
|
if (show.FirstAired != null)
|
|
|
|
|
{
|
|
|
|
|
series.FirstAired = DateTime.Parse(show.FirstAired).ToUniversalTime();
|
|
|
|
|
series.Year = series.FirstAired.Value.Year;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
series.Overview = show.Overview;
|
|
|
|
|
|
|
|
|
|
if (show.Runtime != null)
|
|
|
|
|
{
|
|
|
|
|
series.Runtime = show.Runtime.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
series.Network = show.Network;
|
|
|
|
|
|
|
|
|
|
if (show.TimeOfDay != null)
|
|
|
|
|
{
|
|
|
|
|
series.AirTime = string.Format("{0:00}:{1:00}", show.TimeOfDay.Hours, show.TimeOfDay.Minutes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
series.TitleSlug = show.Slug;
|
|
|
|
|
series.Status = MapSeriesStatus(show.Status);
|
|
|
|
|
series.Ratings = MapRatings(show.Rating);
|
|
|
|
|
series.Genres = show.Genres;
|
|
|
|
|
|
|
|
|
|
if (show.ContentRating.IsNotNullOrWhiteSpace())
|
|
|
|
|
{
|
|
|
|
|
series.Certification = show.ContentRating.ToUpper();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
series.Actors = show.Actors.Select(MapActors).ToList();
|
|
|
|
|
series.Seasons = show.Seasons.Select(MapSeason).ToList();
|
|
|
|
|
series.Images = show.Images.Select(MapImage).ToList();
|
2017-02-28 05:37:33 +00:00
|
|
|
|
series.Monitored = true;
|
2015-01-09 01:43:51 +00:00
|
|
|
|
|
|
|
|
|
return series;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Actor MapActors(ActorResource arg)
|
|
|
|
|
{
|
|
|
|
|
var newActor = new Actor
|
|
|
|
|
{
|
|
|
|
|
Name = arg.Name,
|
2015-05-07 15:43:52 +00:00
|
|
|
|
Character = arg.Character
|
2015-01-09 01:43:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (arg.Image != null)
|
|
|
|
|
{
|
|
|
|
|
newActor.Images = new List<MediaCover.MediaCover>
|
|
|
|
|
{
|
|
|
|
|
new MediaCover.MediaCover(MediaCoverTypes.Headshot, arg.Image)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return newActor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Episode MapEpisode(EpisodeResource oracleEpisode)
|
|
|
|
|
{
|
|
|
|
|
var episode = new Episode();
|
|
|
|
|
episode.Overview = oracleEpisode.Overview;
|
|
|
|
|
episode.SeasonNumber = oracleEpisode.SeasonNumber;
|
|
|
|
|
episode.EpisodeNumber = oracleEpisode.EpisodeNumber;
|
|
|
|
|
episode.AbsoluteEpisodeNumber = oracleEpisode.AbsoluteEpisodeNumber;
|
|
|
|
|
episode.Title = oracleEpisode.Title;
|
|
|
|
|
|
|
|
|
|
episode.AirDate = oracleEpisode.AirDate;
|
|
|
|
|
episode.AirDateUtc = oracleEpisode.AirDateUtc;
|
|
|
|
|
|
2015-01-09 18:03:44 +00:00
|
|
|
|
episode.Ratings = MapRatings(oracleEpisode.Rating);
|
2015-01-09 01:43:51 +00:00
|
|
|
|
|
|
|
|
|
//Don't include series fanart images as episode screenshot
|
|
|
|
|
if (oracleEpisode.Image != null)
|
|
|
|
|
{
|
|
|
|
|
episode.Images.Add(new MediaCover.MediaCover(MediaCoverTypes.Screenshot, oracleEpisode.Image));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return episode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Season MapSeason(SeasonResource seasonResource)
|
|
|
|
|
{
|
|
|
|
|
return new Season
|
|
|
|
|
{
|
|
|
|
|
SeasonNumber = seasonResource.SeasonNumber,
|
2017-02-28 05:37:33 +00:00
|
|
|
|
Images = seasonResource.Images.Select(MapImage).ToList(),
|
|
|
|
|
Monitored = seasonResource.SeasonNumber > 0
|
2015-01-09 01:43:51 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static SeriesStatusType MapSeriesStatus(string status)
|
|
|
|
|
{
|
|
|
|
|
if (status.Equals("ended", StringComparison.InvariantCultureIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
return SeriesStatusType.Ended;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return SeriesStatusType.Continuing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Ratings MapRatings(RatingResource rating)
|
|
|
|
|
{
|
|
|
|
|
if (rating == null)
|
|
|
|
|
{
|
|
|
|
|
return new Ratings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new Ratings
|
|
|
|
|
{
|
|
|
|
|
Votes = rating.Count,
|
|
|
|
|
Value = rating.Value
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static MediaCover.MediaCover MapImage(ImageResource arg)
|
|
|
|
|
{
|
|
|
|
|
return new MediaCover.MediaCover
|
|
|
|
|
{
|
|
|
|
|
Url = arg.Url,
|
|
|
|
|
CoverType = MapCoverType(arg.CoverType)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static MediaCoverTypes MapCoverType(string coverType)
|
|
|
|
|
{
|
|
|
|
|
switch (coverType.ToLower())
|
|
|
|
|
{
|
|
|
|
|
case "poster":
|
|
|
|
|
return MediaCoverTypes.Poster;
|
|
|
|
|
case "banner":
|
|
|
|
|
return MediaCoverTypes.Banner;
|
|
|
|
|
case "fanart":
|
|
|
|
|
return MediaCoverTypes.Fanart;
|
|
|
|
|
default:
|
|
|
|
|
return MediaCoverTypes.Unknown;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|