Skip to content

Commit

Permalink
3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Jul 25, 2018
1 parent edc6107 commit f1998b6
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Emby.Dlna/Configuration/DlnaOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public DlnaOptions()
EnableServer = true;
BlastAliveMessages = true;
ClientDiscoveryIntervalSeconds = 60;
BlastAliveMessageIntervalSeconds = 30;
BlastAliveMessageIntervalSeconds = 1800;
}
}
}
46 changes: 40 additions & 6 deletions Emby.Server.Implementations/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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[]
{
Expand Down Expand Up @@ -1928,7 +1926,43 @@ private bool EnablePlugin(string path)
"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>
Expand Down
47 changes: 29 additions & 18 deletions Emby.Server.Implementations/Data/SqliteItemRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2575,11 +2575,11 @@ private string[] GetFinalColumnsToSelect(InternalItemsQuery query, string[] star
var builder = new StringBuilder();
builder.Append("(");

builder.Append("((CleanName 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("+ ((CleanName 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");
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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,
Expand All @@ -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 ?
Expand Down Expand Up @@ -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);
Expand All @@ -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)
{
Expand Down
6 changes: 0 additions & 6 deletions MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Emby.Server.CinemaMode">
<HintPath>..\ThirdParty\emby\Emby.Server.CinemaMode.dll</HintPath>
</Reference>
<Reference Include="Emby.Server.Connect">
<HintPath>..\ThirdParty\emby\Emby.Server.Connect.dll</HintPath>
</Reference>
<Reference Include="Emby.Server.Sync">
<HintPath>..\ThirdParty\emby\Emby.Server.Sync.dll</HintPath>
</Reference>
<Reference Include="Emby.XmlTv, Version=1.0.6700.31789, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Emby.XmlTv.1.0.15\lib\portable-net45+netstandard2.0+win8\Emby.XmlTv.dll</HintPath>
</Reference>
Expand Down
2 changes: 0 additions & 2 deletions MediaBrowser.Server.Mono/MonoAppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Reflection;
using Emby.Server.Connect;
using Emby.Server.Implementations;
using Emby.Server.Sync;
using MediaBrowser.Controller.Connect;
using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.IO;
Expand Down Expand Up @@ -44,7 +43,6 @@ protected override List<Assembly> GetAssembliesWithPartsInternal()

list.Add(GetType().Assembly);
list.Add(typeof(ConnectManager).Assembly);
list.Add(typeof(SyncManager).Assembly);

return list;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,9 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Emby.Server.CinemaMode">
<HintPath>..\ThirdParty\emby\Emby.Server.CinemaMode.dll</HintPath>
</Reference>
<Reference Include="Emby.Server.Connect">
<HintPath>..\ThirdParty\emby\Emby.Server.Connect.dll</HintPath>
</Reference>
<Reference Include="Emby.Server.Sync">
<HintPath>..\ThirdParty\emby\Emby.Server.Sync.dll</HintPath>
</Reference>
<Reference Include="Emby.XmlTv, Version=1.0.6700.31789, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Emby.XmlTv.1.0.15\lib\portable-net45+netstandard2.0+win8\Emby.XmlTv.dll</HintPath>
</Reference>
Expand Down
2 changes: 0 additions & 2 deletions MediaBrowser.ServerApplication/WindowsAppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Emby.Server.Implementations.EntryPoints;
using Emby.Server.Implementations.FFMpeg;
using Emby.Server.Implementations.IO;
using Emby.Server.Sync;
using MediaBrowser.Controller.Connect;
using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.IO;
Expand Down Expand Up @@ -50,7 +49,6 @@ protected override List<Assembly> GetAssembliesWithPartsInternal()
var list = new List<Assembly>();

list.Add(typeof(ConnectManager).Assembly);
list.Add(typeof(SyncManager).Assembly);
list.Add(GetType().Assembly);

return list;
Expand Down
Loading

0 comments on commit f1998b6

Please sign in to comment.