use modular id's on edit page
This commit is contained in:
parent
0d90f1d450
commit
8f22edb503
|
@ -6,8 +6,10 @@ using MediaBrowser.Controller.Entities.Movies;
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using ServiceStack;
|
||||
using System;
|
||||
|
@ -48,6 +50,18 @@ namespace MediaBrowser.Api.Library
|
|||
public int Index { get; set; }
|
||||
}
|
||||
|
||||
[Route("/Items/{Id}/ExternalIdInfos", "GET")]
|
||||
[Api(Description = "Gets external id infos for an item")]
|
||||
public class GetExternalIdInfos : IReturn<List<ExternalIdInfo>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class GetCriticReviews
|
||||
/// </summary>
|
||||
|
@ -242,18 +256,29 @@ namespace MediaBrowser.Api.Library
|
|||
private readonly IUserDataManager _userDataManager;
|
||||
|
||||
private readonly IDtoService _dtoService;
|
||||
private readonly IProviderManager _providerManager;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LibraryService" /> class.
|
||||
/// </summary>
|
||||
public LibraryService(IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager,
|
||||
IDtoService dtoService, IUserDataManager userDataManager)
|
||||
IDtoService dtoService, IUserDataManager userDataManager, IProviderManager providerManager)
|
||||
{
|
||||
_itemRepo = itemRepo;
|
||||
_libraryManager = libraryManager;
|
||||
_userManager = userManager;
|
||||
_dtoService = dtoService;
|
||||
_userDataManager = userDataManager;
|
||||
_providerManager = providerManager;
|
||||
}
|
||||
|
||||
public object Get(GetExternalIdInfos request)
|
||||
{
|
||||
var item = _dtoService.GetItemByDtoId(request.Id);
|
||||
|
||||
var infos = _providerManager.GetExternalIdInfos(item).ToList();
|
||||
|
||||
return ToOptimizedResult(infos);
|
||||
}
|
||||
|
||||
public object Get(GetMediaFolders request)
|
||||
|
|
|
@ -91,6 +91,13 @@ namespace MediaBrowser.Controller.Providers
|
|||
/// <returns>IEnumerable{ExternalUrl}.</returns>
|
||||
IEnumerable<ExternalUrl> GetExternalUrls(IHasProviderIds item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the external identifier infos.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{ExternalIdInfo}.</returns>
|
||||
IEnumerable<ExternalIdInfo> GetExternalIdInfos(IHasProviderIds item);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the metadata.
|
||||
/// </summary>
|
||||
|
|
|
@ -16,16 +16,10 @@ namespace MediaBrowser.Model.Providers
|
|||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the item.
|
||||
/// Gets or sets the URL format string.
|
||||
/// </summary>
|
||||
/// <value>The type of the item.</value>
|
||||
public string ItemType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the format string.
|
||||
/// </summary>
|
||||
/// <value>The format string.</value>
|
||||
public string FormatString { get; set; }
|
||||
/// <value>The URL format string.</value>
|
||||
public string UrlFormatString { get; set; }
|
||||
}
|
||||
|
||||
public class ExternalUrl
|
||||
|
|
|
@ -656,7 +656,7 @@ namespace MediaBrowser.Providers.Manager
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
var value = item.GetProviderId(i.Key);
|
||||
|
||||
if (string.IsNullOrEmpty(value))
|
||||
|
@ -672,5 +672,17 @@ namespace MediaBrowser.Providers.Manager
|
|||
|
||||
}).Where(i => i != null);
|
||||
}
|
||||
|
||||
public IEnumerable<ExternalIdInfo> GetExternalIdInfos(IHasProviderIds item)
|
||||
{
|
||||
return GetExternalIds(item)
|
||||
.Select(i => new ExternalIdInfo
|
||||
{
|
||||
Name = i.Name,
|
||||
Key = i.Key,
|
||||
UrlFormatString = i.UrlFormatString
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -52,6 +52,52 @@ namespace MediaBrowser.Providers.Movies
|
|||
}
|
||||
}
|
||||
|
||||
public class RottenTomatoesExternalId : IExternalId
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return "Rotten Tomatoes"; }
|
||||
}
|
||||
|
||||
public string Key
|
||||
{
|
||||
get { return MetadataProviders.RottenTomatoes.ToString(); }
|
||||
}
|
||||
|
||||
public string UrlFormatString
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Movie || item is Trailer || item is MusicVideo;
|
||||
}
|
||||
}
|
||||
|
||||
public class MovieDbMovieCollectionExternalId : IExternalId
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return "TheMovieDb Collection"; }
|
||||
}
|
||||
|
||||
public string Key
|
||||
{
|
||||
get { return MetadataProviders.TmdbCollection.ToString(); }
|
||||
}
|
||||
|
||||
public string UrlFormatString
|
||||
{
|
||||
get { return "http://www.themoviedb.org/collection/{0}"; }
|
||||
}
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Movie || item is Trailer || item is MusicVideo;
|
||||
}
|
||||
}
|
||||
|
||||
public class MovieDbPersonExternalId : IExternalId
|
||||
{
|
||||
public string Name
|
||||
|
|
|
@ -51,6 +51,29 @@ namespace MediaBrowser.Providers.TV
|
|||
}
|
||||
}
|
||||
|
||||
public class TvdbEpisodeExternalId : IExternalId
|
||||
{
|
||||
public string Name
|
||||
{
|
||||
get { return "TheTVDB"; }
|
||||
}
|
||||
|
||||
public string Key
|
||||
{
|
||||
get { return MetadataProviders.Tvdb.ToString(); }
|
||||
}
|
||||
|
||||
public string UrlFormatString
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
public bool Supports(IHasProviderIds item)
|
||||
{
|
||||
return item is Episode;
|
||||
}
|
||||
}
|
||||
|
||||
public class TvComSeriesExternalId : IExternalId
|
||||
{
|
||||
public string Name
|
||||
|
|
|
@ -465,6 +465,8 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
"extensions.js",
|
||||
"site.js",
|
||||
"librarybrowser.js",
|
||||
"editorsidebar.js",
|
||||
|
||||
"librarymenu.js",
|
||||
"ratingdialog.js",
|
||||
"aboutpage.js",
|
||||
|
|
|
@ -475,6 +475,9 @@
|
|||
<Content Include="dashboard-ui\scripts\livetvtimers.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\editorsidebar.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\scripts\musicalbumartists.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
Loading…
Reference in New Issue
Block a user