mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-25 06:58:40 +02:00
Merge branch 'dev' of https://github.com/MediaBrowser/MediaBrowser into dev
This commit is contained in:
commit
27d6135493
|
@ -69,7 +69,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="ImageMagick\fonts\MontserratLight.otf" />
|
<EmbeddedResource Include="ImageMagick\fonts\MontserratLight.otf" />
|
||||||
<EmbeddedResource Include="ImageMagick\fonts\robotoregular.ttf" />
|
<EmbeddedResource Include="ImageMagick\fonts\robotoregular.ttf" />
|
||||||
<EmbeddedResource Include="ImageMagick\fonts\webdings.ttf" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
using System.Linq;
|
using System.Threading.Tasks;
|
||||||
using ImageMagickSharp;
|
using ImageMagickSharp;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Emby.Drawing.ImageMagick
|
namespace Emby.Drawing.ImageMagick
|
||||||
{
|
{
|
||||||
|
@ -13,11 +15,13 @@ namespace Emby.Drawing.ImageMagick
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
|
private readonly IHttpClient _httpClient;
|
||||||
|
|
||||||
public ImageMagickEncoder(ILogger logger, IApplicationPaths appPaths)
|
public ImageMagickEncoder(ILogger logger, IApplicationPaths appPaths, IHttpClient httpClient)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
|
_httpClient = httpClient;
|
||||||
|
|
||||||
LogImageMagickVersion();
|
LogImageMagickVersion();
|
||||||
}
|
}
|
||||||
|
@ -177,7 +181,8 @@ namespace Emby.Drawing.ImageMagick
|
||||||
{
|
{
|
||||||
var currentImageSize = new ImageSize(imageWidth, imageHeight);
|
var currentImageSize = new ImageSize(imageWidth, imageHeight);
|
||||||
|
|
||||||
new PlayedIndicatorDrawer(_appPaths).DrawPlayedIndicator(wand, currentImageSize);
|
var task = new PlayedIndicatorDrawer(_appPaths, _httpClient).DrawPlayedIndicator(wand, currentImageSize);
|
||||||
|
Task.WaitAll(task);
|
||||||
}
|
}
|
||||||
else if (options.UnplayedCount.HasValue)
|
else if (options.UnplayedCount.HasValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
using ImageMagickSharp;
|
using ImageMagickSharp;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Emby.Drawing.ImageMagick
|
namespace Emby.Drawing.ImageMagick
|
||||||
{
|
{
|
||||||
|
@ -12,13 +14,15 @@ namespace Emby.Drawing.ImageMagick
|
||||||
private const int OffsetFromTopRightCorner = 38;
|
private const int OffsetFromTopRightCorner = 38;
|
||||||
|
|
||||||
private readonly IApplicationPaths _appPaths;
|
private readonly IApplicationPaths _appPaths;
|
||||||
|
private readonly IHttpClient _iHttpClient;
|
||||||
|
|
||||||
public PlayedIndicatorDrawer(IApplicationPaths appPaths)
|
public PlayedIndicatorDrawer(IApplicationPaths appPaths, IHttpClient iHttpClient)
|
||||||
{
|
{
|
||||||
_appPaths = appPaths;
|
_appPaths = appPaths;
|
||||||
|
_iHttpClient = iHttpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawPlayedIndicator(MagickWand wand, ImageSize imageSize)
|
public async Task DrawPlayedIndicator(MagickWand wand, ImageSize imageSize)
|
||||||
{
|
{
|
||||||
var x = imageSize.Width - OffsetFromTopRightCorner;
|
var x = imageSize.Width - OffsetFromTopRightCorner;
|
||||||
|
|
||||||
|
@ -34,7 +38,7 @@ namespace Emby.Drawing.ImageMagick
|
||||||
pixel.Opacity = 0;
|
pixel.Opacity = 0;
|
||||||
pixel.Color = "white";
|
pixel.Color = "white";
|
||||||
draw.FillColor = pixel;
|
draw.FillColor = pixel;
|
||||||
draw.Font = ExtractFont("webdings.ttf", _appPaths);
|
draw.Font = await DownloadFont("webdings.ttf", "https://github.com/MediaBrowser/Emby.Resources/raw/master/fonts/webdings.ttf", _appPaths, _iHttpClient).ConfigureAwait(false);
|
||||||
draw.FontSize = FontSize;
|
draw.FontSize = FontSize;
|
||||||
draw.FontStyle = FontStyleType.NormalStyle;
|
draw.FontStyle = FontStyleType.NormalStyle;
|
||||||
draw.TextAlignment = TextAlignType.CenterAlign;
|
draw.TextAlignment = TextAlignType.CenterAlign;
|
||||||
|
@ -77,7 +81,37 @@ namespace Emby.Drawing.ImageMagick
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static async Task<string> DownloadFont(string name, string url, IApplicationPaths paths, IHttpClient httpClient)
|
||||||
|
{
|
||||||
|
var filePath = Path.Combine(paths.ProgramDataPath, "fonts", name);
|
||||||
|
|
||||||
|
if (File.Exists(filePath))
|
||||||
|
{
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tempPath = await httpClient.GetTempFile(new HttpRequestOptions
|
||||||
|
{
|
||||||
|
Url = url,
|
||||||
|
Progress = new Progress<double>()
|
||||||
|
|
||||||
|
}).ConfigureAwait(false);
|
||||||
|
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Copy(tempPath, filePath, false);
|
||||||
|
}
|
||||||
|
catch (IOException)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempPath;
|
return tempPath;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Threading.Tasks;
|
using MediaBrowser.Controller.Dto;
|
||||||
using MediaBrowser.Controller.Dto;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
@ -12,6 +11,7 @@ using ServiceStack.Web;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Api
|
namespace MediaBrowser.Api
|
||||||
{
|
{
|
||||||
|
@ -344,9 +344,7 @@ namespace MediaBrowser.Api
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return libraryManager.RootFolder
|
return libraryManager.GetAllPeople()
|
||||||
.GetRecursiveChildren()
|
|
||||||
.SelectMany(i => i.People)
|
|
||||||
.Select(i => i.Name)
|
.Select(i => i.Name)
|
||||||
.DistinctNames()
|
.DistinctNames()
|
||||||
.FirstOrDefault(i =>
|
.FirstOrDefault(i =>
|
||||||
|
@ -364,7 +362,8 @@ namespace MediaBrowser.Api
|
||||||
var first = pathInfo.GetArgumentValue<string>(0);
|
var first = pathInfo.GetArgumentValue<string>(0);
|
||||||
|
|
||||||
// backwards compatibility
|
// backwards compatibility
|
||||||
if (string.Equals(first, "mediabrowser", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(first, "mediabrowser", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
string.Equals(first, "emby", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,6 +218,11 @@ namespace MediaBrowser.Api
|
||||||
|
|
||||||
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (request.People != null)
|
||||||
|
{
|
||||||
|
await _libraryManager.UpdatePeople(item, request.People.Select(x => new PersonInfo { Name = x.Name, Role = x.Role, Type = x.Type }).ToList());
|
||||||
|
}
|
||||||
|
|
||||||
if (isLockedChanged && item.IsFolder)
|
if (isLockedChanged && item.IsFolder)
|
||||||
{
|
{
|
||||||
var folder = (Folder)item;
|
var folder = (Folder)item;
|
||||||
|
@ -303,11 +308,6 @@ namespace MediaBrowser.Api
|
||||||
item.Studios = request.Studios.Select(x => x.Name).ToList();
|
item.Studios = request.Studios.Select(x => x.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.People != null)
|
|
||||||
{
|
|
||||||
item.People = request.People.Select(x => new PersonInfo { Name = x.Name, Role = x.Role, Type = x.Type }).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.DateCreated.HasValue)
|
if (request.DateCreated.HasValue)
|
||||||
{
|
{
|
||||||
item.DateCreated = NormalizeDateTime(request.DateCreated.Value);
|
item.DateCreated = NormalizeDateTime(request.DateCreated.Value);
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
return ToOptimizedResult(result);
|
return ToOptimizedResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<ItemsResult> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
private async Task<ItemsResult> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, ILibraryManager, int> getSimilarityScore)
|
||||||
{
|
{
|
||||||
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var items = SimilarItemsHelper.GetSimilaritems(item, list, getSimilarityScore).ToList();
|
var items = SimilarItemsHelper.GetSimilaritems(item, _libraryManager, list, getSimilarityScore).ToList();
|
||||||
|
|
||||||
IEnumerable<BaseItem> returnItems = items;
|
IEnumerable<BaseItem> returnItems = items;
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
foreach (var director in directors)
|
foreach (var director in directors)
|
||||||
{
|
{
|
||||||
var items = allMovies
|
var items = allMovies
|
||||||
.Where(i => i.People.Any(p => string.Equals(p.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) && string.Equals(p.Name, director, StringComparison.OrdinalIgnoreCase)))
|
.Where(i => _libraryManager.GetPeople(i).Any(p => string.Equals(p.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) && string.Equals(p.Name, director, StringComparison.OrdinalIgnoreCase)))
|
||||||
.Take(itemLimit)
|
.Take(itemLimit)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
foreach (var name in names)
|
foreach (var name in names)
|
||||||
{
|
{
|
||||||
var items = allMovies
|
var items = allMovies
|
||||||
.Where(i => i.People.Any(p => string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase)))
|
.Where(i => _libraryManager.GetPeople(i).Any(p => string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase)))
|
||||||
.Take(itemLimit)
|
.Take(itemLimit)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
foreach (var item in baselineItems)
|
foreach (var item in baselineItems)
|
||||||
{
|
{
|
||||||
var similar = SimilarItemsHelper
|
var similar = SimilarItemsHelper
|
||||||
.GetSimilaritems(item, allMovies, SimilarItemsHelper.GetSimiliarityScore)
|
.GetSimilaritems(item, _libraryManager, allMovies, SimilarItemsHelper.GetSimiliarityScore)
|
||||||
.Take(itemLimit)
|
.Take(itemLimit)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
{
|
{
|
||||||
// Get the two leading actors for all movies
|
// Get the two leading actors for all movies
|
||||||
return items
|
return items
|
||||||
.SelectMany(i => i.People.Where(p => !string.Equals(PersonType.Director, p.Type, StringComparison.OrdinalIgnoreCase)).Take(2))
|
.SelectMany(i => _libraryManager.GetPeople(i).Where(p => !string.Equals(PersonType.Director, p.Type, StringComparison.OrdinalIgnoreCase)).Take(2))
|
||||||
.Select(i => i.Name)
|
.Select(i => i.Name)
|
||||||
.DistinctNames();
|
.DistinctNames();
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ namespace MediaBrowser.Api.Movies
|
||||||
private IEnumerable<string> GetDirectors(IEnumerable<BaseItem> items)
|
private IEnumerable<string> GetDirectors(IEnumerable<BaseItem> items)
|
||||||
{
|
{
|
||||||
return items
|
return items
|
||||||
.Select(i => i.People.FirstOrDefault(p => string.Equals(PersonType.Director, p.Type, StringComparison.OrdinalIgnoreCase)))
|
.Select(i => _libraryManager.GetPeople(i).FirstOrDefault(p => string.Equals(PersonType.Director, p.Type, StringComparison.OrdinalIgnoreCase)))
|
||||||
.Where(i => i != null)
|
.Where(i => i != null)
|
||||||
.Select(i => i.Name)
|
.Select(i => i.Name)
|
||||||
.DistinctNames();
|
.DistinctNames();
|
||||||
|
|
|
@ -69,10 +69,11 @@ namespace MediaBrowser.Api.Music
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item1">The item1.</param>
|
/// <param name="item1">The item1.</param>
|
||||||
/// <param name="item2">The item2.</param>
|
/// <param name="item2">The item2.</param>
|
||||||
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
/// <returns>System.Int32.</returns>
|
/// <returns>System.Int32.</returns>
|
||||||
private int GetAlbumSimilarityScore(BaseItem item1, BaseItem item2)
|
private int GetAlbumSimilarityScore(BaseItem item1, BaseItem item2, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
var points = SimilarItemsHelper.GetSimiliarityScore(item1, item2);
|
var points = SimilarItemsHelper.GetSimiliarityScore(item1, item2, libraryManager);
|
||||||
|
|
||||||
var album1 = (MusicAlbum)item1;
|
var album1 = (MusicAlbum)item1;
|
||||||
var album2 = (MusicAlbum)item2;
|
var album2 = (MusicAlbum)item2;
|
||||||
|
|
|
@ -772,6 +772,11 @@ namespace MediaBrowser.Api.Playback
|
||||||
? null
|
? null
|
||||||
: audioStream.Channels;
|
: audioStream.Channels;
|
||||||
|
|
||||||
|
if (inputChannels <= 0)
|
||||||
|
{
|
||||||
|
inputChannels = null;
|
||||||
|
}
|
||||||
|
|
||||||
var codec = outputAudioCodec ?? string.Empty;
|
var codec = outputAudioCodec ?? string.Empty;
|
||||||
|
|
||||||
if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
|
if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
|
|
|
@ -294,6 +294,10 @@ namespace MediaBrowser.Api.Playback.Hls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (DirectoryNotFoundException)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -9,265 +9,206 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Api.Reports
|
namespace MediaBrowser.Api.Reports
|
||||||
{
|
{
|
||||||
/// <summary> A report stat builder. </summary>
|
/// <summary> A report stat builder. </summary>
|
||||||
/// <seealso cref="T:MediaBrowser.Api.Reports.ReportBuilderBase"/>
|
/// <seealso cref="T:MediaBrowser.Api.Reports.ReportBuilderBase"/>
|
||||||
public class ReportStatBuilder : ReportBuilderBase
|
public class ReportStatBuilder : ReportBuilderBase
|
||||||
{
|
{
|
||||||
#region [Constructors]
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the MediaBrowser.Api.Reports.ReportStatBuilder class. </summary>
|
||||||
|
/// <param name="libraryManager"> Manager for library. </param>
|
||||||
|
public ReportStatBuilder(ILibraryManager libraryManager)
|
||||||
|
: base(libraryManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary> Gets report stat result. </summary>
|
||||||
/// Initializes a new instance of the MediaBrowser.Api.Reports.ReportStatBuilder class. </summary>
|
/// <param name="items"> The items. </param>
|
||||||
/// <param name="libraryManager"> Manager for library. </param>
|
/// <param name="reportRowType"> Type of the report row. </param>
|
||||||
public ReportStatBuilder(ILibraryManager libraryManager)
|
/// <param name="topItem"> The top item. </param>
|
||||||
: base(libraryManager)
|
/// <returns> The report stat result. </returns>
|
||||||
{
|
public ReportStatResult GetReportStatResult(BaseItem[] items, ReportViewType reportRowType, int topItem = 5)
|
||||||
}
|
{
|
||||||
|
ReportStatResult result = new ReportStatResult();
|
||||||
|
result = this.GetResultGenres(result, items, topItem);
|
||||||
|
result = this.GetResultStudios(result, items, topItem);
|
||||||
|
result = this.GetResultPersons(result, items, topItem);
|
||||||
|
result = this.GetResultProductionYears(result, items, topItem);
|
||||||
|
result = this.GetResulProductionLocations(result, items, topItem);
|
||||||
|
result = this.GetResultCommunityRatings(result, items, topItem);
|
||||||
|
result = this.GetResultParentalRatings(result, items, topItem);
|
||||||
|
|
||||||
#endregion
|
switch (reportRowType)
|
||||||
|
{
|
||||||
|
case ReportViewType.Season:
|
||||||
|
case ReportViewType.Series:
|
||||||
|
case ReportViewType.MusicAlbum:
|
||||||
|
case ReportViewType.MusicArtist:
|
||||||
|
case ReportViewType.Game:
|
||||||
|
break;
|
||||||
|
case ReportViewType.Movie:
|
||||||
|
case ReportViewType.BoxSet:
|
||||||
|
|
||||||
#region [Public Methods]
|
break;
|
||||||
|
case ReportViewType.Book:
|
||||||
/// <summary> Gets report stat result. </summary>
|
case ReportViewType.Episode:
|
||||||
/// <param name="items"> The items. </param>
|
case ReportViewType.Video:
|
||||||
/// <param name="reportIncludeItemTypes"> List of types of the report include items. </param>
|
case ReportViewType.MusicVideo:
|
||||||
/// <param name="topItem"> The top item. </param>
|
case ReportViewType.Trailer:
|
||||||
/// <returns> The report stat result. </returns>
|
case ReportViewType.Audio:
|
||||||
public ReportStatResult GetResult(BaseItem[] items, ReportIncludeItemTypes reportIncludeItemTypes, int topItem = 5)
|
case ReportViewType.BaseItem:
|
||||||
{
|
default:
|
||||||
ReportStatResult result = new ReportStatResult();
|
break;
|
||||||
result = this.GetResultGenres(result, items, topItem);
|
}
|
||||||
result = this.GetResultStudios(result, items, topItem);
|
|
||||||
result = this.GetResultPersons(result, items, topItem);
|
|
||||||
result = this.GetResultProductionYears(result, items, topItem);
|
|
||||||
result = this.GetResulProductionLocations(result, items, topItem);
|
|
||||||
result = this.GetResultCommunityRatings(result, items, topItem);
|
|
||||||
result = this.GetResultParentalRatings(result, items, topItem);
|
|
||||||
|
|
||||||
switch (reportIncludeItemTypes)
|
result.Groups = result.Groups.OrderByDescending(n => n.Items.Count()).ToList();
|
||||||
{
|
|
||||||
case ReportIncludeItemTypes.Season:
|
|
||||||
case ReportIncludeItemTypes.Series:
|
|
||||||
case ReportIncludeItemTypes.MusicAlbum:
|
|
||||||
case ReportIncludeItemTypes.MusicArtist:
|
|
||||||
case ReportIncludeItemTypes.Game:
|
|
||||||
break;
|
|
||||||
case ReportIncludeItemTypes.Movie:
|
|
||||||
case ReportIncludeItemTypes.BoxSet:
|
|
||||||
|
|
||||||
break;
|
return result;
|
||||||
case ReportIncludeItemTypes.Book:
|
}
|
||||||
case ReportIncludeItemTypes.Episode:
|
|
||||||
case ReportIncludeItemTypes.Video:
|
|
||||||
case ReportIncludeItemTypes.MusicVideo:
|
|
||||||
case ReportIncludeItemTypes.Trailer:
|
|
||||||
case ReportIncludeItemTypes.Audio:
|
|
||||||
case ReportIncludeItemTypes.BaseItem:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Groups = result.Groups.OrderByDescending(n => n.Items.Count()).ToList();
|
private ReportStatResult GetResultGenres(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
||||||
|
{
|
||||||
|
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderGenres"), topItem,
|
||||||
|
items.SelectMany(x => x.Genres)
|
||||||
|
.GroupBy(x => x)
|
||||||
|
.OrderByDescending(x => x.Count())
|
||||||
|
.Take(topItem)
|
||||||
|
.Select(x => new ReportStatItem
|
||||||
|
{
|
||||||
|
Name = x.Key,
|
||||||
|
Value = x.Count().ToString(),
|
||||||
|
Id = GetGenreID(x.Key)
|
||||||
|
}));
|
||||||
|
return result;
|
||||||
|
|
||||||
return result;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
private ReportStatResult GetResultStudios(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
||||||
|
{
|
||||||
|
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderStudios"), topItem,
|
||||||
|
items.SelectMany(x => x.Studios)
|
||||||
|
.GroupBy(x => x)
|
||||||
|
.OrderByDescending(x => x.Count())
|
||||||
|
.Take(topItem)
|
||||||
|
.Select(x => new ReportStatItem
|
||||||
|
{
|
||||||
|
Name = x.Key,
|
||||||
|
Value = x.Count().ToString(),
|
||||||
|
Id = GetStudioID(x.Key)
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
#region [Protected Internal Methods]
|
return result;
|
||||||
/// <summary> Gets the headers. </summary>
|
|
||||||
/// <typeparam name="H"> Type of the header. </typeparam>
|
|
||||||
/// <param name="request"> The request. </param>
|
|
||||||
/// <returns> The headers. </returns>
|
|
||||||
/// <seealso cref="M:MediaBrowser.Api.Reports.ReportBuilderBase.GetHeaders{H}(H)"/>
|
|
||||||
protected internal override List<ReportHeader> GetHeaders<H>(H request)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
}
|
||||||
|
|
||||||
#region [Private Methods]
|
private ReportStatResult GetResultPersons(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
||||||
|
{
|
||||||
|
List<string> t = new List<string> { PersonType.Actor, PersonType.Composer, PersonType.Director, PersonType.GuestStar, PersonType.Producer, PersonType.Writer, "Artist", "AlbumArtist" };
|
||||||
|
foreach (var item in t)
|
||||||
|
{
|
||||||
|
this.GetGroups(result, ReportHelper.GetServerLocalizedString("Option" + item), topItem,
|
||||||
|
items.SelectMany(x => _libraryManager.GetPeople(x))
|
||||||
|
.Where(n => n.Type == item)
|
||||||
|
.GroupBy(x => x.Name)
|
||||||
|
.OrderByDescending(x => x.Count())
|
||||||
|
.Take(topItem)
|
||||||
|
.Select(x => new ReportStatItem
|
||||||
|
{
|
||||||
|
Name = x.Key,
|
||||||
|
Value = x.Count().ToString(),
|
||||||
|
Id = GetPersonID(x.Key)
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Gets the groups. </summary>
|
return result;
|
||||||
/// <param name="result"> The result. </param>
|
}
|
||||||
/// <param name="header"> The header. </param>
|
|
||||||
/// <param name="topItem"> The top item. </param>
|
|
||||||
/// <param name="top"> The top. </param>
|
|
||||||
private void GetGroups(ReportStatResult result, string header, int topItem, IEnumerable<ReportStatItem> top)
|
|
||||||
{
|
|
||||||
if (top.Count() > 0)
|
|
||||||
{
|
|
||||||
var group = new ReportStatGroup { Header = ReportStatGroup.FormatedHeader(header, topItem) };
|
|
||||||
group.Items.AddRange(top);
|
|
||||||
result.Groups.Add(group);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Gets resul production locations. </summary>
|
private ReportStatResult GetResultCommunityRatings(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
||||||
/// <param name="result"> The result. </param>
|
{
|
||||||
/// <param name="items"> The items. </param>
|
this.GetGroups(result, ReportHelper.GetServerLocalizedString("LabelCommunityRating"), topItem,
|
||||||
/// <param name="topItem"> The top item. </param>
|
items.Where(x => x.CommunityRating != null && x.CommunityRating > 0)
|
||||||
/// <returns> The resul production locations. </returns>
|
.GroupBy(x => x.CommunityRating)
|
||||||
private ReportStatResult GetResulProductionLocations(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
.OrderByDescending(x => x.Count())
|
||||||
{
|
.Take(topItem)
|
||||||
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderCountries"), topItem,
|
.Select(x => new ReportStatItem
|
||||||
items.OfType<IHasProductionLocations>()
|
{
|
||||||
.Where(x => x.ProductionLocations != null)
|
Name = x.Key.ToString(),
|
||||||
.SelectMany(x => x.ProductionLocations)
|
Value = x.Count().ToString()
|
||||||
.GroupBy(x => x)
|
})
|
||||||
.OrderByDescending(x => x.Count())
|
);
|
||||||
.Take(topItem)
|
|
||||||
.Select(x => new ReportStatItem
|
|
||||||
{
|
|
||||||
Name = x.Key.ToString(),
|
|
||||||
Value = x.Count().ToString()
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Gets result community ratings. </summary>
|
private ReportStatResult GetResultParentalRatings(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
||||||
/// <param name="result"> The result. </param>
|
{
|
||||||
/// <param name="items"> The items. </param>
|
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderParentalRatings"), topItem,
|
||||||
/// <param name="topItem"> The top item. </param>
|
items.Where(x => x.OfficialRating != null)
|
||||||
/// <returns> The result community ratings. </returns>
|
.GroupBy(x => x.OfficialRating)
|
||||||
private ReportStatResult GetResultCommunityRatings(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
.OrderByDescending(x => x.Count())
|
||||||
{
|
.Take(topItem)
|
||||||
this.GetGroups(result, ReportHelper.GetServerLocalizedString("LabelCommunityRating"), topItem,
|
.Select(x => new ReportStatItem
|
||||||
items.Where(x => x.CommunityRating != null && x.CommunityRating > 0)
|
{
|
||||||
.GroupBy(x => x.CommunityRating)
|
Name = x.Key.ToString(),
|
||||||
.OrderByDescending(x => x.Count())
|
Value = x.Count().ToString()
|
||||||
.Take(topItem)
|
})
|
||||||
.Select(x => new ReportStatItem
|
);
|
||||||
{
|
|
||||||
Name = x.Key.ToString(),
|
|
||||||
Value = x.Count().ToString()
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Gets result genres. </summary>
|
|
||||||
/// <param name="result"> The result. </param>
|
|
||||||
/// <param name="items"> The items. </param>
|
|
||||||
/// <param name="topItem"> The top item. </param>
|
|
||||||
/// <returns> The result genres. </returns>
|
|
||||||
private ReportStatResult GetResultGenres(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
|
||||||
{
|
|
||||||
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderGenres"), topItem,
|
|
||||||
items.SelectMany(x => x.Genres)
|
|
||||||
.GroupBy(x => x)
|
|
||||||
.OrderByDescending(x => x.Count())
|
|
||||||
.Take(topItem)
|
|
||||||
.Select(x => new ReportStatItem
|
|
||||||
{
|
|
||||||
Name = x.Key,
|
|
||||||
Value = x.Count().ToString(),
|
|
||||||
Id = GetGenreID(x.Key)
|
|
||||||
}));
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
private ReportStatResult GetResultProductionYears(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
||||||
|
{
|
||||||
|
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderYears"), topItem,
|
||||||
|
items.Where(x => x.ProductionYear != null && x.ProductionYear > 0)
|
||||||
|
.GroupBy(x => x.ProductionYear)
|
||||||
|
.OrderByDescending(x => x.Count())
|
||||||
|
.Take(topItem)
|
||||||
|
.Select(x => new ReportStatItem
|
||||||
|
{
|
||||||
|
Name = x.Key.ToString(),
|
||||||
|
Value = x.Count().ToString()
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
/// <summary> Gets result parental ratings. </summary>
|
return result;
|
||||||
/// <param name="result"> The result. </param>
|
}
|
||||||
/// <param name="items"> The items. </param>
|
|
||||||
/// <param name="topItem"> The top item. </param>
|
|
||||||
/// <returns> The result parental ratings. </returns>
|
|
||||||
private ReportStatResult GetResultParentalRatings(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
|
||||||
{
|
|
||||||
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderParentalRatings"), topItem,
|
|
||||||
items.Where(x => x.OfficialRating != null)
|
|
||||||
.GroupBy(x => x.OfficialRating)
|
|
||||||
.OrderByDescending(x => x.Count())
|
|
||||||
.Take(topItem)
|
|
||||||
.Select(x => new ReportStatItem
|
|
||||||
{
|
|
||||||
Name = x.Key.ToString(),
|
|
||||||
Value = x.Count().ToString()
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
return result;
|
private ReportStatResult GetResulProductionLocations(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
||||||
}
|
{
|
||||||
|
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderCountries"), topItem,
|
||||||
|
items.OfType<IHasProductionLocations>()
|
||||||
|
.Where(x => x.ProductionLocations != null)
|
||||||
|
.SelectMany(x => x.ProductionLocations)
|
||||||
|
.GroupBy(x => x)
|
||||||
|
.OrderByDescending(x => x.Count())
|
||||||
|
.Take(topItem)
|
||||||
|
.Select(x => new ReportStatItem
|
||||||
|
{
|
||||||
|
Name = x.Key.ToString(),
|
||||||
|
Value = x.Count().ToString()
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
/// <summary> Gets result persons. </summary>
|
return result;
|
||||||
/// <param name="result"> The result. </param>
|
}
|
||||||
/// <param name="items"> The items. </param>
|
|
||||||
/// <param name="topItem"> The top item. </param>
|
|
||||||
/// <returns> The result persons. </returns>
|
|
||||||
private ReportStatResult GetResultPersons(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
|
||||||
{
|
|
||||||
List<string> t = new List<string> { PersonType.Actor, PersonType.Composer, PersonType.Director, PersonType.GuestStar, PersonType.Producer, PersonType.Writer, "Artist", "AlbumArtist" };
|
|
||||||
foreach (var item in t)
|
|
||||||
{
|
|
||||||
this.GetGroups(result, ReportHelper.GetServerLocalizedString("Option" + item), topItem,
|
|
||||||
items.SelectMany(x => x.People)
|
|
||||||
.Where(n => n.Type == item)
|
|
||||||
.GroupBy(x => x.Name)
|
|
||||||
.OrderByDescending(x => x.Count())
|
|
||||||
.Take(topItem)
|
|
||||||
.Select(x => new ReportStatItem
|
|
||||||
{
|
|
||||||
Name = x.Key,
|
|
||||||
Value = x.Count().ToString(),
|
|
||||||
Id = GetPersonID(x.Key)
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Gets result production years. </summary>
|
/// <summary> Gets the groups. </summary>
|
||||||
/// <param name="result"> The result. </param>
|
/// <param name="result"> The result. </param>
|
||||||
/// <param name="items"> The items. </param>
|
/// <param name="header"> The header. </param>
|
||||||
/// <param name="topItem"> The top item. </param>
|
/// <param name="topItem"> The top item. </param>
|
||||||
/// <returns> The result production years. </returns>
|
/// <param name="top"> The top. </param>
|
||||||
private ReportStatResult GetResultProductionYears(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
private void GetGroups(ReportStatResult result, string header, int topItem, IEnumerable<ReportStatItem> top)
|
||||||
{
|
{
|
||||||
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderYears"), topItem,
|
if (top.Count() > 0)
|
||||||
items.Where(x => x.ProductionYear != null && x.ProductionYear > 0)
|
{
|
||||||
.GroupBy(x => x.ProductionYear)
|
var group = new ReportStatGroup { Header = ReportStatGroup.FormatedHeader(header, topItem) };
|
||||||
.OrderByDescending(x => x.Count())
|
group.Items.AddRange(top);
|
||||||
.Take(topItem)
|
result.Groups.Add(group);
|
||||||
.Select(x => new ReportStatItem
|
}
|
||||||
{
|
}
|
||||||
Name = x.Key.ToString(),
|
}
|
||||||
Value = x.Count().ToString()
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Gets result studios. </summary>
|
|
||||||
/// <param name="result"> The result. </param>
|
|
||||||
/// <param name="items"> The items. </param>
|
|
||||||
/// <param name="topItem"> The top item. </param>
|
|
||||||
/// <returns> The result studios. </returns>
|
|
||||||
private ReportStatResult GetResultStudios(ReportStatResult result, BaseItem[] items, int topItem = 5)
|
|
||||||
{
|
|
||||||
this.GetGroups(result, ReportHelper.GetServerLocalizedString("HeaderStudios"), topItem,
|
|
||||||
items.SelectMany(x => x.Studios)
|
|
||||||
.GroupBy(x => x)
|
|
||||||
.OrderByDescending(x => x.Count())
|
|
||||||
.Take(topItem)
|
|
||||||
.Select(x => new ReportStatItem
|
|
||||||
{
|
|
||||||
Name = x.Key,
|
|
||||||
Value = x.Count().ToString(),
|
|
||||||
Id = GetStudioID(x.Key)
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace MediaBrowser.Api
|
||||||
/// <param name="includeInSearch">The include in search.</param>
|
/// <param name="includeInSearch">The include in search.</param>
|
||||||
/// <param name="getSimilarityScore">The get similarity score.</param>
|
/// <param name="getSimilarityScore">The get similarity score.</param>
|
||||||
/// <returns>ItemsResult.</returns>
|
/// <returns>ItemsResult.</returns>
|
||||||
internal static ItemsResult GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
internal static ItemsResult GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, ILibraryManager, int> getSimilarityScore)
|
||||||
{
|
{
|
||||||
var user = !string.IsNullOrWhiteSpace(request.UserId) ? userManager.GetUserById(request.UserId) : null;
|
var user = !string.IsNullOrWhiteSpace(request.UserId) ? userManager.GetUserById(request.UserId) : null;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Api
|
||||||
? libraryManager.RootFolder.GetRecursiveChildren(filter)
|
? libraryManager.RootFolder.GetRecursiveChildren(filter)
|
||||||
: user.RootFolder.GetRecursiveChildren(user, filter);
|
: user.RootFolder.GetRecursiveChildren(user, filter);
|
||||||
|
|
||||||
var items = GetSimilaritems(item, inputItems, getSimilarityScore)
|
var items = GetSimilaritems(item, libraryManager, inputItems, getSimilarityScore)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
IEnumerable<BaseItem> returnItems = items;
|
IEnumerable<BaseItem> returnItems = items;
|
||||||
|
@ -106,15 +106,16 @@ namespace MediaBrowser.Api
|
||||||
/// Gets the similaritems.
|
/// Gets the similaritems.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="libraryManager">The library manager.</param>
|
||||||
/// <param name="inputItems">The input items.</param>
|
/// <param name="inputItems">The input items.</param>
|
||||||
/// <param name="getSimilarityScore">The get similarity score.</param>
|
/// <param name="getSimilarityScore">The get similarity score.</param>
|
||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
internal static IEnumerable<BaseItem> GetSimilaritems(BaseItem item, IEnumerable<BaseItem> inputItems, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
internal static IEnumerable<BaseItem> GetSimilaritems(BaseItem item, ILibraryManager libraryManager, IEnumerable<BaseItem> inputItems, Func<BaseItem, BaseItem, ILibraryManager, int> getSimilarityScore)
|
||||||
{
|
{
|
||||||
var itemId = item.Id;
|
var itemId = item.Id;
|
||||||
inputItems = inputItems.Where(i => i.Id != itemId);
|
inputItems = inputItems.Where(i => i.Id != itemId);
|
||||||
|
|
||||||
return inputItems.Select(i => new Tuple<BaseItem, int>(i, getSimilarityScore(item, i)))
|
return inputItems.Select(i => new Tuple<BaseItem, int>(i, getSimilarityScore(item, i, libraryManager)))
|
||||||
.Where(i => i.Item2 > 2)
|
.Where(i => i.Item2 > 2)
|
||||||
.OrderByDescending(i => i.Item2)
|
.OrderByDescending(i => i.Item2)
|
||||||
.Select(i => i.Item1);
|
.Select(i => i.Item1);
|
||||||
|
@ -148,7 +149,7 @@ namespace MediaBrowser.Api
|
||||||
/// <param name="item1">The item1.</param>
|
/// <param name="item1">The item1.</param>
|
||||||
/// <param name="item2">The item2.</param>
|
/// <param name="item2">The item2.</param>
|
||||||
/// <returns>System.Int32.</returns>
|
/// <returns>System.Int32.</returns>
|
||||||
internal static int GetSimiliarityScore(BaseItem item1, BaseItem item2)
|
internal static int GetSimiliarityScore(BaseItem item1, BaseItem item2, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
var points = 0;
|
var points = 0;
|
||||||
|
|
||||||
|
@ -169,11 +170,11 @@ namespace MediaBrowser.Api
|
||||||
// Find common studios
|
// Find common studios
|
||||||
points += item1.Studios.Where(i => item2.Studios.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 3);
|
points += item1.Studios.Where(i => item2.Studios.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 3);
|
||||||
|
|
||||||
var item2PeopleNames = item2.People.Select(i => i.Name)
|
var item2PeopleNames = libraryManager.GetPeople(item2).Select(i => i.Name)
|
||||||
.DistinctNames()
|
.DistinctNames()
|
||||||
.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
points += item1.People.Where(i => item2PeopleNames.ContainsKey(i.Name)).Sum(i =>
|
points += libraryManager.GetPeople(item1).Where(i => item2PeopleNames.ContainsKey(i.Name)).Sum(i =>
|
||||||
{
|
{
|
||||||
if (string.Equals(i.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.Director, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(i.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.Director, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
|
|
|
@ -990,7 +990,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
.Select(p => p == null ? "-1" : p.Name)
|
.Select(p => p == null ? "-1" : p.Name)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (!(names.Any(v => i.People.Select(p => p.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
if (!(names.Any(v => libraryManager.GetPeople(i).Select(p => p.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +1003,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
|
|
||||||
if (personTypes.Length == 0)
|
if (personTypes.Length == 0)
|
||||||
{
|
{
|
||||||
if (!(i.People.Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))))
|
if (!(libraryManager.GetPeople(i).Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1013,8 +1013,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
var types = personTypes;
|
var types = personTypes;
|
||||||
|
|
||||||
var ok = new[] { i }.Any(item =>
|
var ok = new[] { i }.Any(item =>
|
||||||
item.People != null &&
|
libraryManager.GetPeople(item).Any(p =>
|
||||||
item.People.Any(p =>
|
|
||||||
p.Name.Equals(request.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase))));
|
p.Name.Equals(request.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase))));
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace MediaBrowser.Api.UserLibrary
|
||||||
/// <returns>IEnumerable{PersonInfo}.</returns>
|
/// <returns>IEnumerable{PersonInfo}.</returns>
|
||||||
private IEnumerable<PersonInfo> GetAllPeople(IEnumerable<BaseItem> itemsList, string[] personTypes)
|
private IEnumerable<PersonInfo> GetAllPeople(IEnumerable<BaseItem> itemsList, string[] personTypes)
|
||||||
{
|
{
|
||||||
var people = itemsList.SelectMany(i => i.People.OrderBy(p => p.SortOrder ?? int.MaxValue).ThenBy(p => p.Type));
|
var people = itemsList.SelectMany(i => LibraryManager.GetPeople(i).OrderBy(p => p.SortOrder ?? int.MaxValue).ThenBy(p => p.Type));
|
||||||
|
|
||||||
if (personTypes.Length > 0)
|
if (personTypes.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -216,5 +216,14 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
return hasArtist != null && hasArtist.HasAnyArtist(Name);
|
return hasArtist != null && hasArtist.HasAnyArtist(Name);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,5 +71,14 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||||
{
|
{
|
||||||
return i => (i is IHasMusicGenres) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
return i => (i is IHasMusicGenres) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
Genres = new List<string>();
|
Genres = new List<string>();
|
||||||
Studios = new List<string>();
|
Studios = new List<string>();
|
||||||
People = new List<PersonInfo>();
|
|
||||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
LockedFields = new List<MetadataFields>();
|
LockedFields = new List<MetadataFields>();
|
||||||
ImageInfos = new List<ItemImageInfo>();
|
ImageInfos = new List<ItemImageInfo>();
|
||||||
|
@ -413,15 +412,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsPerson(string name)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(name))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("name");
|
|
||||||
}
|
|
||||||
return People.Any(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetInternalMetadataPath()
|
public string GetInternalMetadataPath()
|
||||||
{
|
{
|
||||||
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
|
var basePath = ConfigurationManager.ApplicationPaths.InternalMetadataPath;
|
||||||
|
@ -785,6 +775,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
get { return IsFolder || Parent != null; }
|
get { return IsFolder || Parent != null; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public virtual bool SupportsPeople
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Refreshes owned items such as trailers, theme videos, special features, etc.
|
/// Refreshes owned items such as trailers, theme videos, special features, etc.
|
||||||
/// Returns true or false indicating if changes were found.
|
/// Returns true or false indicating if changes were found.
|
||||||
|
@ -1248,83 +1244,6 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="System.ArgumentNullException"></exception>
|
||||||
public void AddPerson(PersonInfo person)
|
public void AddPerson(PersonInfo person)
|
||||||
{
|
{
|
||||||
if (person == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("person");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(person.Name))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalize
|
|
||||||
if (string.Equals(person.Role, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
person.Type = PersonType.GuestStar;
|
|
||||||
}
|
|
||||||
else if (string.Equals(person.Role, PersonType.Director, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
person.Type = PersonType.Director;
|
|
||||||
}
|
|
||||||
else if (string.Equals(person.Role, PersonType.Producer, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
person.Type = PersonType.Producer;
|
|
||||||
}
|
|
||||||
else if (string.Equals(person.Role, PersonType.Writer, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
person.Type = PersonType.Writer;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the type is GuestStar and there's already an Actor entry, then update it to avoid dupes
|
|
||||||
if (string.Equals(person.Type, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
var existing = People.FirstOrDefault(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(PersonType.Actor, StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
if (existing != null)
|
|
||||||
{
|
|
||||||
existing.Type = PersonType.GuestStar;
|
|
||||||
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.Equals(person.Type, PersonType.Actor, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
// If the actor already exists without a role and we have one, fill it in
|
|
||||||
var existing = People.FirstOrDefault(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && (p.Type.Equals(PersonType.Actor, StringComparison.OrdinalIgnoreCase) || p.Type.Equals(PersonType.GuestStar, StringComparison.OrdinalIgnoreCase)));
|
|
||||||
if (existing == null)
|
|
||||||
{
|
|
||||||
// Wasn't there - add it
|
|
||||||
People.Add(person);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Was there, if no role and we have one - fill it in
|
|
||||||
if (string.IsNullOrWhiteSpace(existing.Role) && !string.IsNullOrWhiteSpace(person.Role))
|
|
||||||
{
|
|
||||||
existing.Role = person.Role;
|
|
||||||
}
|
|
||||||
|
|
||||||
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var existing = People.FirstOrDefault(p =>
|
|
||||||
string.Equals(p.Name, person.Name, StringComparison.OrdinalIgnoreCase) &&
|
|
||||||
string.Equals(p.Type, person.Type, StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
// Check for dupes based on the combination of Name and Type
|
|
||||||
if (existing == null)
|
|
||||||
{
|
|
||||||
People.Add(person);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -21,5 +23,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,5 +194,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
.Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
|
.Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
|
||||||
.SelectMany(c => c.Children);
|
.SelectMany(c => c.Children);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,5 +62,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
return i => (i is Game) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
return i => (i is Game) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,5 +58,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,5 +66,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
return i => !(i is Game) && !(i is IHasMusicGenres) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
return i => !(i is Game) && !(i is IHasMusicGenres) && i.Genres.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,5 +59,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// Afters the metadata refresh.
|
/// Afters the metadata refresh.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void AfterMetadataRefresh();
|
void AfterMetadataRefresh();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether [supports people].
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if [supports people]; otherwise, <c>false</c>.</value>
|
||||||
|
bool SupportsPeople { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
100
MediaBrowser.Controller/Entities/PeopleHelper.cs
Normal file
100
MediaBrowser.Controller/Entities/PeopleHelper.cs
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Controller.Entities
|
||||||
|
{
|
||||||
|
public static class PeopleHelper
|
||||||
|
{
|
||||||
|
public static void AddPerson(List<PersonInfo> people, PersonInfo person)
|
||||||
|
{
|
||||||
|
if (person == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("person");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(person.Name))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize
|
||||||
|
if (string.Equals(person.Role, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
person.Type = PersonType.GuestStar;
|
||||||
|
}
|
||||||
|
else if (string.Equals(person.Role, PersonType.Director, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
person.Type = PersonType.Director;
|
||||||
|
}
|
||||||
|
else if (string.Equals(person.Role, PersonType.Producer, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
person.Type = PersonType.Producer;
|
||||||
|
}
|
||||||
|
else if (string.Equals(person.Role, PersonType.Writer, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
person.Type = PersonType.Writer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the type is GuestStar and there's already an Actor entry, then update it to avoid dupes
|
||||||
|
if (string.Equals(person.Type, PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var existing = people.FirstOrDefault(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(PersonType.Actor, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (existing != null)
|
||||||
|
{
|
||||||
|
existing.Type = PersonType.GuestStar;
|
||||||
|
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Equals(person.Type, PersonType.Actor, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// If the actor already exists without a role and we have one, fill it in
|
||||||
|
var existing = people.FirstOrDefault(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && (p.Type.Equals(PersonType.Actor, StringComparison.OrdinalIgnoreCase) || p.Type.Equals(PersonType.GuestStar, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
if (existing == null)
|
||||||
|
{
|
||||||
|
// Wasn't there - add it
|
||||||
|
people.Add(person);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Was there, if no role and we have one - fill it in
|
||||||
|
if (string.IsNullOrWhiteSpace(existing.Role) && !string.IsNullOrWhiteSpace(person.Role))
|
||||||
|
{
|
||||||
|
existing.Role = person.Role;
|
||||||
|
}
|
||||||
|
|
||||||
|
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var existing = people.FirstOrDefault(p =>
|
||||||
|
string.Equals(p.Name, person.Name, StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
string.Equals(p.Type, person.Type, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
// Check for dupes based on the combination of Name and Type
|
||||||
|
if (existing == null)
|
||||||
|
{
|
||||||
|
people.Add(person);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool ContainsPerson(List<PersonInfo> people, string name)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("name");
|
||||||
|
}
|
||||||
|
return people.Any(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -76,7 +76,16 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
public Func<BaseItem, bool> GetItemFilter()
|
public Func<BaseItem, bool> GetItemFilter()
|
||||||
{
|
{
|
||||||
return i => i.People.Any(p => string.Equals(p.Name, Name, StringComparison.OrdinalIgnoreCase));
|
return i => LibraryManager.GetPeople(i).Any(p => string.Equals(p.Name, Name, StringComparison.OrdinalIgnoreCase));
|
||||||
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,5 +72,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
return i => i.Studios.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
return i => i.Studios.Contains(Name, StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,5 +295,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
return config.GroupedFolders.Select(i => new Guid(i)).Contains(id);
|
return config.GroupedFolders.Select(i => new Guid(i)).Contains(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Controller.Playlists;
|
using System.Runtime.Serialization;
|
||||||
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Controller.TV;
|
using MediaBrowser.Controller.TV;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -93,5 +94,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
return standaloneTypes.Contains(collectionFolder.CollectionType ?? string.Empty);
|
return standaloneTypes.Contains(collectionFolder.CollectionType ?? string.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1698,9 +1698,9 @@ namespace MediaBrowser.Controller.Entities
|
||||||
.Select(libraryManager.GetItemById)
|
.Select(libraryManager.GetItemById)
|
||||||
.Select(i => i == null ? "-1" : i.Name)
|
.Select(i => i == null ? "-1" : i.Name)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (!(names.Any(
|
if (!(names.Any(
|
||||||
v => item.People.Select(i => i.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
v => libraryManager.GetPeople(item).Select(i => i.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1713,7 +1713,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
if (personTypes.Length == 0)
|
if (personTypes.Length == 0)
|
||||||
{
|
{
|
||||||
if (!(item.People.Any(p => string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase))))
|
if (!(libraryManager.GetPeople(item).Any(p => string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase))))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1723,8 +1723,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
var types = personTypes;
|
var types = personTypes;
|
||||||
|
|
||||||
var ok = new[] { item }.Any(i =>
|
var ok = new[] { item }.Any(i =>
|
||||||
i.People != null &&
|
libraryManager.GetPeople(i).Any(p =>
|
||||||
i.People.Any(p =>
|
|
||||||
string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role ?? string.Empty, StringComparer.OrdinalIgnoreCase))));
|
string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role ?? string.Empty, StringComparer.OrdinalIgnoreCase))));
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
|
|
@ -88,5 +88,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
var val = GetYearValue();
|
var val = GetYearValue();
|
||||||
return i => i.ProductionYear.HasValue && val.HasValue && i.ProductionYear.Value == val.Value;
|
return i => i.ProductionYear.HasValue && val.HasValue && i.ProductionYear.Value == val.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IgnoreDataMember]
|
||||||
|
public override bool SupportsPeople
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -412,5 +412,26 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <returns>IEnumerable<Folder>.</returns>
|
/// <returns>IEnumerable<Folder>.</returns>
|
||||||
IEnumerable<Folder> GetCollectionFolders(BaseItem item);
|
IEnumerable<Folder> GetCollectionFolders(BaseItem item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the people.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The item.</param>
|
||||||
|
/// <returns>List<PersonInfo>.</returns>
|
||||||
|
List<PersonInfo> GetPeople(BaseItem item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all people names.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>List<System.String>.</returns>
|
||||||
|
List<PersonInfo> GetAllPeople();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the people.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item">The item.</param>
|
||||||
|
/// <param name="people">The people.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task UpdatePeople(BaseItem item, List<PersonInfo> people);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -118,6 +118,11 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
|
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CanDelete()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool IsAuthorizedToDelete(User user)
|
public override bool IsAuthorizedToDelete(User user)
|
||||||
{
|
{
|
||||||
return user.Policy.EnableLiveTvManagement;
|
return user.Policy.EnableLiveTvManagement;
|
||||||
|
|
|
@ -116,6 +116,11 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
|
return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool CanDelete()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool IsAuthorizedToDelete(User user)
|
public override bool IsAuthorizedToDelete(User user)
|
||||||
{
|
{
|
||||||
return user.Policy.EnableLiveTvManagement;
|
return user.Policy.EnableLiveTvManagement;
|
||||||
|
|
|
@ -173,6 +173,7 @@
|
||||||
<Compile Include="Entities\LinkedChild.cs" />
|
<Compile Include="Entities\LinkedChild.cs" />
|
||||||
<Compile Include="Entities\MusicVideo.cs" />
|
<Compile Include="Entities\MusicVideo.cs" />
|
||||||
<Compile Include="Entities\IHasAwards.cs" />
|
<Compile Include="Entities\IHasAwards.cs" />
|
||||||
|
<Compile Include="Entities\PeopleHelper.cs" />
|
||||||
<Compile Include="Entities\Photo.cs" />
|
<Compile Include="Entities\Photo.cs" />
|
||||||
<Compile Include="Entities\PhotoAlbum.cs" />
|
<Compile Include="Entities\PhotoAlbum.cs" />
|
||||||
<Compile Include="Entities\Share.cs" />
|
<Compile Include="Entities\Share.cs" />
|
||||||
|
|
|
@ -147,6 +147,21 @@ namespace MediaBrowser.Controller.Persistence
|
||||||
/// <param name="query">The query.</param>
|
/// <param name="query">The query.</param>
|
||||||
/// <returns>List<Guid>.</returns>
|
/// <returns>List<Guid>.</returns>
|
||||||
List<Guid> GetItemIdsList(InternalItemsQuery query);
|
List<Guid> GetItemIdsList(InternalItemsQuery query);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the people.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="itemId">The item identifier.</param>
|
||||||
|
/// <returns>List<PersonInfo>.</returns>
|
||||||
|
List<PersonInfo> GetPeople(Guid itemId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updates the people.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="itemId">The item identifier.</param>
|
||||||
|
/// <param name="people">The people.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task UpdatePeople(Guid itemId, List<PersonInfo> people);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <param name="metadataFile">The metadata file.</param>
|
/// <param name="metadataFile">The metadata file.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="System.ArgumentNullException"></exception>
|
||||||
public void Fetch(T item, string metadataFile, CancellationToken cancellationToken)
|
public void Fetch(MetadataResult<T> item, string metadataFile, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <param name="settings">The settings.</param>
|
/// <param name="settings">The settings.</param>
|
||||||
/// <param name="encoding">The encoding.</param>
|
/// <param name="encoding">The encoding.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
private void Fetch(T item, string metadataFile, XmlReaderSettings settings, Encoding encoding, CancellationToken cancellationToken)
|
private void Fetch(MetadataResult<T> item, string metadataFile, XmlReaderSettings settings, Encoding encoding, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
using (var streamReader = new StreamReader(metadataFile, encoding))
|
using (var streamReader = new StreamReader(metadataFile, encoding))
|
||||||
{
|
{
|
||||||
|
@ -101,9 +101,11 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// Fetches metadata from one Xml Element
|
/// Fetches metadata from one Xml Element
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="itemResult">The item result.</param>
|
||||||
protected virtual void FetchDataFromXmlNode(XmlReader reader, T item)
|
protected virtual void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T> itemResult)
|
||||||
{
|
{
|
||||||
|
var item = itemResult.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
// DateCreated
|
// DateCreated
|
||||||
|
@ -490,7 +492,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
item.AddPerson(p);
|
PeopleHelper.AddPerson(itemResult.People, p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -502,7 +504,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
item.AddPerson(p);
|
PeopleHelper.AddPerson(itemResult.People, p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -516,7 +518,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
// This is one of the mis-named "Actors" full nodes created by MB2
|
// This is one of the mis-named "Actors" full nodes created by MB2
|
||||||
// Create a reader and pass it to the persons node processor
|
// Create a reader and pass it to the persons node processor
|
||||||
FetchDataFromPersonsNode(new XmlTextReader(new StringReader("<Persons>" + actors + "</Persons>")), item);
|
FetchDataFromPersonsNode(new XmlTextReader(new StringReader("<Persons>" + actors + "</Persons>")), itemResult);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -527,7 +529,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
item.AddPerson(p);
|
PeopleHelper.AddPerson(itemResult.People, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -541,7 +543,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
item.AddPerson(p);
|
PeopleHelper.AddPerson(itemResult.People, p);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -833,7 +835,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
using (var subtree = reader.ReadSubtree())
|
using (var subtree = reader.ReadSubtree())
|
||||||
{
|
{
|
||||||
FetchDataFromPersonsNode(subtree, item);
|
FetchDataFromPersonsNode(subtree, itemResult);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1133,7 +1135,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
private void FetchDataFromPersonsNode(XmlReader reader, T item)
|
private void FetchDataFromPersonsNode(XmlReader reader, MetadataResult<T> item)
|
||||||
{
|
{
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
@ -1154,7 +1156,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
item.AddPerson(person);
|
PeopleHelper.AddPerson(item.People, person);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,23 +1,17 @@
|
||||||
using System.Collections.Generic;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Entities;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
public class LocalMetadataResult<T>
|
public class LocalMetadataResult<T> : MetadataResult<T>
|
||||||
where T : IHasMetadata
|
where T : IHasMetadata
|
||||||
{
|
{
|
||||||
public bool HasMetadata { get; set; }
|
|
||||||
public T Item { get; set; }
|
|
||||||
|
|
||||||
public List<LocalImageInfo> Images { get; set; }
|
public List<LocalImageInfo> Images { get; set; }
|
||||||
public List<ChapterInfo> Chapters { get; set; }
|
|
||||||
public List<UserItemData> UserDataLIst { get; set; }
|
public List<UserItemData> UserDataLIst { get; set; }
|
||||||
|
|
||||||
public LocalMetadataResult()
|
public LocalMetadataResult()
|
||||||
{
|
{
|
||||||
Images = new List<LocalImageInfo>();
|
Images = new List<LocalImageInfo>();
|
||||||
Chapters = new List<ChapterInfo>();
|
|
||||||
UserDataLIst = new List<UserItemData>();
|
UserDataLIst = new List<UserItemData>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,18 @@
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers
|
namespace MediaBrowser.Controller.Providers
|
||||||
{
|
{
|
||||||
public class MetadataResult<T>
|
public class MetadataResult<T>
|
||||||
{
|
{
|
||||||
|
public List<PersonInfo> People { get; set; }
|
||||||
|
|
||||||
public bool HasMetadata { get; set; }
|
public bool HasMetadata { get; set; }
|
||||||
public T Item { get; set; }
|
public T Item { get; set; }
|
||||||
|
|
||||||
|
public MetadataResult()
|
||||||
|
{
|
||||||
|
People = new List<PersonInfo>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -35,5 +36,12 @@ namespace MediaBrowser.Controller.Subtitles
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{SubtitleResponse}.</returns>
|
/// <returns>Task{SubtitleResponse}.</returns>
|
||||||
Task<SubtitleResponse> GetSubtitles(string id, CancellationToken cancellationToken);
|
Task<SubtitleResponse> GetSubtitles(string id, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the supported languages.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task<IEnumerable<NameIdPair>>.</returns>
|
||||||
|
Task<IEnumerable<NameIdPair>> GetSupportedLanguages(CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
|
||||||
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, Logger);
|
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, Logger, libraryManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
|
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
|
||||||
|
@ -410,7 +410,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
{
|
{
|
||||||
if (stubType.Value == StubType.People)
|
if (stubType.Value == StubType.People)
|
||||||
{
|
{
|
||||||
var items = item.People.Select(i =>
|
var items = _libraryManager.GetPeople(item).Select(i =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -488,7 +488,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
|
|
||||||
private async Task<QueryResult<ServerItem>> GetItemsFromPerson(Person person, User user, int? startIndex, int? limit)
|
private async Task<QueryResult<ServerItem>> GetItemsFromPerson(Person person, User user, int? startIndex, int? limit)
|
||||||
{
|
{
|
||||||
var items = user.RootFolder.GetRecursiveChildren(user, i => i is Movie || i is Series && i.ContainsPerson(person.Name))
|
var items = user.RootFolder.GetRecursiveChildren(user, i => i is Movie || i is Series && PeopleHelper.ContainsPerson(_libraryManager.GetPeople(i), person.Name))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var trailerResult = await _channelManager.GetAllMediaInternal(new AllChannelMediaQuery
|
var trailerResult = await _channelManager.GetAllMediaInternal(new AllChannelMediaQuery
|
||||||
|
@ -503,7 +503,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
var trailersToAdd = trailerResult.Items
|
var trailersToAdd = trailerResult.Items
|
||||||
.Where(i => i.ContainsPerson(person.Name))
|
.Where(i => PeopleHelper.ContainsPerson(_libraryManager.GetPeople(i), person.Name))
|
||||||
.Where(i =>
|
.Where(i =>
|
||||||
{
|
{
|
||||||
// Try to filter out dupes using imdb id
|
// Try to filter out dupes using imdb id
|
||||||
|
@ -569,7 +569,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
||||||
|
|
||||||
private bool EnablePeopleDisplay(BaseItem item)
|
private bool EnablePeopleDisplay(BaseItem item)
|
||||||
{
|
{
|
||||||
if (item.People.Count > 0)
|
if (_libraryManager.GetPeople(item).Count > 0)
|
||||||
{
|
{
|
||||||
return item is Movie;
|
return item is Movie;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,9 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly IMediaSourceManager _mediaSourceManager;
|
private readonly IMediaSourceManager _mediaSourceManager;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, string accessToken, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, ILogger logger)
|
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, string accessToken, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, ILogger logger, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_profile = profile;
|
_profile = profile;
|
||||||
_imageProcessor = imageProcessor;
|
_imageProcessor = imageProcessor;
|
||||||
|
@ -50,6 +51,7 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
_mediaSourceManager = mediaSourceManager;
|
_mediaSourceManager = mediaSourceManager;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
_accessToken = accessToken;
|
_accessToken = accessToken;
|
||||||
_user = user;
|
_user = user;
|
||||||
}
|
}
|
||||||
|
@ -654,7 +656,9 @@ namespace MediaBrowser.Dlna.Didl
|
||||||
{
|
{
|
||||||
var types = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer, PersonType.Composer, "Creator" };
|
var types = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer, PersonType.Composer, "Creator" };
|
||||||
|
|
||||||
foreach (var actor in item.People)
|
var people = _libraryManager.GetPeople(item);
|
||||||
|
|
||||||
|
foreach (var actor in people)
|
||||||
{
|
{
|
||||||
var type = types.FirstOrDefault(i => string.Equals(i, actor.Type, StringComparison.OrdinalIgnoreCase) || string.Equals(i, actor.Role, StringComparison.OrdinalIgnoreCase))
|
var type = types.FirstOrDefault(i => string.Equals(i, actor.Type, StringComparison.OrdinalIgnoreCase) || string.Equals(i, actor.Role, StringComparison.OrdinalIgnoreCase))
|
||||||
?? PersonType.Actor;
|
?? PersonType.Actor;
|
||||||
|
|
|
@ -525,6 +525,7 @@ namespace MediaBrowser.Dlna
|
||||||
new Xbox360Profile(),
|
new Xbox360Profile(),
|
||||||
new XboxOneProfile(),
|
new XboxOneProfile(),
|
||||||
new SonyPs3Profile(),
|
new SonyPs3Profile(),
|
||||||
|
new SonyPs4Profile(),
|
||||||
new SonyBravia2010Profile(),
|
new SonyBravia2010Profile(),
|
||||||
new SonyBravia2011Profile(),
|
new SonyBravia2011Profile(),
|
||||||
new SonyBravia2012Profile(),
|
new SonyBravia2012Profile(),
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
<Compile Include="Profiles\DirectTvProfile.cs" />
|
<Compile Include="Profiles\DirectTvProfile.cs" />
|
||||||
<Compile Include="Profiles\DishHopperJoeyProfile.cs" />
|
<Compile Include="Profiles\DishHopperJoeyProfile.cs" />
|
||||||
<Compile Include="Profiles\PopcornHourProfile.cs" />
|
<Compile Include="Profiles\PopcornHourProfile.cs" />
|
||||||
|
<Compile Include="Profiles\SonyPs4Profile.cs" />
|
||||||
<Compile Include="Profiles\VlcProfile.cs" />
|
<Compile Include="Profiles\VlcProfile.cs" />
|
||||||
<Compile Include="Ssdp\DeviceDiscoveryInfo.cs" />
|
<Compile Include="Ssdp\DeviceDiscoveryInfo.cs" />
|
||||||
<Compile Include="Ssdp\Extensions.cs" />
|
<Compile Include="Ssdp\Extensions.cs" />
|
||||||
|
@ -210,6 +211,9 @@
|
||||||
<EmbeddedResource Include="Profiles\Xml\BubbleUPnp.xml" />
|
<EmbeddedResource Include="Profiles\Xml\BubbleUPnp.xml" />
|
||||||
<EmbeddedResource Include="Profiles\Xml\Vlc.xml" />
|
<EmbeddedResource Include="Profiles\Xml\Vlc.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Profiles\Xml\Sony PlayStation 4.xml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -478,7 +478,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
||||||
|
|
||||||
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
||||||
|
|
||||||
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger)
|
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager)
|
||||||
.GetItemDidl(item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
.GetItemDidl(item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
||||||
|
|
||||||
playlistItem.Didl = itemXml;
|
playlistItem.Didl = itemXml;
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
{
|
{
|
||||||
Container = "ts",
|
Container = "ts",
|
||||||
VideoCodec = "h264",
|
VideoCodec = "h264",
|
||||||
AudioCodec = "aac",
|
AudioCodec = "ac3",
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video,
|
||||||
EnableMpegtsM2TsMode = true
|
EnableMpegtsM2TsMode = true
|
||||||
},
|
},
|
||||||
|
@ -333,6 +333,22 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
Value = "he-aac"
|
Value = "he-aac"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.VideoAudio,
|
||||||
|
Codec = "mp3,mp2",
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.AudioChannels,
|
||||||
|
Value = "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
{
|
{
|
||||||
Container = "ts",
|
Container = "ts",
|
||||||
VideoCodec = "h264",
|
VideoCodec = "h264",
|
||||||
AudioCodec = "aac",
|
AudioCodec = "ac3",
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video,
|
||||||
EnableMpegtsM2TsMode = true
|
EnableMpegtsM2TsMode = true
|
||||||
},
|
},
|
||||||
|
@ -75,21 +75,21 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
{
|
{
|
||||||
Container = "ts",
|
Container = "ts",
|
||||||
VideoCodec = "mpeg2video",
|
VideoCodec = "mpeg2video",
|
||||||
AudioCodec = "mp3,mp2",
|
AudioCodec = "mp3",
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Container = "mp4",
|
Container = "mp4",
|
||||||
VideoCodec = "h264,mpeg4",
|
VideoCodec = "h264,mpeg4",
|
||||||
AudioCodec = "ac3,aac,mp3,mp2",
|
AudioCodec = "ac3,aac,mp3",
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
{
|
{
|
||||||
Container = "mpeg",
|
Container = "mpeg",
|
||||||
VideoCodec = "mpeg2video,mpeg1video",
|
VideoCodec = "mpeg2video,mpeg1video",
|
||||||
AudioCodec = "mp3,mp2",
|
AudioCodec = "mp3",
|
||||||
Type = DlnaProfileType.Video
|
Type = DlnaProfileType.Video
|
||||||
},
|
},
|
||||||
new DirectPlayProfile
|
new DirectPlayProfile
|
||||||
|
@ -350,6 +350,22 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
Value = "he-aac"
|
Value = "he-aac"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.VideoAudio,
|
||||||
|
Codec = "mp3,mp2",
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.AudioChannels,
|
||||||
|
Value = "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
{
|
{
|
||||||
Container = "ts",
|
Container = "ts",
|
||||||
VideoCodec = "h264",
|
VideoCodec = "h264",
|
||||||
AudioCodec = "aac",
|
AudioCodec = "ac3",
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video,
|
||||||
EnableMpegtsM2TsMode = true
|
EnableMpegtsM2TsMode = true
|
||||||
},
|
},
|
||||||
|
@ -268,6 +268,22 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
Value = "6"
|
Value = "6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.VideoAudio,
|
||||||
|
Codec = "mp3,mp2",
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.AudioChannels,
|
||||||
|
Value = "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
{
|
{
|
||||||
Container = "ts",
|
Container = "ts",
|
||||||
VideoCodec = "h264",
|
VideoCodec = "h264",
|
||||||
AudioCodec = "aac",
|
AudioCodec = "ac3",
|
||||||
Type = DlnaProfileType.Video,
|
Type = DlnaProfileType.Video,
|
||||||
EnableMpegtsM2TsMode = true
|
EnableMpegtsM2TsMode = true
|
||||||
},
|
},
|
||||||
|
@ -286,6 +286,22 @@ namespace MediaBrowser.Dlna.Profiles
|
||||||
Value = "30"
|
Value = "30"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.VideoAudio,
|
||||||
|
Codec = "mp3,mp2",
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.AudioChannels,
|
||||||
|
Value = "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
260
MediaBrowser.Dlna/Profiles/SonyPs4Profile.cs
Normal file
260
MediaBrowser.Dlna/Profiles/SonyPs4Profile.cs
Normal file
|
@ -0,0 +1,260 @@
|
||||||
|
using MediaBrowser.Model.Dlna;
|
||||||
|
using System.Xml.Serialization;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Dlna.Profiles
|
||||||
|
{
|
||||||
|
[XmlRoot("Profile")]
|
||||||
|
public class SonyPs4Profile : DefaultProfile
|
||||||
|
{
|
||||||
|
public SonyPs4Profile()
|
||||||
|
{
|
||||||
|
Name = "Sony PlayStation 4";
|
||||||
|
|
||||||
|
Identification = new DeviceIdentification
|
||||||
|
{
|
||||||
|
FriendlyName = "PLAYSTATION 4",
|
||||||
|
|
||||||
|
Headers = new[]
|
||||||
|
{
|
||||||
|
new HttpHeaderInfo
|
||||||
|
{
|
||||||
|
Name = "User-Agent",
|
||||||
|
Value = @"PLAYSTATION 4",
|
||||||
|
Match = HeaderMatchType.Substring
|
||||||
|
},
|
||||||
|
|
||||||
|
new HttpHeaderInfo
|
||||||
|
{
|
||||||
|
Name = "X-AV-Client-Info",
|
||||||
|
Value = @"PLAYSTATION 4",
|
||||||
|
Match = HeaderMatchType.Substring
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
AlbumArtPn = "JPEG_TN";
|
||||||
|
|
||||||
|
SonyAggregationFlags = "10";
|
||||||
|
XDlnaDoc = "DMS-1.50";
|
||||||
|
EnableSingleAlbumArtLimit = true;
|
||||||
|
|
||||||
|
DirectPlayProfiles = new[]
|
||||||
|
{
|
||||||
|
new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Container = "avi",
|
||||||
|
Type = DlnaProfileType.Video,
|
||||||
|
VideoCodec = "mpeg4",
|
||||||
|
AudioCodec = "mp2,mp3"
|
||||||
|
},
|
||||||
|
new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Container = "ts",
|
||||||
|
Type = DlnaProfileType.Video,
|
||||||
|
VideoCodec = "mpeg1video,mpeg2video,h264",
|
||||||
|
AudioCodec = "ac3,mp2,mp3,aac"
|
||||||
|
},
|
||||||
|
new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Container = "mpeg",
|
||||||
|
Type = DlnaProfileType.Video,
|
||||||
|
VideoCodec = "mpeg1video,mpeg2video",
|
||||||
|
AudioCodec = "mp2"
|
||||||
|
},
|
||||||
|
new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Container = "mp4,mkv",
|
||||||
|
Type = DlnaProfileType.Video,
|
||||||
|
VideoCodec = "h264,mpeg4",
|
||||||
|
AudioCodec = "aac,ac3"
|
||||||
|
},
|
||||||
|
new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Container = "aac,mp3,wav",
|
||||||
|
Type = DlnaProfileType.Audio
|
||||||
|
},
|
||||||
|
new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Container = "jpeg,png,gif,bmp,tiff",
|
||||||
|
Type = DlnaProfileType.Photo
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TranscodingProfiles = new[]
|
||||||
|
{
|
||||||
|
new TranscodingProfile
|
||||||
|
{
|
||||||
|
Container = "mp3",
|
||||||
|
AudioCodec = "mp3",
|
||||||
|
Type = DlnaProfileType.Audio
|
||||||
|
},
|
||||||
|
new TranscodingProfile
|
||||||
|
{
|
||||||
|
Container = "ts",
|
||||||
|
VideoCodec = "h264",
|
||||||
|
AudioCodec = "mp3",
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
|
},
|
||||||
|
new TranscodingProfile
|
||||||
|
{
|
||||||
|
Container = "jpeg",
|
||||||
|
Type = DlnaProfileType.Photo
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ContainerProfiles = new[]
|
||||||
|
{
|
||||||
|
new ContainerProfile
|
||||||
|
{
|
||||||
|
Type = DlnaProfileType.Photo,
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.Width,
|
||||||
|
Value = "1920"
|
||||||
|
},
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.Height,
|
||||||
|
Value = "1080"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CodecProfiles = new[]
|
||||||
|
{
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.Video,
|
||||||
|
Codec = "h264",
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.Width,
|
||||||
|
Value = "1920"
|
||||||
|
},
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.Height,
|
||||||
|
Value = "1080"
|
||||||
|
},
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.VideoFramerate,
|
||||||
|
Value = "30",
|
||||||
|
IsRequired = false
|
||||||
|
},
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.VideoBitrate,
|
||||||
|
Value = "15360000",
|
||||||
|
IsRequired = false
|
||||||
|
},
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.VideoLevel,
|
||||||
|
Value = "41",
|
||||||
|
IsRequired = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.VideoAudio,
|
||||||
|
Codec = "ac3",
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.AudioChannels,
|
||||||
|
Value = "6",
|
||||||
|
IsRequired = false
|
||||||
|
},
|
||||||
|
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.AudioBitrate,
|
||||||
|
Value = "640000",
|
||||||
|
IsRequired = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.VideoAudio,
|
||||||
|
Codec = "wmapro",
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
Property = ProfileConditionValue.AudioChannels,
|
||||||
|
Value = "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.VideoAudio,
|
||||||
|
Codec = "aac",
|
||||||
|
|
||||||
|
Conditions = new []
|
||||||
|
{
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.NotEquals,
|
||||||
|
Property = ProfileConditionValue.AudioProfile,
|
||||||
|
Value = "he-aac",
|
||||||
|
IsRequired = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ResponseProfiles = new[]
|
||||||
|
{
|
||||||
|
new ResponseProfile
|
||||||
|
{
|
||||||
|
Container = "mp4,mov",
|
||||||
|
AudioCodec="aac",
|
||||||
|
MimeType = "video/mp4",
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
|
},
|
||||||
|
|
||||||
|
new ResponseProfile
|
||||||
|
{
|
||||||
|
Container = "avi",
|
||||||
|
MimeType = "video/divx",
|
||||||
|
OrgPn="AVI",
|
||||||
|
Type = DlnaProfileType.Video
|
||||||
|
},
|
||||||
|
|
||||||
|
new ResponseProfile
|
||||||
|
{
|
||||||
|
Container = "wav",
|
||||||
|
MimeType = "audio/wav",
|
||||||
|
Type = DlnaProfileType.Audio
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,7 +47,7 @@
|
||||||
</DirectPlayProfiles>
|
</DirectPlayProfiles>
|
||||||
<TranscodingProfiles>
|
<TranscodingProfiles>
|
||||||
<TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
</TranscodingProfiles>
|
</TranscodingProfiles>
|
||||||
<ContainerProfiles>
|
<ContainerProfiles>
|
||||||
|
@ -94,6 +94,11 @@
|
||||||
<ProfileCondition condition="NotEquals" property="AudioProfile" value="he-aac" isRequired="true" />
|
<ProfileCondition condition="NotEquals" property="AudioProfile" value="he-aac" isRequired="true" />
|
||||||
</Conditions>
|
</Conditions>
|
||||||
</CodecProfile>
|
</CodecProfile>
|
||||||
|
<CodecProfile type="VideoAudio" codec="mp3,mp2">
|
||||||
|
<Conditions>
|
||||||
|
<ProfileCondition condition="LessThanEqual" property="AudioChannels" value="2" isRequired="true" />
|
||||||
|
</Conditions>
|
||||||
|
</CodecProfile>
|
||||||
</CodecProfiles>
|
</CodecProfiles>
|
||||||
<ResponseProfiles>
|
<ResponseProfiles>
|
||||||
<ResponseProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" orgPn="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T" mimeType="video/vnd.dlna.mpeg-tts">
|
<ResponseProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" orgPn="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T" mimeType="video/vnd.dlna.mpeg-tts">
|
||||||
|
|
|
@ -41,16 +41,16 @@
|
||||||
</XmlRootAttributes>
|
</XmlRootAttributes>
|
||||||
<DirectPlayProfiles>
|
<DirectPlayProfiles>
|
||||||
<DirectPlayProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" />
|
<DirectPlayProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" />
|
||||||
<DirectPlayProfile container="ts" audioCodec="mp3,mp2" videoCodec="mpeg2video" type="Video" />
|
<DirectPlayProfile container="ts" audioCodec="mp3" videoCodec="mpeg2video" type="Video" />
|
||||||
<DirectPlayProfile container="mp4" audioCodec="ac3,aac,mp3,mp2" videoCodec="h264,mpeg4" type="Video" />
|
<DirectPlayProfile container="mp4" audioCodec="ac3,aac,mp3" videoCodec="h264,mpeg4" type="Video" />
|
||||||
<DirectPlayProfile container="mpeg" audioCodec="mp3,mp2" videoCodec="mpeg2video,mpeg1video" type="Video" />
|
<DirectPlayProfile container="mpeg" audioCodec="mp3" videoCodec="mpeg2video,mpeg1video" type="Video" />
|
||||||
<DirectPlayProfile container="asf" audioCodec="wmav2,wmapro,wmavoice" videoCodec="wmv2,wmv3,vc1" type="Video" />
|
<DirectPlayProfile container="asf" audioCodec="wmav2,wmapro,wmavoice" videoCodec="wmv2,wmv3,vc1" type="Video" />
|
||||||
<DirectPlayProfile container="mp3" audioCodec="mp3" type="Audio" />
|
<DirectPlayProfile container="mp3" audioCodec="mp3" type="Audio" />
|
||||||
<DirectPlayProfile container="asf" audioCodec="wmav2,wmapro,wmavoice" type="Audio" />
|
<DirectPlayProfile container="asf" audioCodec="wmav2,wmapro,wmavoice" type="Audio" />
|
||||||
</DirectPlayProfiles>
|
</DirectPlayProfiles>
|
||||||
<TranscodingProfiles>
|
<TranscodingProfiles>
|
||||||
<TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
</TranscodingProfiles>
|
</TranscodingProfiles>
|
||||||
<ContainerProfiles>
|
<ContainerProfiles>
|
||||||
|
@ -97,6 +97,11 @@
|
||||||
<ProfileCondition condition="NotEquals" property="AudioProfile" value="he-aac" isRequired="true" />
|
<ProfileCondition condition="NotEquals" property="AudioProfile" value="he-aac" isRequired="true" />
|
||||||
</Conditions>
|
</Conditions>
|
||||||
</CodecProfile>
|
</CodecProfile>
|
||||||
|
<CodecProfile type="VideoAudio" codec="mp3,mp2">
|
||||||
|
<Conditions>
|
||||||
|
<ProfileCondition condition="LessThanEqual" property="AudioChannels" value="2" isRequired="true" />
|
||||||
|
</Conditions>
|
||||||
|
</CodecProfile>
|
||||||
</CodecProfiles>
|
</CodecProfiles>
|
||||||
<ResponseProfiles>
|
<ResponseProfiles>
|
||||||
<ResponseProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" orgPn="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T" mimeType="video/vnd.dlna.mpeg-tts">
|
<ResponseProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" orgPn="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T" mimeType="video/vnd.dlna.mpeg-tts">
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
</DirectPlayProfiles>
|
</DirectPlayProfiles>
|
||||||
<TranscodingProfiles>
|
<TranscodingProfiles>
|
||||||
<TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="mp3" type="Audio" audioCodec="mp3" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
</TranscodingProfiles>
|
</TranscodingProfiles>
|
||||||
<ContainerProfiles>
|
<ContainerProfiles>
|
||||||
|
@ -76,6 +76,11 @@
|
||||||
<ProfileCondition condition="LessThanEqual" property="AudioChannels" value="6" isRequired="true" />
|
<ProfileCondition condition="LessThanEqual" property="AudioChannels" value="6" isRequired="true" />
|
||||||
</Conditions>
|
</Conditions>
|
||||||
</CodecProfile>
|
</CodecProfile>
|
||||||
|
<CodecProfile type="VideoAudio" codec="mp3,mp2">
|
||||||
|
<Conditions>
|
||||||
|
<ProfileCondition condition="LessThanEqual" property="AudioChannels" value="2" isRequired="true" />
|
||||||
|
</Conditions>
|
||||||
|
</CodecProfile>
|
||||||
</CodecProfiles>
|
</CodecProfiles>
|
||||||
<ResponseProfiles>
|
<ResponseProfiles>
|
||||||
<ResponseProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" orgPn="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T" mimeType="video/vnd.dlna.mpeg-tts">
|
<ResponseProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" orgPn="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T" mimeType="video/vnd.dlna.mpeg-tts">
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
</DirectPlayProfiles>
|
</DirectPlayProfiles>
|
||||||
<TranscodingProfiles>
|
<TranscodingProfiles>
|
||||||
<TranscodingProfile container="mp3" type="Audio" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="mp3" type="Audio" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="aac" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="ts" type="Video" videoCodec="h264" audioCodec="ac3" estimateContentLength="false" enableMpegtsM2TsMode="true" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
<TranscodingProfile container="jpeg" type="Photo" estimateContentLength="false" enableMpegtsM2TsMode="false" transcodeSeekInfo="Auto" context="Streaming" />
|
||||||
</TranscodingProfiles>
|
</TranscodingProfiles>
|
||||||
<ContainerProfiles>
|
<ContainerProfiles>
|
||||||
|
@ -76,6 +76,11 @@
|
||||||
<ProfileCondition condition="LessThanEqual" property="VideoFramerate" value="30" isRequired="true" />
|
<ProfileCondition condition="LessThanEqual" property="VideoFramerate" value="30" isRequired="true" />
|
||||||
</Conditions>
|
</Conditions>
|
||||||
</CodecProfile>
|
</CodecProfile>
|
||||||
|
<CodecProfile type="VideoAudio" codec="mp3,mp2">
|
||||||
|
<Conditions>
|
||||||
|
<ProfileCondition condition="LessThanEqual" property="AudioChannels" value="2" isRequired="true" />
|
||||||
|
</Conditions>
|
||||||
|
</CodecProfile>
|
||||||
</CodecProfiles>
|
</CodecProfiles>
|
||||||
<ResponseProfiles>
|
<ResponseProfiles>
|
||||||
<ResponseProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" orgPn="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T" mimeType="video/vnd.dlna.mpeg-tts">
|
<ResponseProfile container="ts" audioCodec="ac3,aac,mp3" videoCodec="h264" type="Video" orgPn="AVC_TS_HD_24_AC3_T,AVC_TS_HD_50_AC3_T,AVC_TS_HD_60_AC3_T,AVC_TS_HD_EU_T" mimeType="video/vnd.dlna.mpeg-tts">
|
||||||
|
|
100
MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml
Normal file
100
MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 4.xml
Normal file
File diff suppressed because one or more lines are too long
|
@ -78,7 +78,6 @@
|
||||||
<Compile Include="Savers\MovieXmlSaver.cs" />
|
<Compile Include="Savers\MovieXmlSaver.cs" />
|
||||||
<Compile Include="Savers\PersonXmlSaver.cs" />
|
<Compile Include="Savers\PersonXmlSaver.cs" />
|
||||||
<Compile Include="Savers\PlaylistXmlSaver.cs" />
|
<Compile Include="Savers\PlaylistXmlSaver.cs" />
|
||||||
<Compile Include="Savers\SeasonXmlSaver.cs" />
|
|
||||||
<Compile Include="Savers\SeriesXmlSaver.cs" />
|
<Compile Include="Savers\SeriesXmlSaver.cs" />
|
||||||
<Compile Include="Savers\XmlSaverHelpers.cs" />
|
<Compile Include="Savers\XmlSaverHelpers.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, BoxSet item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<BoxSet> item)
|
||||||
{
|
{
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FetchFromCollectionItemsNode(XmlReader reader, BoxSet item)
|
private void FetchFromCollectionItemsNode(XmlReader reader, MetadataResult<BoxSet> item)
|
||||||
{
|
{
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item.LinkedChildren = list;
|
item.Item.LinkedChildren = list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
using System;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Parsers
|
namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
public class EpisodeXmlParser : BaseItemXmlParser<Episode>
|
public class EpisodeXmlParser : BaseItemXmlParser<Episode>
|
||||||
{
|
{
|
||||||
private List<LocalImageInfo> _imagesFound;
|
private List<LocalImageInfo> _imagesFound;
|
||||||
private List<ChapterInfo> _chaptersFound;
|
|
||||||
|
|
||||||
public EpisodeXmlParser(ILogger logger)
|
public EpisodeXmlParser(ILogger logger)
|
||||||
: base(logger)
|
: base(logger)
|
||||||
|
@ -26,14 +25,12 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
|
|
||||||
private string _xmlPath;
|
private string _xmlPath;
|
||||||
|
|
||||||
public void Fetch(Episode item,
|
public void Fetch(MetadataResult<Episode> item,
|
||||||
List<LocalImageInfo> images,
|
List<LocalImageInfo> images,
|
||||||
List<ChapterInfo> chapters,
|
|
||||||
string metadataFile,
|
string metadataFile,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_imagesFound = images;
|
_imagesFound = images;
|
||||||
_chaptersFound = chapters;
|
|
||||||
_xmlPath = metadataFile;
|
_xmlPath = metadataFile;
|
||||||
|
|
||||||
Fetch(item, metadataFile, cancellationToken);
|
Fetch(item, metadataFile, cancellationToken);
|
||||||
|
@ -45,16 +42,13 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="result">The result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, Episode item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Episode> result)
|
||||||
{
|
{
|
||||||
|
var item = result.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "Chapters":
|
|
||||||
|
|
||||||
_chaptersFound.AddRange(FetchChaptersFromXmlNode(item, reader.ReadSubtree()));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "Episode":
|
case "Episode":
|
||||||
|
|
||||||
//MB generated metadata is within an "Episode" node
|
//MB generated metadata is within an "Episode" node
|
||||||
|
@ -67,7 +61,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
{
|
{
|
||||||
if (subTree.NodeType == XmlNodeType.Element)
|
if (subTree.NodeType == XmlNodeType.Element)
|
||||||
{
|
{
|
||||||
FetchDataFromXmlNode(subTree, item);
|
FetchDataFromXmlNode(subTree, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +257,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
base.FetchDataFromXmlNode(reader, item);
|
base.FetchDataFromXmlNode(reader, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Task _cachedTask = Task.FromResult(true);
|
private readonly Task _cachedTask = Task.FromResult(true);
|
||||||
public Task FetchAsync(GameSystem item, string metadataFile, CancellationToken cancellationToken)
|
public Task FetchAsync(MetadataResult<GameSystem> item, string metadataFile, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Fetch(item, metadataFile, cancellationToken);
|
Fetch(item, metadataFile, cancellationToken);
|
||||||
|
|
||||||
|
@ -29,9 +29,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="result">The result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, GameSystem item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<GameSystem> result)
|
||||||
{
|
{
|
||||||
|
var item = result.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "GameSystem":
|
case "GameSystem":
|
||||||
|
@ -56,7 +58,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
base.FetchDataFromXmlNode(reader, item);
|
base.FetchDataFromXmlNode(reader, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Task _cachedTask = Task.FromResult(true);
|
private readonly Task _cachedTask = Task.FromResult(true);
|
||||||
public Task FetchAsync(Game item, string metadataFile, CancellationToken cancellationToken)
|
public Task FetchAsync(MetadataResult<Game> item, string metadataFile, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
Fetch(item, metadataFile, cancellationToken);
|
Fetch(item, metadataFile, cancellationToken);
|
||||||
|
|
||||||
|
@ -35,9 +35,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="result">The result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, Game item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Game> result)
|
||||||
{
|
{
|
||||||
|
var item = result.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "GameSystem":
|
case "GameSystem":
|
||||||
|
@ -97,7 +99,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
base.FetchDataFromXmlNode(reader, item);
|
base.FetchDataFromXmlNode(reader, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +1,31 @@
|
||||||
using System.Collections.Generic;
|
using MediaBrowser.Controller.Entities;
|
||||||
using System.Threading;
|
|
||||||
using System.Xml;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Parsers
|
namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class EpisodeXmlParser
|
/// Class EpisodeXmlParser
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MovieXmlParser : BaseItemXmlParser<Video>
|
public class BaseVideoXmlParser<T> : BaseItemXmlParser<T>
|
||||||
|
where T : Video
|
||||||
{
|
{
|
||||||
private List<ChapterInfo> _chaptersFound;
|
public BaseVideoXmlParser(ILogger logger)
|
||||||
|
|
||||||
public MovieXmlParser(ILogger logger)
|
|
||||||
: base(logger)
|
: base(logger)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Fetch(Video item,
|
|
||||||
List<ChapterInfo> chapters,
|
|
||||||
string metadataFile,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
_chaptersFound = chapters;
|
|
||||||
|
|
||||||
Fetch(item, metadataFile, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="result">The result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, Video item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<T> result)
|
||||||
{
|
{
|
||||||
|
var item = result.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "TmdbCollectionName":
|
case "TmdbCollectionName":
|
||||||
|
@ -53,15 +41,25 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "Chapters":
|
|
||||||
|
|
||||||
_chaptersFound.AddRange(FetchChaptersFromXmlNode(item, reader.ReadSubtree()));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
base.FetchDataFromXmlNode(reader, item);
|
base.FetchDataFromXmlNode(reader, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MovieXmlParser : BaseVideoXmlParser<Movie>
|
||||||
|
{
|
||||||
|
public MovieXmlParser(ILogger logger) : base(logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VideoXmlParser : BaseVideoXmlParser<Video>
|
||||||
|
{
|
||||||
|
public VideoXmlParser(ILogger logger)
|
||||||
|
: base(logger)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Parsers
|
namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
{
|
{
|
||||||
public class MusicVideoXmlParser : BaseItemXmlParser<MusicVideo>
|
public class MusicVideoXmlParser : BaseVideoXmlParser<MusicVideo>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="BaseItemXmlParser{T}" /> class.
|
/// Initializes a new instance of the <see cref="BaseItemXmlParser{T}" /> class.
|
||||||
|
@ -21,9 +21,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="result">The result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, MusicVideo item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<MusicVideo> result)
|
||||||
{
|
{
|
||||||
|
var item = result.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "Artist":
|
case "Artist":
|
||||||
|
@ -44,7 +46,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
base.FetchDataFromXmlNode(reader, item);
|
base.FetchDataFromXmlNode(reader, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, Playlist item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Playlist> result)
|
||||||
{
|
{
|
||||||
|
var item = result.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "OwnerUserId":
|
case "OwnerUserId":
|
||||||
|
@ -59,7 +61,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
base.FetchDataFromXmlNode(reader, item);
|
base.FetchDataFromXmlNode(reader, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="result">The result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, Season item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Season> result)
|
||||||
{
|
{
|
||||||
|
var item = result.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "SeasonNumber":
|
case "SeasonNumber":
|
||||||
|
@ -38,7 +40,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
base.FetchDataFromXmlNode(reader, item);
|
base.FetchDataFromXmlNode(reader, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader.</param>
|
/// <param name="reader">The reader.</param>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="result">The result.</param>
|
||||||
protected override void FetchDataFromXmlNode(XmlReader reader, Series item)
|
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Series> result)
|
||||||
{
|
{
|
||||||
|
var item = result.Item;
|
||||||
|
|
||||||
switch (reader.Name)
|
switch (reader.Name)
|
||||||
{
|
{
|
||||||
case "Series":
|
case "Series":
|
||||||
|
@ -42,7 +44,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
{
|
{
|
||||||
if (subTree.NodeType == XmlNodeType.Element)
|
if (subTree.NodeType == XmlNodeType.Element)
|
||||||
{
|
{
|
||||||
FetchDataFromXmlNode(subTree, item);
|
FetchDataFromXmlNode(subTree, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +112,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
base.FetchDataFromXmlNode(reader, item);
|
base.FetchDataFromXmlNode(reader, result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<BoxSet> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<BoxSet> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BoxSetXmlParser(_logger).Fetch(result.Item, path, cancellationToken);
|
new BoxSetXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -25,10 +25,9 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
var images = new List<LocalImageInfo>();
|
var images = new List<LocalImageInfo>();
|
||||||
var chapters = new List<ChapterInfo>();
|
var chapters = new List<ChapterInfo>();
|
||||||
|
|
||||||
new EpisodeXmlParser(_logger).Fetch(result.Item, images, chapters, path, cancellationToken);
|
new EpisodeXmlParser(_logger).Fetch(result, images, path, cancellationToken);
|
||||||
|
|
||||||
result.Images = images;
|
result.Images = images;
|
||||||
result.Chapters = chapters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Folder> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<Folder> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BaseItemXmlParser<Folder>(_logger).Fetch(result.Item, path, cancellationToken);
|
new BaseItemXmlParser<Folder>(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<GameSystem> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<GameSystem> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new GameSystemXmlParser(_logger).Fetch(result.Item, path, cancellationToken);
|
new GameSystemXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Game> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<Game> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new GameXmlParser(_logger).Fetch(result.Item, path, cancellationToken);
|
new GameXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.LocalMetadata.Parsers;
|
using MediaBrowser.LocalMetadata.Parsers;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
@ -22,11 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Movie> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<Movie> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var chapters = new List<ChapterInfo>();
|
new MovieXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
|
|
||||||
new MovieXmlParser(_logger).Fetch(result.Item, chapters, path, cancellationToken);
|
|
||||||
|
|
||||||
result.Chapters = chapters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<MusicVideo> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<MusicVideo> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new MusicVideoXmlParser(_logger).Fetch(result.Item, path, cancellationToken);
|
new MusicVideoXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Person> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<Person> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BaseItemXmlParser<Person>(_logger).Fetch(result.Item, path, cancellationToken);
|
new BaseItemXmlParser<Person>(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Playlist> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<Playlist> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new PlaylistXmlParser(_logger).Fetch(result.Item, path, cancellationToken);
|
new PlaylistXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Season> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<Season> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new SeasonXmlParser(_logger).Fetch(result.Item, path, cancellationToken);
|
new SeasonXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Series> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<Series> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new SeriesXmlParser(_logger).Fetch(result.Item, path, cancellationToken);
|
new SeriesXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
using System.Collections.Generic;
|
using MediaBrowser.Common.IO;
|
||||||
using System.IO;
|
|
||||||
using System.Threading;
|
|
||||||
using MediaBrowser.Common.IO;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.LocalMetadata.Parsers;
|
using MediaBrowser.LocalMetadata.Parsers;
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Providers
|
namespace MediaBrowser.LocalMetadata.Providers
|
||||||
{
|
{
|
||||||
|
@ -22,11 +20,7 @@ namespace MediaBrowser.LocalMetadata.Providers
|
||||||
|
|
||||||
protected override void Fetch(LocalMetadataResult<Video> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(LocalMetadataResult<Video> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var chapters = new List<ChapterInfo>();
|
new VideoXmlParser(_logger).Fetch(result, path, cancellationToken);
|
||||||
|
|
||||||
new MovieXmlParser(_logger).Fetch(result.Item, chapters, path, cancellationToken);
|
|
||||||
|
|
||||||
result.Chapters = chapters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemInfo GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
|
|
@ -20,10 +20,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public BoxSetXmlSaver(IServerConfigurationManager config)
|
public BoxSetXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -54,7 +56,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
|
||||||
builder.Append("<Item>");
|
builder.Append("<Item>");
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes((BoxSet)item, builder);
|
XmlSaverHelpers.AddCommonNodes((BoxSet)item, _libraryManager, builder);
|
||||||
|
|
||||||
builder.Append("</Item>");
|
builder.Append("</Item>");
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,13 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public EpisodeXmlSaver(IItemRepository itemRepository, IServerConfigurationManager config)
|
public EpisodeXmlSaver(IItemRepository itemRepository, IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_itemRepository = itemRepository;
|
_itemRepository = itemRepository;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -116,7 +118,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
builder.Append("<FirstAired>" + SecurityElement.Escape(episode.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + "</FirstAired>");
|
builder.Append("<FirstAired>" + SecurityElement.Escape(episode.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + "</FirstAired>");
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes(episode, builder);
|
XmlSaverHelpers.AddCommonNodes(episode, _libraryManager, builder);
|
||||||
XmlSaverHelpers.AddMediaInfo(episode, builder, _itemRepository);
|
XmlSaverHelpers.AddMediaInfo(episode, builder, _itemRepository);
|
||||||
|
|
||||||
builder.Append("</Item>");
|
builder.Append("</Item>");
|
||||||
|
|
|
@ -23,10 +23,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public FolderXmlSaver(IServerConfigurationManager config)
|
public FolderXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -68,7 +70,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
|
||||||
builder.Append("<Item>");
|
builder.Append("<Item>");
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes((Folder)item, builder);
|
XmlSaverHelpers.AddCommonNodes((Folder)item, _libraryManager, builder);
|
||||||
|
|
||||||
builder.Append("</Item>");
|
builder.Append("</Item>");
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public GameSystemXmlSaver(IServerConfigurationManager config)
|
public GameSystemXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -61,7 +63,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
builder.Append("<GameSystem>" + SecurityElement.Escape(gameSystem.GameSystemName) + "</GameSystem>");
|
builder.Append("<GameSystem>" + SecurityElement.Escape(gameSystem.GameSystemName) + "</GameSystem>");
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes(gameSystem, builder);
|
XmlSaverHelpers.AddCommonNodes(gameSystem, _libraryManager, builder);
|
||||||
|
|
||||||
builder.Append("</Item>");
|
builder.Append("</Item>");
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,14 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public GameXmlSaver(IServerConfigurationManager config)
|
public GameXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether [is enabled for] [the specified item].
|
/// Determines whether [is enabled for] [the specified item].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -87,7 +89,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
builder.Append("<NesBoxRom>" + SecurityElement.Escape(val) + "</NesBoxRom>");
|
builder.Append("<NesBoxRom>" + SecurityElement.Escape(val) + "</NesBoxRom>");
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes(game, builder);
|
XmlSaverHelpers.AddCommonNodes(game, _libraryManager, builder);
|
||||||
|
|
||||||
builder.Append("</Item>");
|
builder.Append("</Item>");
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
|
||||||
builder.Append("<Title>");
|
builder.Append("<Title>");
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes(video, builder);
|
XmlSaverHelpers.AddCommonNodes(video, _libraryManager, builder);
|
||||||
|
|
||||||
var musicVideo = item as MusicVideo;
|
var musicVideo = item as MusicVideo;
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public PersonXmlSaver(IServerConfigurationManager config)
|
public PersonXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -59,7 +61,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
|
|
||||||
builder.Append("<Item>");
|
builder.Append("<Item>");
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes(person, builder);
|
XmlSaverHelpers.AddCommonNodes(person, _libraryManager, builder);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(person.PlaceOfBirth))
|
if (!string.IsNullOrEmpty(person.PlaceOfBirth))
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,10 +21,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public PlaylistXmlSaver(IServerConfigurationManager config)
|
public PlaylistXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -61,8 +63,8 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
{
|
{
|
||||||
builder.Append("<PlaylistMediaType>" + SecurityElement.Escape(playlist.PlaylistMediaType) + "</PlaylistMediaType>");
|
builder.Append("<PlaylistMediaType>" + SecurityElement.Escape(playlist.PlaylistMediaType) + "</PlaylistMediaType>");
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes(playlist, builder);
|
XmlSaverHelpers.AddCommonNodes(playlist, _libraryManager, builder);
|
||||||
|
|
||||||
builder.Append("</Item>");
|
builder.Append("</Item>");
|
||||||
|
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
using MediaBrowser.Controller.Configuration;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
|
||||||
using MediaBrowser.Controller.Library;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
|
||||||
using System.Security;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace MediaBrowser.LocalMetadata.Savers
|
|
||||||
{
|
|
||||||
public class SeasonXmlSaver
|
|
||||||
{
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return XmlProviderUtils.Name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly IServerConfigurationManager _config;
|
|
||||||
|
|
||||||
public SeasonXmlSaver(IServerConfigurationManager config)
|
|
||||||
{
|
|
||||||
_config = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether [is enabled for] [the specified item].
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="updateType">Type of the update.</param>
|
|
||||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
|
||||||
public bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType)
|
|
||||||
{
|
|
||||||
if (!item.SupportsLocalMetadata)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(item is Season))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return updateType >= ItemUpdateType.MetadataDownload || (updateType >= ItemUpdateType.MetadataImport && File.Exists(GetSavePath(item)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Saves the specified item.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
|
||||||
/// <returns>Task.</returns>
|
|
||||||
public void Save(IHasMetadata item, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var builder = new StringBuilder();
|
|
||||||
|
|
||||||
builder.Append("<Item>");
|
|
||||||
|
|
||||||
var season = (Season)item;
|
|
||||||
|
|
||||||
if (season.IndexNumber.HasValue)
|
|
||||||
{
|
|
||||||
builder.Append("<SeasonNumber>" + SecurityElement.Escape(season.IndexNumber.Value.ToString(_usCulture)) + "</SeasonNumber>");
|
|
||||||
}
|
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes((Season)item, builder);
|
|
||||||
|
|
||||||
builder.Append("</Item>");
|
|
||||||
|
|
||||||
var xmlFilePath = GetSavePath(item);
|
|
||||||
|
|
||||||
XmlSaverHelpers.Save(builder, xmlFilePath, new List<string>
|
|
||||||
{
|
|
||||||
"SeasonNumber"
|
|
||||||
}, _config);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the save path.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
public string GetSavePath(IHasMetadata item)
|
|
||||||
{
|
|
||||||
return Path.Combine(item.Path, "season.xml");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -15,12 +15,14 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
public class SeriesXmlSaver : IMetadataFileSaver
|
public class SeriesXmlSaver : IMetadataFileSaver
|
||||||
{
|
{
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
|
||||||
public SeriesXmlSaver(IServerConfigurationManager config)
|
public SeriesXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_libraryManager = libraryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -105,7 +107,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
builder.Append("<AnimeSeriesIndex>" + SecurityElement.Escape(series.AnimeSeriesIndex.Value.ToString(UsCulture)) + "</AnimeSeriesIndex>");
|
builder.Append("<AnimeSeriesIndex>" + SecurityElement.Escape(series.AnimeSeriesIndex.Value.ToString(UsCulture)) + "</AnimeSeriesIndex>");
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlSaverHelpers.AddCommonNodes(series, builder);
|
XmlSaverHelpers.AddCommonNodes(series, _libraryManager, builder);
|
||||||
|
|
||||||
builder.Append("</Series>");
|
builder.Append("</Series>");
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using MediaBrowser.Controller.Playlists;
|
using MediaBrowser.Controller.Playlists;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
@ -230,7 +231,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="builder">The builder.</param>
|
/// <param name="builder">The builder.</param>
|
||||||
public static void AddCommonNodes(BaseItem item, StringBuilder builder)
|
public static void AddCommonNodes(BaseItem item, ILibraryManager libraryManager, StringBuilder builder)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(item.OfficialRating))
|
if (!string.IsNullOrEmpty(item.OfficialRating))
|
||||||
{
|
{
|
||||||
|
@ -627,11 +628,13 @@ namespace MediaBrowser.LocalMetadata.Savers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.People.Count > 0)
|
var people = libraryManager.GetPeople(item);
|
||||||
|
|
||||||
|
if (people.Count > 0)
|
||||||
{
|
{
|
||||||
builder.Append("<Persons>");
|
builder.Append("<Persons>");
|
||||||
|
|
||||||
foreach (var person in item.People)
|
foreach (var person in people)
|
||||||
{
|
{
|
||||||
builder.Append("<Person>");
|
builder.Append("<Person>");
|
||||||
builder.Append("<Name>" + SecurityElement.Escape(person.Name) + "</Name>");
|
builder.Append("<Name>" + SecurityElement.Escape(person.Name) + "</Name>");
|
||||||
|
|
|
@ -182,6 +182,9 @@
|
||||||
<Compile Include="..\MediaBrowser.Model\Configuration\AccessSchedule.cs">
|
<Compile Include="..\MediaBrowser.Model\Configuration\AccessSchedule.cs">
|
||||||
<Link>Configuration\AccessSchedule.cs</Link>
|
<Link>Configuration\AccessSchedule.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\Configuration\AutoOnOff.cs">
|
||||||
|
<Link>Configuration\AutoOnOff.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\Configuration\BaseApplicationConfiguration.cs">
|
<Compile Include="..\MediaBrowser.Model\Configuration\BaseApplicationConfiguration.cs">
|
||||||
<Link>Configuration\BaseApplicationConfiguration.cs</Link>
|
<Link>Configuration\BaseApplicationConfiguration.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -147,6 +147,9 @@
|
||||||
<Compile Include="..\MediaBrowser.Model\Configuration\AccessSchedule.cs">
|
<Compile Include="..\MediaBrowser.Model\Configuration\AccessSchedule.cs">
|
||||||
<Link>Configuration\AccessSchedule.cs</Link>
|
<Link>Configuration\AccessSchedule.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\MediaBrowser.Model\Configuration\AutoOnOff.cs">
|
||||||
|
<Link>Configuration\AutoOnOff.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\MediaBrowser.Model\Configuration\BaseApplicationConfiguration.cs">
|
<Compile Include="..\MediaBrowser.Model\Configuration\BaseApplicationConfiguration.cs">
|
||||||
<Link>Configuration\BaseApplicationConfiguration.cs</Link>
|
<Link>Configuration\BaseApplicationConfiguration.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
10
MediaBrowser.Model/Configuration/AutoOnOff.cs
Normal file
10
MediaBrowser.Model/Configuration/AutoOnOff.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.Configuration
|
||||||
|
{
|
||||||
|
public enum AutoOnOff
|
||||||
|
{
|
||||||
|
Auto,
|
||||||
|
Enabled,
|
||||||
|
Disabled
|
||||||
|
}
|
||||||
|
}
|
|
@ -187,7 +187,6 @@ namespace MediaBrowser.Model.Configuration
|
||||||
|
|
||||||
public bool EnableAutomaticRestart { get; set; }
|
public bool EnableAutomaticRestart { get; set; }
|
||||||
|
|
||||||
public bool EnableRealtimeMonitor { get; set; }
|
|
||||||
public PathSubstitution[] PathSubstitutions { get; set; }
|
public PathSubstitution[] PathSubstitutions { get; set; }
|
||||||
|
|
||||||
public string ServerName { get; set; }
|
public string ServerName { get; set; }
|
||||||
|
@ -208,6 +207,10 @@ namespace MediaBrowser.Model.Configuration
|
||||||
public bool EnableVideoArchiveFiles { get; set; }
|
public bool EnableVideoArchiveFiles { get; set; }
|
||||||
public int RemoteClientBitrateLimit { get; set; }
|
public int RemoteClientBitrateLimit { get; set; }
|
||||||
|
|
||||||
|
public bool DenyIFrameEmbedding { get; set; }
|
||||||
|
|
||||||
|
public AutoOnOff EnableLibraryMonitor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -224,6 +227,7 @@ namespace MediaBrowser.Model.Configuration
|
||||||
EnableDashboardResourceMinification = true;
|
EnableDashboardResourceMinification = true;
|
||||||
|
|
||||||
EnableAutomaticRestart = true;
|
EnableAutomaticRestart = true;
|
||||||
|
DenyIFrameEmbedding = true;
|
||||||
|
|
||||||
EnableUPnP = true;
|
EnableUPnP = true;
|
||||||
|
|
||||||
|
@ -233,6 +237,7 @@ namespace MediaBrowser.Model.Configuration
|
||||||
// 5 minutes
|
// 5 minutes
|
||||||
MinResumeDurationSeconds = 300;
|
MinResumeDurationSeconds = 300;
|
||||||
|
|
||||||
|
EnableLibraryMonitor = AutoOnOff.Auto;
|
||||||
RealtimeLibraryMonitorDelay = 40;
|
RealtimeLibraryMonitorDelay = 40;
|
||||||
|
|
||||||
EnableInternetProviders = true;
|
EnableInternetProviders = true;
|
||||||
|
@ -250,8 +255,6 @@ namespace MediaBrowser.Model.Configuration
|
||||||
|
|
||||||
SeasonZeroDisplayName = "Specials";
|
SeasonZeroDisplayName = "Specials";
|
||||||
|
|
||||||
EnableRealtimeMonitor = true;
|
|
||||||
|
|
||||||
UICulture = "en-us";
|
UICulture = "en-us";
|
||||||
|
|
||||||
PeopleMetadataOptions = new PeopleMetadataOptions();
|
PeopleMetadataOptions = new PeopleMetadataOptions();
|
||||||
|
@ -426,7 +429,10 @@ namespace MediaBrowser.Model.Configuration
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
new MetadataOptions(0, 1280) {ItemType = "Season"}
|
new MetadataOptions(0, 1280)
|
||||||
|
{
|
||||||
|
ItemType = "Season"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@
|
||||||
<Compile Include="Chapters\RemoteChapterResult.cs" />
|
<Compile Include="Chapters\RemoteChapterResult.cs" />
|
||||||
<Compile Include="Collections\CollectionCreationResult.cs" />
|
<Compile Include="Collections\CollectionCreationResult.cs" />
|
||||||
<Compile Include="Configuration\AccessSchedule.cs" />
|
<Compile Include="Configuration\AccessSchedule.cs" />
|
||||||
|
<Compile Include="Configuration\AutoOnOff.cs" />
|
||||||
<Compile Include="Configuration\ChannelOptions.cs" />
|
<Compile Include="Configuration\ChannelOptions.cs" />
|
||||||
<Compile Include="Configuration\ChapterOptions.cs" />
|
<Compile Include="Configuration\ChapterOptions.cs" />
|
||||||
<Compile Include="Configuration\CinemaModeConfiguration.cs" />
|
<Compile Include="Configuration\CinemaModeConfiguration.cs" />
|
||||||
|
|
|
@ -12,25 +12,17 @@ namespace MediaBrowser.Providers.Books
|
||||||
{
|
{
|
||||||
public class BookMetadataService : MetadataService<Book, BookInfo>
|
public class BookMetadataService : MetadataService<Book, BookInfo>
|
||||||
{
|
{
|
||||||
public BookMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
public BookMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override void MergeData(MetadataResult<Book> source, MetadataResult<Book> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(Book source, Book target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
{
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
|
|
||||||
if (replaceData || string.IsNullOrEmpty(target.SeriesName))
|
if (replaceData || string.IsNullOrEmpty(target.Item.SeriesName))
|
||||||
{
|
{
|
||||||
target.SeriesName = source.SeriesName;
|
target.Item.SeriesName = source.Item.SeriesName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,33 +15,10 @@ namespace MediaBrowser.Providers.BoxSets
|
||||||
{
|
{
|
||||||
public class BoxSetMetadataService : MetadataService<BoxSet, BoxSetInfo>
|
public class BoxSetMetadataService : MetadataService<BoxSet, BoxSetInfo>
|
||||||
{
|
{
|
||||||
public BoxSetMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
public BoxSetMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(BoxSet source, BoxSet target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
|
||||||
|
|
||||||
if (mergeMetadataSettings)
|
|
||||||
{
|
|
||||||
var list = source.LinkedChildren.Where(i => i.Type != LinkedChildType.Manual).ToList();
|
|
||||||
|
|
||||||
list.AddRange(target.LinkedChildren.Where(i => i.Type == LinkedChildType.Manual));
|
|
||||||
|
|
||||||
target.LinkedChildren = list;
|
|
||||||
target.Shares = source.Shares;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task<ItemUpdateType> BeforeSave(BoxSet item, bool isFullRefresh, ItemUpdateType currentUpdateType)
|
protected override async Task<ItemUpdateType> BeforeSave(BoxSet item, bool isFullRefresh, ItemUpdateType currentUpdateType)
|
||||||
{
|
{
|
||||||
var updateType = await base.BeforeSave(item, isFullRefresh, currentUpdateType).ConfigureAwait(false);
|
var updateType = await base.BeforeSave(item, isFullRefresh, currentUpdateType).ConfigureAwait(false);
|
||||||
|
@ -59,5 +36,23 @@ namespace MediaBrowser.Providers.BoxSets
|
||||||
|
|
||||||
return updateType;
|
return updateType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void MergeData(MetadataResult<BoxSet> source, MetadataResult<BoxSet> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
|
{
|
||||||
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
|
|
||||||
|
var sourceItem = source.Item;
|
||||||
|
var targetItem = target.Item;
|
||||||
|
|
||||||
|
if (mergeMetadataSettings)
|
||||||
|
{
|
||||||
|
var list = sourceItem.LinkedChildren.Where(i => i.Type != LinkedChildType.Manual).ToList();
|
||||||
|
|
||||||
|
list.AddRange(targetItem.LinkedChildren.Where(i => i.Type == LinkedChildType.Manual));
|
||||||
|
|
||||||
|
targetItem.LinkedChildren = list;
|
||||||
|
targetItem.Shares = sourceItem.Shares;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,19 +12,11 @@ namespace MediaBrowser.Providers.Channels
|
||||||
{
|
{
|
||||||
public class AudioChannelItemMetadataService : MetadataService<ChannelAudioItem, ItemLookupInfo>
|
public class AudioChannelItemMetadataService : MetadataService<ChannelAudioItem, ItemLookupInfo>
|
||||||
{
|
{
|
||||||
public AudioChannelItemMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
public AudioChannelItemMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override void MergeData(MetadataResult<ChannelAudioItem> source, MetadataResult<ChannelAudioItem> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(ChannelAudioItem source, ChannelAudioItem target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
{
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,19 +12,11 @@ namespace MediaBrowser.Providers.Channels
|
||||||
{
|
{
|
||||||
public class ChannelMetadataService : MetadataService<Channel, ItemLookupInfo>
|
public class ChannelMetadataService : MetadataService<Channel, ItemLookupInfo>
|
||||||
{
|
{
|
||||||
public ChannelMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
public ChannelMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override void MergeData(MetadataResult<Channel> source, MetadataResult<Channel> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(Channel source, Channel target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
{
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,19 +12,11 @@ namespace MediaBrowser.Providers.Channels
|
||||||
{
|
{
|
||||||
public class VideoChannelItemMetadataService : MetadataService<ChannelVideoItem, ChannelItemLookupInfo>
|
public class VideoChannelItemMetadataService : MetadataService<ChannelVideoItem, ChannelItemLookupInfo>
|
||||||
{
|
{
|
||||||
public VideoChannelItemMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
public VideoChannelItemMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override void MergeData(MetadataResult<ChannelVideoItem> source, MetadataResult<ChannelVideoItem> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(ChannelVideoItem source, ChannelVideoItem target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
{
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,23 +12,10 @@ namespace MediaBrowser.Providers.Folders
|
||||||
{
|
{
|
||||||
public class FolderMetadataService : MetadataService<Folder, ItemLookupInfo>
|
public class FolderMetadataService : MetadataService<Folder, ItemLookupInfo>
|
||||||
{
|
{
|
||||||
public FolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
public FolderMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(Folder source, Folder target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int Order
|
public override int Order
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -37,5 +24,10 @@ namespace MediaBrowser.Providers.Folders
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void MergeData(MetadataResult<Folder> source, MetadataResult<Folder> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
|
{
|
||||||
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,20 +12,11 @@ namespace MediaBrowser.Providers.Folders
|
||||||
{
|
{
|
||||||
public class UserViewMetadataService : MetadataService<UserView, ItemLookupInfo>
|
public class UserViewMetadataService : MetadataService<UserView, ItemLookupInfo>
|
||||||
{
|
{
|
||||||
public UserViewMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager)
|
public UserViewMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
|
||||||
: base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override void MergeData(MetadataResult<UserView> source, MetadataResult<UserView> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(UserView source, UserView target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
{
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,19 +12,11 @@ namespace MediaBrowser.Providers.GameGenres
|
||||||
{
|
{
|
||||||
public class GameGenreMetadataService : MetadataService<GameGenre, ItemLookupInfo>
|
public class GameGenreMetadataService : MetadataService<GameGenre, ItemLookupInfo>
|
||||||
{
|
{
|
||||||
public GameGenreMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager)
|
public GameGenreMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IProviderRepository providerRepo, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, providerRepo, fileSystem, userDataManager, libraryManager)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override void MergeData(MetadataResult<GameGenre> source, MetadataResult<GameGenre> target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
||||||
/// Merges the specified source.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source">The source.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
|
||||||
/// <param name="lockedFields">The locked fields.</param>
|
|
||||||
/// <param name="replaceData">if set to <c>true</c> [replace data].</param>
|
|
||||||
/// <param name="mergeMetadataSettings">if set to <c>true</c> [merge metadata settings].</param>
|
|
||||||
protected override void MergeData(GameGenre source, GameGenre target, List<MetadataFields> lockedFields, bool replaceData, bool mergeMetadataSettings)
|
|
||||||
{
|
{
|
||||||
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue