update hls timer

This commit is contained in:
Luke Pulverenti 2015-04-18 20:05:36 -04:00
parent b5218034ac
commit d155b78360
10 changed files with 99 additions and 11 deletions

View File

@ -331,7 +331,6 @@ namespace MediaBrowser.Api
return;
}
// TODO: Lower this hls timeout
var timerDuration = job.Type == TranscodingJobType.Progressive ?
1000 :
1800000;

View File

@ -488,6 +488,9 @@
<Compile Include="..\MediaBrowser.Model\Dto\ItemIndex.cs">
<Link>Dto\ItemIndex.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\ItemLayout.cs">
<Link>Dto\ItemLayout.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\MediaSourceInfo.cs">
<Link>Dto\MediaSourceInfo.cs</Link>
</Compile>

View File

@ -453,6 +453,9 @@
<Compile Include="..\MediaBrowser.Model\Dto\ItemIndex.cs">
<Link>Dto\ItemIndex.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\ItemLayout.cs">
<Link>Dto\ItemLayout.cs</Link>
</Compile>
<Compile Include="..\MediaBrowser.Model\Dto\MediaSourceInfo.cs">
<Link>Dto\MediaSourceInfo.cs</Link>
</Compile>

View File

@ -98,7 +98,7 @@ namespace MediaBrowser.Model.ApiClient
{
var index = 0;
foreach (var server in servers)
foreach (ServerInfo server in servers)
{
if (StringHelper.EqualsIgnoreCase(id, server.Id))
{
@ -110,5 +110,18 @@ namespace MediaBrowser.Model.ApiClient
return -1;
}
public ServerInfo GetServer(string id)
{
foreach (ServerInfo server in Servers)
{
if (StringHelper.EqualsIgnoreCase(id, server.Id))
{
return server;
}
}
return null;
}
}
}

View File

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
namespace MediaBrowser.Model.Dto
{
public static class ItemLayout
{
public static double? GetDisplayAspectRatio(BaseItemDto item)
{
List<BaseItemDto> items = new List<BaseItemDto>();
items.Add(item);
return GetDisplayAspectRatio(items);
}
public static double? GetDisplayAspectRatio(List<BaseItemDto> items)
{
List<double> values = new List<double>();
foreach (BaseItemDto item in items)
{
if (item.PrimaryImageAspectRatio.HasValue)
{
values.Add(item.PrimaryImageAspectRatio.Value);
}
}
if (values.Count == 0)
{
return null;
}
values.Sort();
double halfDouble = values.Count;
halfDouble /= 2;
int half = Convert.ToInt32(Math.Floor(halfDouble));
double result;
if (values.Count % 2 > 0)
result = values[half];
else
result = (values[half - 1] + values[half]) / 2.0;
// If really close to 2:3 (poster image), just return 2:3
if (Math.Abs(0.66666666667 - result) <= .15)
{
return 0.66666666667;
}
// If really close to 16:9 (episode image), just return 16:9
if (Math.Abs(1.777777778 - result) <= .2)
{
return 1.777777778;
}
// If really close to 1 (square image), just return 1
if (Math.Abs(1 - result) <= .15)
{
return 1.0;
}
// If really close to 4:3 (poster image), just return 2:3
if (Math.Abs(1.33333333333 - result) <= .15)
{
return 1.33333333333;
}
return result;
}
}
}

View File

@ -139,6 +139,7 @@
<Compile Include="Drawing\ImageOrientation.cs" />
<Compile Include="Dto\IHasServerId.cs" />
<Compile Include="Dto\IHasSyncInfo.cs" />
<Compile Include="Dto\ItemLayout.cs" />
<Compile Include="Dto\MetadataEditorInfo.cs" />
<Compile Include="Dto\NameIdPair.cs" />
<Compile Include="Dto\NameValuePair.cs" />

View File

@ -482,6 +482,11 @@ namespace MediaBrowser.Providers.Manager
protected virtual bool IsFullLocalMetadata(TItemType item)
{
if (string.IsNullOrWhiteSpace(item.Name))
{
return false;
}
return true;
}

View File

@ -36,10 +36,6 @@ namespace MediaBrowser.Providers.Movies
protected override bool IsFullLocalMetadata(Movie item)
{
if (string.IsNullOrWhiteSpace(item.Name))
{
return false;
}
if (string.IsNullOrWhiteSpace(item.Overview))
{
return false;

View File

@ -77,10 +77,6 @@ namespace MediaBrowser.Providers.TV
protected override bool IsFullLocalMetadata(Series item)
{
if (string.IsNullOrWhiteSpace(item.Name))
{
return false;
}
if (string.IsNullOrWhiteSpace(item.Overview))
{
return false;

View File

@ -1723,7 +1723,7 @@ namespace MediaBrowser.Server.Implementations.Library
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
}
var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 12;
var refresh = isNew || (DateTime.UtcNow - item.DateLastSaved).TotalHours >= 24;
if (refresh)
{