Merge pull request #2881 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-09-14 15:24:21 -04:00 committed by GitHub
commit bb5266ceba
5 changed files with 21 additions and 78 deletions

View File

@ -4716,72 +4716,6 @@ namespace Emby.Server.Implementations.Data
public void UpdateInheritedValues(CancellationToken cancellationToken)
{
UpdateInheritedTags(cancellationToken);
}
private void UpdateInheritedTags(CancellationToken cancellationToken)
{
var newValues = new List<Tuple<Guid, string[]>>();
var commandText = @"select guid,
(select group_concat(Value, '|') from ItemValues where (ItemValues.ItemId = Outer.Guid OR ItemValues.ItemId in ((Select AncestorId from AncestorIds where AncestorIds.ItemId=Outer.guid))) and ItemValues.Type = 4) NewInheritedTags,
(select group_concat(Value, '|') from ItemValues where ItemValues.ItemId = Outer.Guid and ItemValues.Type = 6) CurrentInheritedTags
from typedbaseitems as Outer
where (NewInheritedTags <> CurrentInheritedTags or (NewInheritedTags is null) <> (CurrentInheritedTags is null))
limit 100";
using (WriteLock.Write())
{
using (var connection = CreateConnection())
{
connection.RunInTransaction(db =>
{
foreach (var row in connection.Query(commandText))
{
var id = row.GetGuid(0);
string value = row.IsDBNull(1) ? null : row.GetString(1);
var valuesArray = string.IsNullOrWhiteSpace(value) ? new string[] { } : value.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
newValues.Add(new Tuple<Guid, string[]>(id, valuesArray));
}
Logger.Debug("UpdateInheritedTags - {0} rows", newValues.Count);
if (newValues.Count == 0)
{
return;
}
using (var insertStatement = PrepareStatement(connection, "insert into ItemValues (ItemId, Type, Value, CleanValue) values (@ItemId, 6, @Value, @CleanValue)"))
{
using (var deleteStatement = PrepareStatement(connection, "delete from ItemValues where ItemId=@ItemId and Type=6"))
{
foreach (var item in newValues)
{
var guidBlob = item.Item1.ToGuidBlob();
deleteStatement.Reset();
deleteStatement.TryBind("@ItemId", guidBlob);
deleteStatement.MoveNext();
foreach (var itemValue in item.Item2)
{
insertStatement.Reset();
insertStatement.TryBind("@ItemId", guidBlob);
insertStatement.TryBind("@Value", itemValue);
insertStatement.TryBind("@CleanValue", GetCleanValue(itemValue));
insertStatement.MoveNext();
}
}
}
}
}, TransactionMode);
}
}
}
private static Dictionary<string, string[]> GetTypeMapDictionary()

View File

@ -89,12 +89,14 @@ namespace MediaBrowser.Controller.LiveTv
}
}
private static string EmbyServiceName = "Emby";
public override double? GetDefaultPrimaryImageAspectRatio()
{
if (IsMovie)
var serviceName = ServiceName;
if (!IsMovie && !string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || !string.IsNullOrWhiteSpace(serviceName))
{
double value = 2;
value /= 3;
double value = 16;
value /= 9;
return value;
}

View File

@ -53,13 +53,18 @@ namespace MediaBrowser.Controller.LiveTv
var serviceName = ServiceName;
if (!IsMovie && !string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || !string.IsNullOrWhiteSpace(serviceName))
{
return null;
double value = 16;
value /= 9;
return value;
}
else
{
double value = 2;
value /= 3;
double value = 2;
value /= 3;
return value;
return value;
}
}
[IgnoreDataMember]

View File

@ -98,12 +98,14 @@ namespace MediaBrowser.Controller.LiveTv
return false;
}
private static string EmbyServiceName = "Emby";
public override double? GetDefaultPrimaryImageAspectRatio()
{
if (IsMovie)
var serviceName = ServiceName;
if (!IsMovie && !string.Equals(serviceName, EmbyServiceName, StringComparison.OrdinalIgnoreCase) || !string.IsNullOrWhiteSpace(serviceName))
{
double value = 2;
value /= 3;
double value = 16;
value /= 9;
return value;
}

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.30.19")]
[assembly: AssemblyVersion("3.2.30.20")]