Merge pull request #2586 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-04-19 12:57:53 -04:00 committed by GitHub
commit 3cd37ed3c7
4 changed files with 18 additions and 165 deletions

View File

@ -82,19 +82,24 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var width = videoStream.Width ?? 1920; var width = videoStream.Width ?? 1920;
if (width >= 1900) if (width >= 3000)
{
videoStream.BitRate = 25000000;
}
else if (width >= 1900)
{ {
videoStream.BitRate = 15000000; videoStream.BitRate = 15000000;
} }
else if (width >= 1260) else if (width >= 1200)
{ {
videoStream.BitRate = 3000000; videoStream.BitRate = 4000000;
} }
else if (width >= 700) else if (width >= 700)
{ {
videoStream.BitRate = 1000000; videoStream.BitRate = 1500000;
} }
} }

View File

@ -183,19 +183,24 @@ namespace Emby.Server.Implementations.LiveTv
{ {
var width = videoStream.Width ?? 1920; var width = videoStream.Width ?? 1920;
if (width >= 1900) if (width >= 3000)
{
videoStream.BitRate = 25000000;
}
else if (width >= 1900)
{ {
videoStream.BitRate = 15000000; videoStream.BitRate = 15000000;
} }
else if (width >= 1260) else if (width >= 1200)
{ {
videoStream.BitRate = 4000000; videoStream.BitRate = 4000000;
} }
else if (width >= 700) else if (width >= 700)
{ {
videoStream.BitRate = 1000000; videoStream.BitRate = 1500000;
} }
} }
} }

View File

@ -256,8 +256,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers
{ {
var item = itemResult.Item; var item = itemResult.Item;
var userDataUserId = _config.GetNfoConfiguration().UserId;
switch (reader.Name) switch (reader.Name)
{ {
// DateCreated // DateCreated
@ -792,117 +790,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers
break; break;
} }
case "watched":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
{
bool parsedValue;
if (bool.TryParse(val, out parsedValue))
{
var userData = GetOrAdd(itemResult, userDataUserId);
userData.Played = parsedValue;
}
}
break;
}
case "playcount":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
{
int parsedValue;
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out parsedValue))
{
var userData = GetOrAdd(itemResult, userDataUserId);
userData.PlayCount = parsedValue;
if (parsedValue > 0)
{
userData.Played = true;
}
}
}
break;
}
case "lastplayed":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
{
DateTime parsedValue;
if (DateTime.TryParseExact(val, "yyyy-MM-dd HH:mm:ss", _usCulture, DateTimeStyles.AssumeLocal, out parsedValue))
{
var userData = GetOrAdd(itemResult, userDataUserId);
userData.LastPlayedDate = parsedValue.ToUniversalTime();
}
}
break;
}
case "resume":
{
if (!reader.IsEmptyElement)
{
using (var subtree = reader.ReadSubtree())
{
if (!string.IsNullOrWhiteSpace(userDataUserId))
{
var userData = GetOrAdd(itemResult, userDataUserId);
FetchFromResumeNode(subtree, item, userData);
}
}
}
else
{
reader.Read();
}
break;
}
case "isuserfavorite":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
{
bool parsedValue;
if (bool.TryParse(val, out parsedValue))
{
var userData = GetOrAdd(itemResult, userDataUserId);
userData.IsFavorite = parsedValue;
}
}
break;
}
case "userrating":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val) && !string.IsNullOrWhiteSpace(userDataUserId))
{
double parsedValue;
if (double.TryParse(val, NumberStyles.Any, _usCulture, out parsedValue))
{
var userData = GetOrAdd(itemResult, userDataUserId);
userData.Rating = parsedValue;
}
}
break;
}
default: default:
string readerName = reader.Name; string readerName = reader.Name;
string providerIdValue; string providerIdValue;
@ -922,50 +809,6 @@ namespace MediaBrowser.XbmcMetadata.Parsers
} }
} }
private UserItemData GetOrAdd(MetadataResult<T> result, string userId)
{
return result.GetOrAddUserData(userId);
}
private void FetchFromResumeNode(XmlReader reader, T item, UserItemData userData)
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "position":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
double parsedValue;
if (double.TryParse(val, NumberStyles.Any, _usCulture, out parsedValue))
{
userData.PlaybackPositionTicks = TimeSpan.FromSeconds(parsedValue).Ticks;
}
}
break;
}
default:
reader.Skip();
break;
}
}
else
{
reader.Read();
}
}
}
private void FetchFromFileInfoNode(XmlReader reader, T item) private void FetchFromFileInfoNode(XmlReader reader, T item)
{ {
reader.MoveToContent(); reader.MoveToContent();

View File

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