mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-17 19:08:53 -07:00
commit
20739b144b
@ -602,7 +602,7 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
|
|
||||||
private int GetAudioBitrate(string subProtocol, int? maxTotalBitrate, int? targetAudioChannels, string targetAudioCodec, MediaStream audioStream)
|
private int GetAudioBitrate(string subProtocol, int? maxTotalBitrate, int? targetAudioChannels, string targetAudioCodec, MediaStream audioStream)
|
||||||
{
|
{
|
||||||
var defaultBitrate = audioStream == null ? 192000 : audioStream.BitRate ?? 192000;
|
int defaultBitrate = audioStream == null ? 192000 : audioStream.BitRate ?? 192000;
|
||||||
// Reduce the bitrate if we're downmixing
|
// Reduce the bitrate if we're downmixing
|
||||||
if (targetAudioChannels.HasValue && audioStream != null && audioStream.Channels.HasValue && targetAudioChannels.Value < audioStream.Channels.Value)
|
if (targetAudioChannels.HasValue && audioStream != null && audioStream.Channels.HasValue && targetAudioChannels.Value < audioStream.Channels.Value)
|
||||||
{
|
{
|
||||||
@ -615,7 +615,7 @@ namespace MediaBrowser.Model.Dlna
|
|||||||
{
|
{
|
||||||
if (StringHelper.EqualsIgnoreCase(targetAudioCodec, "ac3"))
|
if (StringHelper.EqualsIgnoreCase(targetAudioCodec, "ac3"))
|
||||||
{
|
{
|
||||||
if (string.Equals(subProtocol, "hls", StringComparison.OrdinalIgnoreCase))
|
if (StringHelper.EqualsIgnoreCase(subProtocol, "hls"))
|
||||||
{
|
{
|
||||||
defaultBitrate = Math.Max(384000, defaultBitrate);
|
defaultBitrate = Math.Max(384000, defaultBitrate);
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,11 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||||||
|
|
||||||
lock (_timerLock)
|
lock (_timerLock)
|
||||||
{
|
{
|
||||||
|
if (_disposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_timer == null)
|
if (_timer == null)
|
||||||
{
|
{
|
||||||
_timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
|
_timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
|
||||||
@ -287,6 +292,7 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||||||
if (_timer != null)
|
if (_timer != null)
|
||||||
{
|
{
|
||||||
_timer.Dispose();
|
_timer.Dispose();
|
||||||
|
_timer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,8 +99,9 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||||||
IncludeItemTypes = new[] { typeof(Trailer).Name },
|
IncludeItemTypes = new[] { typeof(Trailer).Name },
|
||||||
TrailerTypes = trailerTypes.ToArray(),
|
TrailerTypes = trailerTypes.ToArray(),
|
||||||
SimilarTo = item,
|
SimilarTo = item,
|
||||||
IsPlayed = config.EnableIntrosForWatchedContent ? (bool?) null : false,
|
IsPlayed = config.EnableIntrosForWatchedContent ? (bool?)null : false,
|
||||||
MaxParentalRating = config.EnableIntrosParentalControl ? ratingLevel : null,
|
MaxParentalRating = config.EnableIntrosParentalControl ? ratingLevel : null,
|
||||||
|
BlockUnratedItems = config.EnableIntrosParentalControl ? new[] { UnratedItem.Trailer } : new UnratedItem[] { },
|
||||||
Limit = config.TrailerLimit
|
Limit = config.TrailerLimit
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1011,7 +1011,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
|||||||
|
|
||||||
var factorChannelWatchCount = (query.IsAiring ?? false) || (query.IsKids ?? false) || (query.IsSports ?? false) || (query.IsMovie ?? false);
|
var factorChannelWatchCount = (query.IsAiring ?? false) || (query.IsKids ?? false) || (query.IsSports ?? false) || (query.IsMovie ?? false);
|
||||||
|
|
||||||
programs = programList.OrderBy(i => i.HasImage(ImageType.Primary) ? 0 : 1)
|
programs = programList.OrderBy(i => i.StartDate.Date)
|
||||||
.ThenByDescending(i => GetRecommendationScore(i, user.Id, factorChannelWatchCount))
|
.ThenByDescending(i => GetRecommendationScore(i, user.Id, factorChannelWatchCount))
|
||||||
.ThenBy(i => i.StartDate);
|
.ThenBy(i => i.StartDate);
|
||||||
|
|
||||||
|
@ -315,6 +315,8 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override async Task RunStartupTasks()
|
public override async Task RunStartupTasks()
|
||||||
{
|
{
|
||||||
|
await PerformPreInitMigrations().ConfigureAwait(false);
|
||||||
|
|
||||||
if (ServerConfigurationManager.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion &&
|
if (ServerConfigurationManager.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion &&
|
||||||
ServerConfigurationManager.Configuration.IsStartupWizardCompleted)
|
ServerConfigurationManager.Configuration.IsStartupWizardCompleted)
|
||||||
{
|
{
|
||||||
@ -366,23 +368,21 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
|
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
|
||||||
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
|
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
|
||||||
|
|
||||||
PerformPreInitMigrations();
|
|
||||||
|
|
||||||
return base.Init(progress);
|
return base.Init(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PerformPreInitMigrations()
|
private async Task PerformPreInitMigrations()
|
||||||
{
|
{
|
||||||
var migrations = new List<IVersionMigration>
|
var migrations = new List<IVersionMigration>
|
||||||
{
|
{
|
||||||
new UpdateLevelMigration(ServerConfigurationManager, this, HttpClient, JsonSerializer, _releaseAssetFilename)
|
new UpdateLevelMigration(ServerConfigurationManager, this, HttpClient, JsonSerializer, _releaseAssetFilename, Logger)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var task in migrations)
|
foreach (var task in migrations)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
task.Run();
|
await task.Run().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||||||
_taskManager = taskManager;
|
_taskManager = taskManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public async Task Run()
|
||||||
{
|
{
|
||||||
// If a forced migration is required, do that now
|
// If a forced migration is required, do that now
|
||||||
if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion)
|
if (_config.Configuration.MigrationVersion < CleanDatabaseScheduledTask.MigrationVersion)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
{
|
{
|
||||||
public interface IVersionMigration
|
public interface IVersionMigration
|
||||||
{
|
{
|
||||||
void Run();
|
Task Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Startup.Common.Migrations
|
namespace MediaBrowser.Server.Startup.Common.Migrations
|
||||||
{
|
{
|
||||||
@ -13,7 +14,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public async Task Run()
|
||||||
{
|
{
|
||||||
var migrationKey = this.GetType().FullName;
|
var migrationKey = this.GetType().FullName;
|
||||||
var migrationKeyList = _config.Configuration.Migrations.ToList();
|
var migrationKeyList = _config.Configuration.Migrations.ToList();
|
||||||
|
@ -6,6 +6,7 @@ using MediaBrowser.Common.Implementations.Updates;
|
|||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Updates;
|
using MediaBrowser.Model.Updates;
|
||||||
|
|
||||||
@ -18,17 +19,19 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||||||
private readonly IHttpClient _httpClient;
|
private readonly IHttpClient _httpClient;
|
||||||
private readonly IJsonSerializer _jsonSerializer;
|
private readonly IJsonSerializer _jsonSerializer;
|
||||||
private readonly string _releaseAssetFilename;
|
private readonly string _releaseAssetFilename;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public UpdateLevelMigration(IServerConfigurationManager config, IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer, string releaseAssetFilename)
|
public UpdateLevelMigration(IServerConfigurationManager config, IServerApplicationHost appHost, IHttpClient httpClient, IJsonSerializer jsonSerializer, string releaseAssetFilename, ILogger logger)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
_appHost = appHost;
|
_appHost = appHost;
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
_jsonSerializer = jsonSerializer;
|
_jsonSerializer = jsonSerializer;
|
||||||
_releaseAssetFilename = releaseAssetFilename;
|
_releaseAssetFilename = releaseAssetFilename;
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Run()
|
public async Task Run()
|
||||||
{
|
{
|
||||||
var lastVersion = _config.Configuration.LastVersion;
|
var lastVersion = _config.Configuration.LastVersion;
|
||||||
var currentVersion = _appHost.ApplicationVersion;
|
var currentVersion = _appHost.ApplicationVersion;
|
||||||
@ -44,9 +47,9 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||||||
|
|
||||||
await CheckVersion(currentVersion, updateLevel, CancellationToken.None).ConfigureAwait(false);
|
await CheckVersion(currentVersion, updateLevel, CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_logger.ErrorException("Error in update migration", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,10 +112,13 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
|
|||||||
|
|
||||||
private Version ParseVersion(string versionString)
|
private Version ParseVersion(string versionString)
|
||||||
{
|
{
|
||||||
var parts = versionString.Split('.');
|
if (!string.IsNullOrWhiteSpace(versionString))
|
||||||
if (parts.Length == 3)
|
|
||||||
{
|
{
|
||||||
versionString += ".0";
|
var parts = versionString.Split('.');
|
||||||
|
if (parts.Length == 3)
|
||||||
|
{
|
||||||
|
versionString += ".0";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Version version;
|
Version version;
|
||||||
|
Loading…
Reference in New Issue
Block a user