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.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Providers;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
using ServiceStack;
|
using ServiceStack;
|
||||||
using System;
|
using System;
|
||||||
|
@ -48,6 +50,18 @@ namespace MediaBrowser.Api.Library
|
||||||
public int Index { get; set; }
|
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>
|
/// <summary>
|
||||||
/// Class GetCriticReviews
|
/// Class GetCriticReviews
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -242,18 +256,29 @@ namespace MediaBrowser.Api.Library
|
||||||
private readonly IUserDataManager _userDataManager;
|
private readonly IUserDataManager _userDataManager;
|
||||||
|
|
||||||
private readonly IDtoService _dtoService;
|
private readonly IDtoService _dtoService;
|
||||||
|
private readonly IProviderManager _providerManager;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="LibraryService" /> class.
|
/// Initializes a new instance of the <see cref="LibraryService" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LibraryService(IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager,
|
public LibraryService(IItemRepository itemRepo, ILibraryManager libraryManager, IUserManager userManager,
|
||||||
IDtoService dtoService, IUserDataManager userDataManager)
|
IDtoService dtoService, IUserDataManager userDataManager, IProviderManager providerManager)
|
||||||
{
|
{
|
||||||
_itemRepo = itemRepo;
|
_itemRepo = itemRepo;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_dtoService = dtoService;
|
_dtoService = dtoService;
|
||||||
_userDataManager = userDataManager;
|
_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)
|
public object Get(GetMediaFolders request)
|
||||||
|
|
|
@ -91,6 +91,13 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <returns>IEnumerable{ExternalUrl}.</returns>
|
/// <returns>IEnumerable{ExternalUrl}.</returns>
|
||||||
IEnumerable<ExternalUrl> GetExternalUrls(IHasProviderIds item);
|
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>
|
/// <summary>
|
||||||
/// Saves the metadata.
|
/// Saves the metadata.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -16,16 +16,10 @@ namespace MediaBrowser.Model.Providers
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the type of the item.
|
/// Gets or sets the URL format string.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type of the item.</value>
|
/// <value>The URL format string.</value>
|
||||||
public string ItemType { get; set; }
|
public string UrlFormatString { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the format string.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The format string.</value>
|
|
||||||
public string FormatString { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExternalUrl
|
public class ExternalUrl
|
||||||
|
|
|
@ -656,7 +656,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var value = item.GetProviderId(i.Key);
|
var value = item.GetProviderId(i.Key);
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(value))
|
if (string.IsNullOrEmpty(value))
|
||||||
|
@ -672,5 +672,17 @@ namespace MediaBrowser.Providers.Manager
|
||||||
|
|
||||||
}).Where(i => i != null);
|
}).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 class MovieDbPersonExternalId : IExternalId
|
||||||
{
|
{
|
||||||
public string Name
|
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 class TvComSeriesExternalId : IExternalId
|
||||||
{
|
{
|
||||||
public string Name
|
public string Name
|
||||||
|
|
|
@ -465,6 +465,8 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
"extensions.js",
|
"extensions.js",
|
||||||
"site.js",
|
"site.js",
|
||||||
"librarybrowser.js",
|
"librarybrowser.js",
|
||||||
|
"editorsidebar.js",
|
||||||
|
|
||||||
"librarymenu.js",
|
"librarymenu.js",
|
||||||
"ratingdialog.js",
|
"ratingdialog.js",
|
||||||
"aboutpage.js",
|
"aboutpage.js",
|
||||||
|
|
|
@ -475,6 +475,9 @@
|
||||||
<Content Include="dashboard-ui\scripts\livetvtimers.js">
|
<Content Include="dashboard-ui\scripts\livetvtimers.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\scripts\editorsidebar.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\musicalbumartists.js">
|
<Content Include="dashboard-ui\scripts\musicalbumartists.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user