Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MediaBrowser/Emby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.5.0.0
Choose a base ref
...
head repository: MediaBrowser/Emby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 10 commits
  • 21 files changed
  • 1 contributor

Commits on Jul 18, 2018

  1. Copy the full SHA
    5d8b992 View commit details

Commits on Jul 19, 2018

  1. Copy the full SHA
    3e20127 View commit details

Commits on Jul 20, 2018

  1. Copy the full SHA
    edc6107 View commit details

Commits on Jul 25, 2018

  1. 3.5.1

    LukePulverenti committed Jul 25, 2018
    Copy the full SHA
    f1998b6 View commit details

Commits on Jul 31, 2018

  1. Copy the full SHA
    6961006 View commit details
  2. Copy the full SHA
    bcc167b View commit details

Commits on Aug 2, 2018

  1. 3.5.2

    LukePulverenti committed Aug 2, 2018
    Copy the full SHA
    ed925c3 View commit details

Commits on Sep 20, 2018

  1. Copy the full SHA
    042b15c View commit details
  2. Copy the full SHA
    6ed85ea View commit details
  3. 3.5.3

    LukePulverenti committed Sep 20, 2018
    Copy the full SHA
    1d7c2ab View commit details
2 changes: 1 addition & 1 deletion Emby.Dlna/Configuration/DlnaOptions.cs
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ public DlnaOptions()
EnableServer = true;
BlastAliveMessages = true;
ClientDiscoveryIntervalSeconds = 60;
BlastAliveMessageIntervalSeconds = 30;
BlastAliveMessageIntervalSeconds = 1800;
}
}
}
51 changes: 36 additions & 15 deletions Emby.Drawing.Skia/SkiaEncoder.cs
Original file line number Diff line number Diff line change
@@ -184,7 +184,12 @@ private SKBitmap CropWhiteSpace(SKBitmap bitmap)

