rework people

This commit is contained in:
Luke Pulverenti 2015-10-04 23:24:24 -04:00
parent 90a42dd03c
commit 26487dc455
12 changed files with 48 additions and 119 deletions

View File

@ -1186,15 +1186,8 @@ namespace MediaBrowser.Api.Playback
if (bitrate.HasValue)
{
var hasFixedResolution = state.VideoRequest.HasFixedResolution;
if (string.Equals(videoCodec, "libvpx", StringComparison.OrdinalIgnoreCase))
{
if (hasFixedResolution)
{
return string.Format(" -minrate:v ({0}*.90) -maxrate:v ({0}*1.10) -bufsize:v {0} -b:v {0}", bitrate.Value.ToString(UsCulture));
}
// With vpx when crf is used, b:v becomes a max rate
// https://trac.ffmpeg.org/wiki/vpxEncodingGuide. But higher bitrate source files -b:v causes judder so limite the bitrate but dont allow it to "saturate" the bitrate. So dont contrain it down just up.
return string.Format(" -maxrate:v {0} -bufsize:v ({0}*2) -b:v {0}", bitrate.Value.ToString(UsCulture));
@ -1205,36 +1198,15 @@ namespace MediaBrowser.Api.Playback
return string.Format(" -b:v {0}", bitrate.Value.ToString(UsCulture));
}
// h264_qsv
if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) || string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase))
// h264
if (isHls)
{
if (hasFixedResolution)
{
if (isHls)
{
return string.Format(" -b:v {0} -maxrate ({0}*.80) -bufsize {0}", bitrate.Value.ToString(UsCulture));
}
return string.Format(" -b:v {0}", bitrate.Value.ToString(UsCulture));
}
return string.Format(" -b:v {0} -maxrate ({0}*1.2) -bufsize ({0}*2)", bitrate.Value.ToString(UsCulture));
return string.Format(" -b:v {0} -maxrate {0} -bufsize {1}",
bitrate.Value.ToString(UsCulture),
(bitrate.Value * 2).ToString(UsCulture));
}
// H264
if (hasFixedResolution)
{
if (isHls)
{
return string.Format(" -b:v {0} -maxrate ({0}*.80) -bufsize {0}", bitrate.Value.ToString(UsCulture));
}
return string.Format(" -b:v {0}", bitrate.Value.ToString(UsCulture));
}
return string.Format(" -maxrate {0} -bufsize {1}",
bitrate.Value.ToString(UsCulture),
(bitrate.Value * 2).ToString(UsCulture));
return string.Format(" -b:v {0}", bitrate.Value.ToString(UsCulture));
}
return string.Empty;

View File

