Merge pull request #2104 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-08-26 15:32:40 -04:00 committed by GitHub
commit 22b3b33589
8 changed files with 48 additions and 12 deletions

View File

@ -331,12 +331,11 @@ namespace MediaBrowser.Controller.LiveTv
/// <param name="user">The user.</param>
/// <returns>Task.</returns>
Task AddInfoToProgramDto(List<Tuple<BaseItem,BaseItemDto>> programs, List<ItemFields> fields, User user = null);
/// <summary>
/// Saves the tuner host.
/// </summary>
/// <param name="info">The information.</param>
/// <returns>Task.</returns>
Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info);
Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info, bool dataSourceChanged = true);
/// <summary>
/// Saves the listing provider.
/// </summary>

View File

@ -602,7 +602,7 @@ namespace MediaBrowser.Model.Dlna
private int GetAudioBitrate(string subProtocol, int? maxTotalBitrate, int? targetAudioChannels, string targetAudioCodec, MediaStream audioStream)
{
var defaultBitrate = audioStream.BitRate ?? 192000;
var defaultBitrate = audioStream == null ? 192000 : audioStream.BitRate ?? 192000;
// Reduce the bitrate if we're downmixing
if (targetAudioChannels.HasValue && audioStream != null && audioStream.Channels.HasValue && targetAudioChannels.Value < audioStream.Channels.Value)
{

View File

@ -2475,7 +2475,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return await _libraryManager.GetNamedView(name, CollectionType.LiveTv, name, cancellationToken).ConfigureAwait(false);
}
public async Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info)
public async Task<TunerHostInfo> SaveTunerHost(TunerHostInfo info, bool dataSourceChanged = true)
{
info = (TunerHostInfo)_jsonSerializer.DeserializeFromString(_jsonSerializer.SerializeToString(info), typeof(TunerHostInfo));
@ -2508,7 +2508,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
_config.SaveConfiguration("livetv", config);
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
if (dataSourceChanged)
{
_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
}
return info;
}

View File

@ -111,7 +111,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
M3UUrl = info.M3UUrl,
IsEnabled = true
}).ConfigureAwait(false);
}, true).ConfigureAwait(false);
}
else
{
@ -120,7 +120,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp
existing.M3UUrl = info.M3UUrl;
existing.FriendlyName = info.FriendlyName;
existing.Tuners = info.Tuners;
await _liveTvManager.SaveTunerHost(existing).ConfigureAwait(false);
await _liveTvManager.SaveTunerHost(existing, false).ConfigureAwait(false);
}
}
catch (OperationCanceledException)

View File

@ -618,6 +618,8 @@ namespace MediaBrowser.Server.Implementations.Sync
{
var result = new Dictionary<string, SyncedItemProgress>();
var now = DateTime.UtcNow;
using (var connection = CreateConnection(true).Result)
{
using (var cmd = connection.CreateCommand())
@ -648,10 +650,12 @@ namespace MediaBrowser.Server.Implementations.Sync
.Replace("select ItemId,Status,Progress from SyncJobItems", "select ItemIds,Status,Progress from SyncJobs")
.Replace("'Synced'", "'Completed','CompletedWithError'");
Logger.Debug(cmd.CommandText);
//Logger.Debug(cmd.CommandText);
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
{
LogQueryTime("GetSyncedItemProgresses", cmd, now);
while (reader.Read())
{
AddStatusResult(reader, result, false);
@ -671,6 +675,32 @@ namespace MediaBrowser.Server.Implementations.Sync
return result;
}
private void LogQueryTime(string methodName, IDbCommand cmd, DateTime startDate)
{
var elapsed = (DateTime.UtcNow - startDate).TotalMilliseconds;
var slowThreshold = 1000;
#if DEBUG
slowThreshold = 50;
#endif
if (elapsed >= slowThreshold)
{
Logger.Debug("{2} query time (slow): {0}ms. Query: {1}",
Convert.ToInt32(elapsed),
cmd.CommandText,
methodName);
}
else
{
//Logger.Debug("{2} query time: {0}ms. Query: {1}",
// Convert.ToInt32(elapsed),
// cmd.CommandText,
// methodName);
}
}
private void AddStatusResult(IDataReader reader, Dictionary<string, SyncedItemProgress> result, bool multipleIds)
{
if (reader.IsDBNull(0))

View File

@ -144,6 +144,10 @@ namespace MediaBrowser.Server.Implementations.Sync
{
mediaSource.Id = item.Id;
mediaSource.SupportsTranscoding = false;
if (mediaSource.Protocol == Model.MediaInfo.MediaProtocol.File)
{
mediaSource.ETag = item.Id;
}
}
public Task CloseMediaSource(string liveStreamId, CancellationToken cancellationToken)

View File

@ -69,7 +69,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
Version version;
if (Version.TryParse(release.tag_name, out version))
{
if (currentVersion >= version)
if (currentVersion > version)
{
newUpdateLevel = PackageVersionClass.Beta;
}
@ -83,7 +83,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
Version version;
if (Version.TryParse(release.tag_name, out version))
{
if (currentVersion >= version)
if (currentVersion > version)
{
newUpdateLevel = PackageVersionClass.Dev;
}

View File

@ -163,7 +163,7 @@ namespace MediaBrowser.ServerApplication
{
_logger.Info("Found a duplicate process. Giving it time to exit.");
if (!duplicate.WaitForExit(15000))
if (!duplicate.WaitForExit(20000))
{
_logger.Info("The duplicate process did not exit.");
return true;