Use GetEncodingOptions where possible

This commit is contained in:
Bond_009 2021-02-21 02:58:30 +01:00
parent eba859e33e
commit b1fe28d0a6
4 changed files with 5 additions and 10 deletions

View File

@ -335,11 +335,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return new Uri(url).AbsoluteUri.TrimEnd('/'); return new Uri(url).AbsoluteUri.TrimEnd('/');
} }
protected EncodingOptions GetEncodingOptions()
{
return Config.GetConfiguration<EncodingOptions>("encoding");
}
private static string GetHdHrIdFromChannelId(string channelId) private static string GetHdHrIdFromChannelId(string channelId)
{ {
return channelId.Split('_')[1]; return channelId.Split('_')[1];

View File

@ -98,7 +98,7 @@ namespace Jellyfin.Api.Models.PlaybackDtos
private EncodingOptions GetOptions() private EncodingOptions GetOptions()
{ {
return _config.GetConfiguration<EncodingOptions>("encoding"); return _config.GetEncodingOptions();
} }
private async void TimerCallback(object? state) private async void TimerCallback(object? state)

View File

@ -32,7 +32,7 @@ namespace Jellyfin.Server.Migrations.Routines
public void Perform() public void Perform()
{ {
// Set EnableThrottling to false since it wasn't used before and may introduce issues // Set EnableThrottling to false since it wasn't used before and may introduce issues
var encoding = _configManager.GetConfiguration<EncodingOptions>("encoding"); var encoding = _configManager.GetEncodingOptions();
if (encoding.EnableThrottling) if (encoding.EnableThrottling)
{ {
_logger.LogInformation("Disabling transcoding throttling during migration"); _logger.LogInformation("Disabling transcoding throttling during migration");

View File

@ -103,7 +103,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
public void SetFFmpegPath() public void SetFFmpegPath()
{ {
// 1) Custom path stored in config/encoding xml file under tag <EncoderAppPath> takes precedence // 1) Custom path stored in config/encoding xml file under tag <EncoderAppPath> takes precedence
if (!ValidatePath(_configurationManager.GetConfiguration<EncodingOptions>("encoding").EncoderAppPath, FFmpegLocation.Custom)) if (!ValidatePath(_configurationManager.GetEncodingOptions().EncoderAppPath, FFmpegLocation.Custom))
{ {
// 2) Check if the --ffmpeg CLI switch has been given // 2) Check if the --ffmpeg CLI switch has been given
if (!ValidatePath(_startupOptionFFmpegPath, FFmpegLocation.SetByArgument)) if (!ValidatePath(_startupOptionFFmpegPath, FFmpegLocation.SetByArgument))
@ -118,7 +118,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
} }
// Write the FFmpeg path to the config/encoding.xml file as <EncoderAppPathDisplay> so it appears in UI // Write the FFmpeg path to the config/encoding.xml file as <EncoderAppPathDisplay> so it appears in UI
var config = _configurationManager.GetConfiguration<EncodingOptions>("encoding"); var config = _configurationManager.GetEncodingOptions();
config.EncoderAppPathDisplay = _ffmpegPath ?? string.Empty; config.EncoderAppPathDisplay = _ffmpegPath ?? string.Empty;
_configurationManager.SaveConfiguration("encoding", config); _configurationManager.SaveConfiguration("encoding", config);
@ -177,7 +177,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
// Write the new ffmpeg path to the xml as <EncoderAppPath> // Write the new ffmpeg path to the xml as <EncoderAppPath>
// This ensures its not lost on next startup // This ensures its not lost on next startup
var config = _configurationManager.GetConfiguration<EncodingOptions>("encoding"); var config = _configurationManager.GetEncodingOptions();
config.EncoderAppPath = newPath; config.EncoderAppPath = newPath;
_configurationManager.SaveConfiguration("encoding", config); _configurationManager.SaveConfiguration("encoding", config);