update probing

This commit is contained in:
Luke Pulverenti 2016-12-03 15:00:41 -05:00
parent 232da3f17b
commit f5467021b0
3 changed files with 41 additions and 32 deletions

View File

@ -35,13 +35,14 @@ namespace Emby.Server.Implementations.ScheduledTasks
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
// Randomize the default start hour because this operation can really hammer internet metadata providers
var startHour = new Random(_appHost.SystemId.GetHashCode()).Next(0, 8);
return new[] {
return new[]
{
// Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerDaily, TimeOfDayTicks = TimeSpan.FromHours(startHour).Ticks}
new TaskTriggerInfo
{
Type = TaskTriggerInfo.TriggerInterval,
IntervalTicks = TimeSpan.FromDays(7).Ticks
}
};
}

View File

@ -201,6 +201,8 @@ namespace MediaBrowser.MediaEncoding.Probing
using (var stream = _memoryStreamProvider.CreateNew(Encoding.UTF8.GetBytes(xml)))
{
using (var streamReader = new StreamReader(stream))
{
try
{
// Use XmlReader for best performance
using (var reader = XmlReader.Create(streamReader))
@ -233,6 +235,12 @@ namespace MediaBrowser.MediaEncoding.Probing
}
}
}
catch (XmlException)
{
// I've seen probe examples where the iTunMOVI value is just "<"
// So we should not allow this to fail the entire probing operation
}
}
}
}

View File

@ -377,7 +377,7 @@ namespace MediaBrowser.Providers.TV
internal static bool IsValidSeries(Dictionary<string, string> seriesProviderIds)
{
string id;
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id) && !string.IsNullOrEmpty(id))
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
{
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
if (!string.IsNullOrWhiteSpace(id))
@ -386,7 +386,7 @@ namespace MediaBrowser.Providers.TV
}
}
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id) && !string.IsNullOrEmpty(id))
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id))
{
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
if (!string.IsNullOrWhiteSpace(id))
@ -405,7 +405,7 @@ namespace MediaBrowser.Providers.TV
try
{
string seriesId;
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId))
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId) && !string.IsNullOrWhiteSpace(seriesId))
{
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
@ -419,7 +419,7 @@ namespace MediaBrowser.Providers.TV
return seriesDataPath;
}
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId))
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId) && !string.IsNullOrWhiteSpace(seriesId))
{
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);