add trakt external url

This commit is contained in:
Luke Pulverenti 2016-05-29 02:03:09 -04:00
parent 2e2766bd19
commit 88415471eb
6 changed files with 66 additions and 3 deletions

View File

@ -26,6 +26,7 @@ using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Entities
{
@ -2212,5 +2213,10 @@ namespace MediaBrowser.Controller.Entities
DeleteFileLocation = false
});
}
public virtual List<ExternalUrl> GetRelatedUrls()
{
return new List<ExternalUrl>();
}
}
}

View File

@ -8,6 +8,7 @@ using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Entities.Movies
{
@ -163,5 +164,22 @@ namespace MediaBrowser.Controller.Entities.Movies
return hasChanges;
}
public override List<ExternalUrl> GetRelatedUrls()
{
var list = base.GetRelatedUrls();
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
if (!string.IsNullOrWhiteSpace(imdbId))
{
list.Add(new ExternalUrl
{
Name = "Trakt",
Url = string.Format("https://trakt.tv/movies/{0}", imdbId)
});
}
return list;
}
}
}

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Serialization;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Entities
{
@ -110,5 +111,22 @@ namespace MediaBrowser.Controller.Entities
return hasChanges;
}
public override List<ExternalUrl> GetRelatedUrls()
{
var list = base.GetRelatedUrls();
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
if (!string.IsNullOrWhiteSpace(imdbId))
{
list.Add(new ExternalUrl
{
Name = "Trakt",
Url = string.Format("https://trakt.tv/movies/{0}", imdbId)
});
}
return list;
}
}
}

View File

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.LiveTv
{
@ -235,5 +236,25 @@ namespace MediaBrowser.Controller.LiveTv
return false;
}
}
public override List<ExternalUrl> GetRelatedUrls()
{
var list = base.GetRelatedUrls();
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
if (!string.IsNullOrWhiteSpace(imdbId))
{
if (IsMovie)
{
list.Add(new ExternalUrl
{
Name = "Trakt",
Url = string.Format("https://trakt.tv/movies/{0}", imdbId)
});
}
}
return list;
}
}
}

View File

@ -133,7 +133,7 @@ namespace MediaBrowser.Controller.Providers
/// </summary>
/// <param name="item">The item.</param>
/// <returns>IEnumerable{ExternalUrl}.</returns>
IEnumerable<ExternalUrl> GetExternalUrls(IHasProviderIds item);
IEnumerable<ExternalUrl> GetExternalUrls(BaseItem item);
/// <summary>
/// Gets the external identifier infos.

View File

@ -830,7 +830,7 @@ namespace MediaBrowser.Providers.Manager
});
}
public IEnumerable<ExternalUrl> GetExternalUrls(IHasProviderIds item)
public IEnumerable<ExternalUrl> GetExternalUrls(BaseItem item)
{
return GetExternalIds(item)
.Select(i =>
@ -853,7 +853,7 @@ namespace MediaBrowser.Providers.Manager
Url = string.Format(i.UrlFormatString, value)
};
}).Where(i => i != null);
}).Where(i => i != null).Concat(item.GetRelatedUrls());
}
public IEnumerable<ExternalIdInfo> GetExternalIdInfos(IHasProviderIds item)