@ -818,7 +818,10 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
{
if ((int) statusCode == 429)
{
client.LastTimeout = DateTime.UtcNow;
throw new HttpException(response.StatusDescription)
{
IsTimedOut = true
};
}
if (statusCode == HttpStatusCode.RequestEntityTooLarge)

View File

@ -40,12 +40,6 @@ namespace MediaBrowser.Controller.Providers
/// <value>The date last images refresh.</value>
public DateTime? DateLastImagesRefresh { get; set; }
/// <summary>
/// Gets or sets the last result.
/// </summary>
/// <value>The last result.</value>
public ProviderRefreshStatus LastStatus { get; set; }
/// <summary>
/// Gets or sets the last result error message.
/// </summary>
@ -54,26 +48,12 @@ namespace MediaBrowser.Controller.Providers
public DateTime? ItemDateModified { get; set; }
public void AddStatus(ProviderRefreshStatus status, string errorMessage)
public void AddStatus(string errorMessage)
{
if (LastStatus != status)
{
IsDirty = true;
}
if (string.IsNullOrEmpty(LastErrorMessage))
{
LastErrorMessage = errorMessage;
}
if (LastStatus == ProviderRefreshStatus.Success)
{
LastStatus = status;
}
}
public MetadataStatus()
{
LastStatus = ProviderRefreshStatus.Success;
}
public bool IsDirty { get; private set; }

View File

@ -50,7 +50,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
{
get
{
return Path.Combine(_appPaths.CachePath, "subtitles");
return Path.Combine(_appPaths.DataPath, "subtitles");
}
}

View File

@ -286,7 +286,7 @@ namespace MediaBrowser.Model.Dlna
}
else
{
_logger.Debug("Profile: {0}, No direct play profiles found for Path: {1}",
_logger.Info("Profile: {0}, No direct play profiles found for Path: {1}",
options.Profile.Name ?? "Unknown Profile",
item.Path ?? "Unknown path");
}
@ -365,7 +365,7 @@ namespace MediaBrowser.Model.Dlna
bool isEligibleForDirectPlay = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options), subtitleStream, options, PlayMethod.DirectPlay);
bool isEligibleForDirectStream = IsEligibleForDirectPlay(item, options.GetMaxBitrate(), subtitleStream, options, PlayMethod.DirectStream);
_logger.Debug("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
_logger.Info("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
options.Profile.Name ?? "Unknown Profile",
item.Path ?? "Unknown path",
isEligibleForDirectPlay,
@ -538,7 +538,7 @@ namespace MediaBrowser.Model.Dlna
if (directPlay == null)
{
_logger.Debug("Profile: {0}, No direct play profiles found for Path: {1}",
_logger.Info("Profile: {0}, No direct play profiles found for Path: {1}",
profile.Name ?? "Unknown Profile",
mediaSource.Path ?? "Unknown path");
@ -598,7 +598,7 @@ namespace MediaBrowser.Model.Dlna
if (string.IsNullOrEmpty(videoCodec))
{
_logger.Debug("Profile: {0}, DirectPlay=false. Reason=Unknown video codec. Path: {1}",
_logger.Info("Profile: {0}, DirectPlay=false. Reason=Unknown video codec. Path: {1}",
profile.Name ?? "Unknown Profile",
mediaSource.Path ?? "Unknown path");
@ -633,7 +633,7 @@ namespace MediaBrowser.Model.Dlna
if (string.IsNullOrEmpty(audioCodec))
{
_logger.Debug("Profile: {0}, DirectPlay=false. Reason=Unknown audio codec. Path: {1}",
_logger.Info("Profile: {0}, DirectPlay=false. Reason=Unknown audio codec. Path: {1}",
profile.Name ?? "Unknown Profile",
mediaSource.Path ?? "Unknown path");
@ -693,7 +693,7 @@ namespace MediaBrowser.Model.Dlna
private void LogConditionFailure(DeviceProfile profile, string type, ProfileCondition condition, MediaSourceInfo mediaSource)
{
_logger.Debug("Profile: {0}, DirectPlay=false. Reason={1}.{2} Condition: {3}. ConditionValue: {4}. IsRequired: {5}. Path: {6}",
_logger.Info("Profile: {0}, DirectPlay=false. Reason={1}.{2} Condition: {3}. ConditionValue: {4}. IsRequired: {5}. Path: {6}",
type,
profile.Name ?? "Unknown Profile",
condition.Property,
@ -715,7 +715,7 @@ namespace MediaBrowser.Model.Dlna
if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
{
_logger.Debug("Not eligible for {0} due to unsupported subtitles", playMethod);
_logger.Info("Not eligible for {0} due to unsupported subtitles", playMethod);
return false;
}
}
@ -794,7 +794,7 @@ namespace MediaBrowser.Model.Dlna
return true;
}
_logger.Debug("Bitrate exceeds DirectPlay limit");
_logger.Info("Bitrate exceeds DirectPlay limit");
return false;
}

View File

@ -164,7 +164,6 @@ namespace MediaBrowser.Providers.Manager
catch (Exception ex)
{
result.ErrorMessage = ex.Message;
result.Status = ProviderRefreshStatus.CompletedWithErrors;
_logger.ErrorException("Error in {0}", ex, provider.Name);
}
}
@ -303,7 +302,6 @@ namespace MediaBrowser.Providers.Manager
catch (Exception ex)
{
result.ErrorMessage = ex.Message;
result.Status = ProviderRefreshStatus.CompletedWithErrors;
_logger.ErrorException("Error in {0}", ex, provider.Name);
}
}

View File

@ -98,7 +98,6 @@ namespace MediaBrowser.Providers.Manager
var updateType = ItemUpdateType.None;
var refreshResult = GetLastResult(item);
refreshResult.LastErrorMessage = string.Empty;
refreshResult.LastStatus = ProviderRefreshStatus.Success;
var itemImageProvider = new ItemImageProvider(Logger, ProviderManager, ServerConfigurationManager, FileSystem);
var localImagesFailed = false;
@ -118,7 +117,7 @@ namespace MediaBrowser.Providers.Manager
{
localImagesFailed = true;
Logger.ErrorException("Error validating images for {0}", ex, item.Path ?? item.Name ?? "Unknown name");
refreshResult.AddStatus(ProviderRefreshStatus.Failure, ex.Message);
refreshResult.AddStatus(ex.Message);
}
var metadataResult = new MetadataResult<TItemType>
@ -148,7 +147,7 @@ namespace MediaBrowser.Providers.Manager
var result = await RefreshWithProviders(metadataResult, id, refreshOptions, providers, itemImageProvider, cancellationToken).ConfigureAwait(false);
updateType = updateType | result.UpdateType;
refreshResult.AddStatus(result.Status, result.ErrorMessage);
refreshResult.AddStatus(result.ErrorMessage);
if (result.Failures == 0)
{
refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow);
@ -170,7 +169,7 @@ namespace MediaBrowser.Providers.Manager
var result = await itemImageProvider.RefreshImages(itemOfType, providers, refreshOptions, config, cancellationToken).ConfigureAwait(false);
updateType = updateType | result.UpdateType;
refreshResult.AddStatus(result.Status, result.ErrorMessage);
refreshResult.AddStatus(result.ErrorMessage);
if (result.Failures == 0)
{
refreshResult.SetDateLastImagesRefresh(DateTime.UtcNow);
@ -375,8 +374,6 @@ namespace MediaBrowser.Providers.Manager
Item = CreateNew()
};
temp.Item.Path = item.Path;
var successfulProviderCount = 0;
var failedProviderCount = 0;
var userDataList = new List<UserItemData>();
@ -387,10 +384,8 @@ namespace MediaBrowser.Providers.Manager
.ConfigureAwait(false);
refreshResult.UpdateType = refreshResult.UpdateType | remoteResult.UpdateType;
refreshResult.Status = remoteResult.Status;
refreshResult.ErrorMessage = remoteResult.ErrorMessage;
successfulProviderCount += remoteResult.Successes;
failedProviderCount += remoteResult.Failures;
refreshResult.Failures += remoteResult.Failures;
}
var hasLocalMetadata = false;
@ -426,7 +421,6 @@ namespace MediaBrowser.Providers.Manager
{
hasLocalMetadata = true;
}
successfulProviderCount++;
break;
}
@ -438,12 +432,11 @@ namespace MediaBrowser.Providers.Manager
}
catch (Exception ex)
{
failedProviderCount++;
refreshResult.Failures++;
Logger.ErrorException("Error in {0}", ex, provider.Name);
// If a local provider fails, consider that a failure
refreshResult.Status = ProviderRefreshStatus.Failure;
refreshResult.ErrorMessage = ex.Message;
if (options.MetadataRefreshMode != MetadataRefreshMode.FullRefresh)
@ -461,12 +454,8 @@ namespace MediaBrowser.Providers.Manager
.ConfigureAwait(false);
refreshResult.UpdateType = refreshResult.UpdateType | remoteResult.UpdateType;
if (remoteResult.Status != ProviderRefreshStatus.Success)
{
refreshResult.Status = remoteResult.Status;
refreshResult.ErrorMessage = remoteResult.ErrorMessage;
}
successfulProviderCount += remoteResult.Successes;
refreshResult.ErrorMessage = remoteResult.ErrorMessage;
refreshResult.Failures += remoteResult.Failures;
}
if (providers.Any(i => !(i is ICustomMetadataProvider)))
@ -534,7 +523,6 @@ namespace MediaBrowser.Providers.Manager
}
catch (Exception ex)
{
refreshResult.Status = ProviderRefreshStatus.Failure;
refreshResult.ErrorMessage = ex.Message;
Logger.ErrorException("Error in {0}", ex, provider.Name);
}
@ -570,8 +558,6 @@ namespace MediaBrowser.Providers.Manager
MergeData(result, temp, new List<MetadataFields>(), false, false);
refreshResult.UpdateType = refreshResult.UpdateType | ItemUpdateType.MetadataDownload;
refreshResult.Successes++;
}
else
{
@ -586,7 +572,6 @@ namespace MediaBrowser.Providers.Manager
catch (Exception ex)
{
refreshResult.Failures++;
refreshResult.Status = ProviderRefreshStatus.CompletedWithErrors;
refreshResult.ErrorMessage = ex.Message;
Logger.ErrorException("Error in {0}", ex, provider.Name);
}
@ -667,10 +652,8 @@ namespace MediaBrowser.Providers.Manager
public class RefreshResult
{
public ItemUpdateType UpdateType { get; set; }
public ProviderRefreshStatus Status { get; set; }
public string ErrorMessage { get; set; }
public List<Guid> Providers { get; set; }
public int Successes { get; set; }
public int Failures { get; set; }
}
}

View File

@ -110,7 +110,10 @@ namespace MediaBrowser.Providers.Omdb
if (isSearch)
{
var searchResultList = _jsonSerializer.DeserializeFromStream<SearchResultList>(stream);
resultList.AddRange(searchResultList.Search);
if (searchResultList != null && searchResultList.Search != null)
{
resultList.AddRange(searchResultList.Search);
}
}
else
{

View File

@ -124,15 +124,19 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
var item = _libraryManager.GetPerson(person.Key);
validIds.Add(item.Id);
var options = new MetadataRefreshOptions(_fileSystem)
{
MetadataRefreshMode = person.Value ? MetadataRefreshMode.Default : MetadataRefreshMode.ValidationOnly,
ImageRefreshMode = person.Value ? ImageRefreshMode.Default : ImageRefreshMode.ValidationOnly
MetadataRefreshMode = person.Value ? MetadataRefreshMode.Default : MetadataRefreshMode.ValidationOnly,
ImageRefreshMode = person.Value ? ImageRefreshMode.Default : ImageRefreshMode.ValidationOnly
};
await item.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
throw;
}
catch (Exception ex)
{
_logger.ErrorException("Error validating IBN entry {0}", ex, person);

View File

@ -375,6 +375,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
protected override bool IsValidChannelId(string channelId)
{
if (string.IsNullOrWhiteSpace(channelId))
{
throw new ArgumentNullException("channelId");
}
return channelId.StartsWith(ChannelIdPrefix, StringComparison.OrdinalIgnoreCase);
}

View File

@ -47,7 +47,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
string[] queries = {
"create table if not exists MetadataStatus (ItemId GUID PRIMARY KEY, ItemName TEXT, ItemType TEXT, SeriesName TEXT, DateLastMetadataRefresh datetime, DateLastImagesRefresh datetime, LastStatus TEXT, LastErrorMessage TEXT, MetadataProvidersRefreshed TEXT, ImageProvidersRefreshed TEXT, ItemDateModified DateTimeNull)",
"create table if not exists MetadataStatus (ItemId GUID PRIMARY KEY, ItemName TEXT, ItemType TEXT, SeriesName TEXT, DateLastMetadataRefresh datetime, DateLastImagesRefresh datetime, LastErrorMessage TEXT, ItemDateModified DateTimeNull)",
"create index if not exists idx_MetadataStatus on MetadataStatus(ItemId)",
//pragmas
@ -71,10 +71,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
"SeriesName",
"DateLastMetadataRefresh",
"DateLastImagesRefresh",
"LastStatus",
"LastErrorMessage",
"MetadataProvidersRefreshed",
"ImageProvidersRefreshed",
"ItemDateModified"
};
@ -188,19 +185,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
if (!reader.IsDBNull(6))
{
result.LastStatus = (ProviderRefreshStatus)Enum.Parse(typeof(ProviderRefreshStatus), reader.GetString(6), true);
result.LastErrorMessage = reader.GetString(6);
}
if (!reader.IsDBNull(7))
{
result.LastErrorMessage = reader.GetString(7);
}
// Skip metadata and image providers
if (!reader.IsDBNull(10))
{
result.ItemDateModified = reader.GetDateTime(10).ToUniversalTime();
result.ItemDateModified = reader.GetDateTime(7).ToUniversalTime();
}
return result;
@ -229,11 +219,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveStatusCommand.GetParameter(3).Value = status.SeriesName;
_saveStatusCommand.GetParameter(4).Value = status.DateLastMetadataRefresh;
_saveStatusCommand.GetParameter(5).Value = status.DateLastImagesRefresh;
_saveStatusCommand.GetParameter(6).Value = status.LastStatus.ToString();
_saveStatusCommand.GetParameter(7).Value = status.LastErrorMessage;
_saveStatusCommand.GetParameter(8).Value = string.Empty;
_saveStatusCommand.GetParameter(9).Value = string.Empty;
_saveStatusCommand.GetParameter(10).Value = status.ItemDateModified;
_saveStatusCommand.GetParameter(6).Value = status.LastErrorMessage;
_saveStatusCommand.GetParameter(7).Value = status.ItemDateModified;
_saveStatusCommand.Transaction = transaction;

View File

@ -1975,9 +1975,6 @@
<Content Include="dashboard-ui\scripts\moviegenres.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\moviepeople.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\moviestudios.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -2028,9 +2025,6 @@
<Content Include="dashboard-ui\scripts\tvgenres.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\tvpeople.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\tvrecommended.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>