public ImageSize GetImageSize(string path)
{
using (var s = new SKFileStream(path))
if (!_fileSystem.FileExists(path))
{
throw new FileNotFoundException("File not found", path);
}

using (var s = new SKFileStream(NormalizePath(path, _fileSystem)))
{
using (var codec = SKCodec.Create(s))
{
@@ -263,7 +268,7 @@ private static SKCodecOrigin GetSKCodecOrigin(ImageOrientation? orientation)
}

private static string[] TransparentImageTypes = new string[] { ".png", ".gif", ".webp" };
internal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem fileSystem, ImageOrientation? orientation, out SKCodecOrigin origin)
internal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem fileSystem, ILogger logger, ImageOrientation? orientation, out SKCodecOrigin origin)
{
if (!fileSystem.FileExists(path))
{
@@ -272,9 +277,12 @@ internal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem

var requiresTransparencyHack = TransparentImageTypes.Contains(Path.GetExtension(path) ?? string.Empty);

var normalizedPath = NormalizePath(path, fileSystem);

if (requiresTransparencyHack || forceCleanBitmap)
{
using (var stream = new SKFileStream(NormalizePath(path, fileSystem)))
//logger.Debug("Opening {0} for decoding with forceCleanBitmap", normalizedPath);
using (var stream = new SKFileStream(normalizedPath))
{
using (var codec = SKCodec.Create(stream))
{
@@ -287,11 +295,17 @@ internal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem
// create the bitmap
var bitmap = new SKBitmap(codec.Info.Width, codec.Info.Height, !requiresTransparencyHack);

if (bitmap != null)
if (bitmap != null && !bitmap.IsNull && !bitmap.IsEmpty)
{
// decode
codec.GetPixels(bitmap.Info, bitmap.GetPixels());

var result = codec.GetPixels(bitmap.Info, bitmap.GetPixels());

if (result != SKCodecResult.Success)
{
origin = GetSKCodecOrigin(orientation);
return null;
}

origin = codec.Origin;
}
else
@@ -304,19 +318,26 @@ internal static SKBitmap Decode(string path, bool forceCleanBitmap, IFileSystem
}
}

var resultBitmap = SKBitmap.Decode(NormalizePath(path, fileSystem));
//logger.Debug("Opening {0} for decoding without forceCleanBitmap", normalizedPath);
var resultBitmap = SKBitmap.Decode(normalizedPath);

if (resultBitmap == null || resultBitmap.IsNull || resultBitmap.IsEmpty)
{
return Decode(path, true, fileSystem, logger, orientation, out origin);
}

if (resultBitmap == null)
if (resultBitmap.IsNull || resultBitmap.IsEmpty)
{
return Decode(path, true, fileSystem, orientation, out origin);
origin = GetSKCodecOrigin(orientation);
return null;
}

// If we have to resize these they often end up distorted
if (resultBitmap.ColorType == SKColorType.Gray8)
{
using (resultBitmap)
{
return Decode(path, true, fileSystem, orientation, out origin);
return Decode(path, true, fileSystem, logger, orientation, out origin);
}
}

@@ -328,13 +349,13 @@ private SKBitmap GetBitmap(string path, bool cropWhitespace, bool forceAnalyzeBi
{
if (cropWhitespace)
{
using (var bitmap = Decode(path, forceAnalyzeBitmap, _fileSystem, orientation, out origin))
using (var bitmap = Decode(path, forceAnalyzeBitmap, _fileSystem, _logger, orientation, out origin))
{
return CropWhiteSpace(bitmap);
}
}

return Decode(path, forceAnalyzeBitmap, _fileSystem, orientation, out origin);
return Decode(path, forceAnalyzeBitmap, _fileSystem, _logger, orientation, out origin);
}

private SKBitmap GetBitmap(string path, bool cropWhitespace, bool autoOrient, ImageOrientation? orientation)
@@ -633,16 +654,16 @@ public void CreateImageCollage(ImageCollageOptions options)

if (ratio >= 1.4)
{
new StripCollageBuilder(_appPaths, _fileSystem).BuildThumbCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
new StripCollageBuilder(_appPaths, _fileSystem, _logger).BuildThumbCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
}
else if (ratio >= .9)
{
new StripCollageBuilder(_appPaths, _fileSystem).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
new StripCollageBuilder(_appPaths, _fileSystem, _logger).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
}
else
{
// @todo create Poster collage capability
new StripCollageBuilder(_appPaths, _fileSystem).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
new StripCollageBuilder(_appPaths, _fileSystem, _logger).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
}
}

7 changes: 5 additions & 2 deletions Emby.Drawing.Skia/StripCollageBuilder.cs
Original file line number Diff line number Diff line change
@@ -4,18 +4,21 @@
using System.IO;
using MediaBrowser.Model.IO;
using System.Collections.Generic;
using MediaBrowser.Model.Logging;

namespace Emby.Drawing.Skia
{
public class StripCollageBuilder
{
private readonly IApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
private readonly ILogger _logger;

public StripCollageBuilder(IApplicationPaths appPaths, IFileSystem fileSystem)
public StripCollageBuilder(IApplicationPaths appPaths, IFileSystem fileSystem, ILogger logger)
{
_appPaths = appPaths;
_fileSystem = fileSystem;
_logger = logger;
}

public static SKEncodedImageFormat GetEncodedFormat(string outputPath)
@@ -173,7 +176,7 @@ private SKBitmap GetNextValidImage(string[] paths, int currentIndex, out int new
}

SKCodecOrigin origin;
bitmap = SkiaEncoder.Decode(paths[currentIndex], false, _fileSystem, null, out origin);
bitmap = SkiaEncoder.Decode(paths[currentIndex], false, _fileSystem, _logger, null, out origin);

imagesTested[currentIndex] = 0;

49 changes: 42 additions & 7 deletions Emby.Server.Implementations/ApplicationHost.cs
Original file line number Diff line number Diff line change
@@ -931,7 +931,7 @@ protected void RegisterResources()

RegisterSingleInstance<IXmlReaderSettingsFactory>(new XmlReaderSettingsFactory());

UserDataManager = new UserDataManager(LogManager, ServerConfigurationManager, ()=> UserManager);
UserDataManager = new UserDataManager(LogManager, ServerConfigurationManager, () => UserManager);
RegisterSingleInstance(UserDataManager);

UserRepository = GetUserRepository();
@@ -1875,8 +1875,7 @@ private List<Tuple<Assembly, string>> GetPluginAssemblies(string path)
{
try
{
return Directory.EnumerateFiles(path, "*.dll", SearchOption.TopDirectoryOnly)
.Where(EnablePlugin)
return FilterAssembliesToLoad(Directory.EnumerateFiles(path, "*.dll", SearchOption.TopDirectoryOnly))
.Select(LoadAssembly)
.Where(a => a != null)
.ToList();
@@ -1887,9 +1886,8 @@ private List<Tuple<Assembly, string>> GetPluginAssemblies(string path)
}
}

private bool EnablePlugin(string path)
private IEnumerable<string> FilterAssembliesToLoad(IEnumerable<string> paths)
{
var filename = Path.GetFileName(path);

var exclude = new[]
{
@@ -1924,10 +1922,47 @@ private bool EnablePlugin(string path)
"MediaBrowser.Plugins.ITV.dll",
"MediaBrowser.Plugins.Lastfm.dll",
"ServerRestart.dll",
"MediaBrowser.Plugins.NotifyMyAndroidNotifications.dll"
"MediaBrowser.Plugins.NotifyMyAndroidNotifications.dll",
"MetadataViewer.dll"
};

return !exclude.Contains(filename ?? string.Empty, StringComparer.OrdinalIgnoreCase);
var minRequiredVersions = new Dictionary<string, Version>(StringComparer.OrdinalIgnoreCase)
{
{ "GameBrowser.dll", new Version(3, 1) },
{ "moviethemesongs.dll", new Version(1, 6) },
{ "themesongs.dll", new Version(1, 2) }
};

return paths.Where(path =>
{
var filename = Path.GetFileName(path);
if (exclude.Contains(filename ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
return false;
}

Version minRequiredVersion;
if (minRequiredVersions.TryGetValue(filename, out minRequiredVersion))
{
try
{
var version = Version.Parse(FileVersionInfo.GetVersionInfo(path).FileVersion);

if (version < minRequiredVersion)
{
Logger.Info("Not loading {0} {1} because the minimum supported version is {2}. Please update to the newer version", filename, version, minRequiredVersion);
return false;
}
}
catch (Exception ex)
{
Logger.ErrorException("Error getting version number from {0}", ex, path);

return false;
}
}
return true;
});
}

/// <summary>
47 changes: 29 additions & 18 deletions Emby.Server.Implementations/Data/SqliteItemRepository.cs
Original file line number Diff line number Diff line change
@@ -2575,11 +2575,11 @@ private string[] GetFinalColumnsToSelect(InternalItemsQuery query, string[] star
var builder = new StringBuilder();
builder.Append("(");

builder.Append("((Name like @SearchTermStartsWith or OriginalTitle like @SearchTermStartsWith) * 10)");
builder.Append("((CleanName like @SearchTermStartsWith or (OriginalTitle not null and OriginalTitle like @SearchTermStartsWith)) * 10)");

if (query.SearchTerm.Length > 1)
{
builder.Append("+ ((Name like @SearchTermContains) * 10 or OriginalTitle like @SearchTermContains)");
builder.Append("+ ((CleanName like @SearchTermContains or (OriginalTitle not null and OriginalTitle like @SearchTermContains)) * 10)");
}

builder.Append(") as SearchScore");
@@ -3824,8 +3824,8 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IStatement statem

if (!string.IsNullOrWhiteSpace(query.Path))
{
whereClauses.Add("(Path=@Path COLLATE NOCASE)");
//whereClauses.Add("Path=@Path");
//whereClauses.Add("(Path=@Path COLLATE NOCASE)");
whereClauses.Add("Path=@Path");
if (statement != null)
{
statement.TryBind("@Path", GetPathToSave(query.Path));
@@ -4046,7 +4046,8 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IStatement statem
{
var paramName = "@PersonId" + index;

clauses.Add("(select Name from TypedBaseItems where guid=" + paramName + ") in (select Name from People where ItemId=Guid)");
clauses.Add("(guid in (select itemid from People where Name = (select Name from TypedBaseItems where guid=" + paramName + ")))");

if (statement != null)
{
statement.TryBind(paramName, personId.ToGuidBlob());
@@ -4257,7 +4258,7 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IStatement statem
{
var paramName = "@ArtistIds" + index;

clauses.Add("(select CleanName from TypedBaseItems where guid=" + paramName + ") in (select CleanValue from itemvalues where ItemId=Guid and Type<=1)");
clauses.Add("(guid in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");
if (statement != null)
{
statement.TryBind(paramName, artistId.ToGuidBlob());
@@ -4276,7 +4277,7 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IStatement statem
{
var paramName = "@ArtistIds" + index;

clauses.Add("(select CleanName from TypedBaseItems where guid=" + paramName + ") in (select CleanValue from itemvalues where ItemId=Guid and Type=1)");
clauses.Add("(guid in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=1))");
if (statement != null)
{
statement.TryBind(paramName, artistId.ToGuidBlob());
@@ -4333,7 +4334,7 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IStatement statem
{
var paramName = "@ExcludeArtistId" + index;

clauses.Add("(select CleanName from TypedBaseItems where guid=" + paramName + ") not in (select CleanValue from itemvalues where ItemId=Guid and Type<=1)");
clauses.Add("(guid not in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");
if (statement != null)
{
statement.TryBind(paramName, artistId.ToGuidBlob());
@@ -4352,7 +4353,7 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IStatement statem
{
var paramName = "@GenreId" + index;

clauses.Add("(select CleanName from TypedBaseItems where guid=" + paramName + ") in (select CleanValue from itemvalues where ItemId=Guid and Type=2)");
clauses.Add("(guid in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=2))");
if (statement != null)
{
statement.TryBind(paramName, genreId.ToGuidBlob());
@@ -4422,7 +4423,8 @@ private List<string> GetWhereClauses(InternalItemsQuery query, IStatement statem
{
var paramName = "@StudioId" + index;

clauses.Add("(select CleanName from TypedBaseItems where guid=" + paramName + ") in (select CleanValue from itemvalues where ItemId=Guid and Type=3)");
clauses.Add("(guid in (select itemid from itemvalues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=3))");

if (statement != null)
{
statement.TryBind(paramName, studioId.ToGuidBlob());
@@ -5611,18 +5613,13 @@ private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuer
var columns = _retriveItemColumns.ToList();
columns.AddRange(itemCountColumns.Select(i => i.Item2).ToArray());

columns = GetFinalColumnsToSelect(query, columns.ToArray()).ToList();

var commandText = "select " + string.Join(",", columns.ToArray()) + GetFromText();
commandText += GetJoinUserDataText(query);

// do this first before calling GetFinalColumnsToSelect, otherwise ExcludeItemIds will be set by SimilarTo
var innerQuery = new InternalItemsQuery(query.User)
{
ExcludeItemTypes = query.ExcludeItemTypes,
IncludeItemTypes = query.IncludeItemTypes,
MediaTypes = query.MediaTypes,
AncestorIds = query.AncestorIds,
ExcludeItemIds = query.ExcludeItemIds,
ItemIds = query.ItemIds,
TopParentIds = query.TopParentIds,
ParentId = query.ParentId,
@@ -5635,6 +5632,11 @@ private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuer
IsSeries = query.IsSeries
};

columns = GetFinalColumnsToSelect(query, columns.ToArray()).ToList();

var commandText = "select " + string.Join(",", columns.ToArray()) + GetFromText();
commandText += GetJoinUserDataText(query);

var innerWhereClauses = GetWhereClauses(innerQuery, null);

var innerWhereText = innerWhereClauses.Count == 0 ?
@@ -5668,7 +5670,9 @@ private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuer
Genres = query.Genres,
Years = query.Years,
NameContains = query.NameContains,
SearchTerm = query.SearchTerm
SearchTerm = query.SearchTerm,
SimilarTo = query.SimilarTo,
ExcludeItemIds = query.ExcludeItemIds
};

var outerWhereClauses = GetWhereClauses(outerQuery, null);
@@ -5681,7 +5685,14 @@ private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuer
commandText += whereText;
commandText += " group by PresentationUniqueKey";

commandText += " order by SortName";
if (query.SimilarTo != null || !string.IsNullOrEmpty(query.SearchTerm))
{
commandText += GetOrderByText(query);
}
else
{
commandText += " order by SortName";
}

if (query.Limit.HasValue || query.StartIndex.HasValue)
{
Loading