mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-08-11 09:13:54 -04:00
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
This commit is contained in:
commit
c24c0ad784
@ -2,6 +2,7 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Controller.Localization;
|
||||||
using MediaBrowser.Controller.Persistence;
|
using MediaBrowser.Controller.Persistence;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
@ -124,6 +125,20 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
[ApiMember(Name = "AirDays", Description = "Optional filter by Series Air Days. Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
[ApiMember(Name = "AirDays", Description = "Optional filter by Series Air Days. Allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]
|
||||||
public string AirDays { get; set; }
|
public string AirDays { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the min offical rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The min offical rating.</value>
|
||||||
|
[ApiMember(Name = "MinOfficalRating", Description = "Optional filter by minimum official rating (PG, PG-13, TV-MA, etc).", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
|
public string MinOfficalRating { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the max offical rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The max offical rating.</value>
|
||||||
|
[ApiMember(Name = "MaxOfficalRating", Description = "Optional filter by maximum official rating (PG, PG-13, TV-MA, etc).", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
|
||||||
|
public string MaxOfficalRating { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the order by.
|
/// Gets the order by.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -357,6 +372,22 @@ namespace MediaBrowser.Api.UserLibrary
|
|||||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
internal static IEnumerable<BaseItem> ApplyAdditionalFilters(GetItems request, IEnumerable<BaseItem> items)
|
internal static IEnumerable<BaseItem> ApplyAdditionalFilters(GetItems request, IEnumerable<BaseItem> items)
|
||||||
{
|
{
|
||||||
|
// Min official rating
|
||||||
|
if (!string.IsNullOrEmpty(request.MinOfficalRating))
|
||||||
|
{
|
||||||
|
var level = Ratings.Level(request.MinOfficalRating);
|
||||||
|
|
||||||
|
items = items.Where(i => Ratings.Level(i.CustomRating ?? i.OfficialRating) >= level);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Max official rating
|
||||||
|
if (!string.IsNullOrEmpty(request.MaxOfficalRating))
|
||||||
|
{
|
||||||
|
var level = Ratings.Level(request.MaxOfficalRating);
|
||||||
|
|
||||||
|
items = items.Where(i => Ratings.Level(i.CustomRating ?? i.OfficialRating) <= level);
|
||||||
|
}
|
||||||
|
|
||||||
// Exclude item types
|
// Exclude item types
|
||||||
if (!string.IsNullOrEmpty(request.ExcludeItemTypes))
|
if (!string.IsNullOrEmpty(request.ExcludeItemTypes))
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// Gets or sets the name.
|
/// Gets or sets the name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string Name { get; set; }
|
public virtual string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the id.
|
/// Gets or sets the id.
|
||||||
@ -957,7 +957,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
{
|
{
|
||||||
if (person == null)
|
if (person == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException("person");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(person.Name))
|
if (string.IsNullOrWhiteSpace(person.Name))
|
||||||
@ -967,16 +967,39 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (People == null)
|
if (People == null)
|
||||||
{
|
{
|
||||||
People = new List<PersonInfo>();
|
People = new List<PersonInfo> { person };
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for dupes based on the combination of Name and Type
|
// 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;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.Equals(person.Type, PersonType.Actor, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
// Only add actors if there isn't an existing one of type Actor or GuestStar
|
||||||
|
if (!People.Any(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && (p.Type.Equals(PersonType.Actor, StringComparison.OrdinalIgnoreCase) || p.Type.Equals(PersonType.GuestStar, StringComparison.OrdinalIgnoreCase))))
|
||||||
|
{
|
||||||
|
People.Add(person);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Check for dupes based on the combination of Name and Type
|
||||||
if (!People.Any(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(person.Type, StringComparison.OrdinalIgnoreCase)))
|
if (!People.Any(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(person.Type, StringComparison.OrdinalIgnoreCase)))
|
||||||
{
|
{
|
||||||
People.Add(person);
|
People.Add(person);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds studios to the item
|
/// Adds studios to the item
|
||||||
|
@ -269,22 +269,13 @@ namespace MediaBrowser.Installer
|
|||||||
{
|
{
|
||||||
ExtractPackage(archive);
|
ExtractPackage(archive);
|
||||||
// We're done with it so delete it (this is necessary for update operations)
|
// We're done with it so delete it (this is necessary for update operations)
|
||||||
try
|
TryDelete(archive);
|
||||||
{
|
|
||||||
File.Delete(archive);
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
SystemClose("Error Removing Archive - " + e.GetType().FullName + "\n\n" + e.Message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
SystemClose("Error Extracting - " + e.GetType().FullName + "\n\n" + e.Message);
|
SystemClose("Error Extracting - " + e.GetType().FullName + "\n\n" + e.Message);
|
||||||
|
// Delete archive even if failed so we don't try again with this one
|
||||||
|
TryDelete(archive);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +328,23 @@ namespace MediaBrowser.Installer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool TryDelete(string file)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(file);
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void PismoInstall()
|
private void PismoInstall()
|
||||||
{
|
{
|
||||||
// Kick off the Pismo installer and wait for it to end
|
// Kick off the Pismo installer and wait for it to end
|
||||||
@ -440,10 +448,26 @@ namespace MediaBrowser.Installer
|
|||||||
var systemDir = Path.Combine(RootPath, "System");
|
var systemDir = Path.Combine(RootPath, "System");
|
||||||
var backupDir = Path.Combine(RootPath, "System.old");
|
var backupDir = Path.Combine(RootPath, "System.old");
|
||||||
if (Directory.Exists(systemDir))
|
if (Directory.Exists(systemDir))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (Directory.Exists(backupDir)) Directory.Delete(backupDir,true);
|
if (Directory.Exists(backupDir)) Directory.Delete(backupDir,true);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new ApplicationException("Could not delete previous backup directory.\n\n"+e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
Directory.Move(systemDir, backupDir);
|
Directory.Move(systemDir, backupDir);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
throw new ApplicationException("Could not move system directory to backup.\n\n"+e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// And extract
|
// And extract
|
||||||
var retryCount = 0;
|
var retryCount = 0;
|
||||||
@ -461,7 +485,7 @@ namespace MediaBrowser.Installer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (retryCount < 3)
|
if (retryCount < 3)
|
||||||
{
|
{
|
||||||
@ -472,8 +496,8 @@ namespace MediaBrowser.Installer
|
|||||||
{
|
{
|
||||||
//Rollback
|
//Rollback
|
||||||
RollBack(systemDir, backupDir);
|
RollBack(systemDir, backupDir);
|
||||||
File.Delete(archive); // so we don't try again if its an update
|
TryDelete(archive); // so we don't try again if its an update
|
||||||
throw;
|
throw new ApplicationException(string.Format("Could not extract {0} to {1} after {2} attempts.\n\n{3}", archive, RootPath, retryCount, e.Message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,5 +157,17 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The ids.</value>
|
/// <value>The ids.</value>
|
||||||
public string[] Ids { get; set; }
|
public string[] Ids { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the min official rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The min official rating.</value>
|
||||||
|
public string MinOfficialRating { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the max official rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The max official rating.</value>
|
||||||
|
public string MaxOfficialRating { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,10 +106,12 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="configurationManager">The configuration manager.</param>
|
/// <param name="configurationManager">The configuration manager.</param>
|
||||||
public UserManager(ILogger logger, IServerConfigurationManager configurationManager)
|
/// <param name="userDataRepository">The user data repository.</param>
|
||||||
|
public UserManager(ILogger logger, IServerConfigurationManager configurationManager, IUserDataRepository userDataRepository)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
ConfigurationManager = configurationManager;
|
ConfigurationManager = configurationManager;
|
||||||
|
_userDataRepository = userDataRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
@ -220,12 +220,12 @@ namespace MediaBrowser.ServerApplication
|
|||||||
ZipClient = new DotNetZipClient();
|
ZipClient = new DotNetZipClient();
|
||||||
RegisterSingleInstance(ZipClient);
|
RegisterSingleInstance(ZipClient);
|
||||||
|
|
||||||
UserManager = new UserManager(Logger, ServerConfigurationManager);
|
|
||||||
RegisterSingleInstance(UserManager);
|
|
||||||
|
|
||||||
UserDataRepository = new SQLiteUserDataRepository(ApplicationPaths, JsonSerializer, LogManager);
|
UserDataRepository = new SQLiteUserDataRepository(ApplicationPaths, JsonSerializer, LogManager);
|
||||||
RegisterSingleInstance(UserDataRepository);
|
RegisterSingleInstance(UserDataRepository);
|
||||||
|
|
||||||
|
UserManager = new UserManager(Logger, ServerConfigurationManager, UserDataRepository);
|
||||||
|
RegisterSingleInstance(UserManager);
|
||||||
|
|
||||||
LibraryManager = new LibraryManager(Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataRepository);
|
LibraryManager = new LibraryManager(Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataRepository);
|
||||||
RegisterSingleInstance(LibraryManager);
|
RegisterSingleInstance(LibraryManager);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.75</version>
|
<version>3.0.76</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.75</version>
|
<version>3.0.76</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.75</version>
|
<version>3.0.76</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.75" />
|
<dependency id="MediaBrowser.Common" version="3.0.76" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user