From 159a244654aa533a149fe00636c9c8e8fa5d2c01 Mon Sep 17 00:00:00 2001 From: SenorSmartyPants Date: Sat, 19 Nov 2022 14:14:41 -0600 Subject: [PATCH 1/2] Add Options to disable DVR NFO and image saving - SaveRecordingNFO and SaveRecordingImages default to true. Maintains current behavior. - Episode.FillMissingEpisodeNumbersFromPath for live tv so external metadata can be pulled when recording starts. --- .../LiveTv/EmbyTV/EmbyTV.cs | 28 +++++++++++-------- .../Entities/TV/Episode.cs | 2 +- MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 4 +++ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index a0ae328a47..6739c10c1e 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1814,21 +1814,27 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV program.AddGenre("News"); } - if (timer.IsProgramSeries) + if (GetConfiguration().SaveRecordingNFO) { - await SaveSeriesNfoAsync(timer, seriesPath).ConfigureAwait(false); - await SaveVideoNfoAsync(timer, recordingPath, program, false).ConfigureAwait(false); - } - else if (!timer.IsMovie || timer.IsSports || timer.IsNews) - { - await SaveVideoNfoAsync(timer, recordingPath, program, true).ConfigureAwait(false); + if (timer.IsProgramSeries) + { + await SaveSeriesNfoAsync(timer, seriesPath).ConfigureAwait(false); + await SaveVideoNfoAsync(timer, recordingPath, program, false).ConfigureAwait(false); + } + else if (!timer.IsMovie || timer.IsSports || timer.IsNews) + { + await SaveVideoNfoAsync(timer, recordingPath, program, true).ConfigureAwait(false); + } + else + { + await SaveVideoNfoAsync(timer, recordingPath, program, false).ConfigureAwait(false); + } } - else + + if (GetConfiguration().SaveRecordingImages) { - await SaveVideoNfoAsync(timer, recordingPath, program, false).ConfigureAwait(false); + await SaveRecordingImages(recordingPath, program).ConfigureAwait(false); } - - await SaveRecordingImages(recordingPath, program).ConfigureAwait(false); } catch (Exception ex) { diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 15b721fe63..285d3ef085 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -320,7 +320,7 @@ namespace MediaBrowser.Controller.Entities.TV if (!IsLocked) { - if (SourceType == SourceType.Library) + if (SourceType == SourceType.Library || SourceType == SourceType.LiveTV) { try { diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index 4cece941cf..25e5c77969 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -40,5 +40,9 @@ namespace MediaBrowser.Model.LiveTv public string RecordingPostProcessor { get; set; } public string RecordingPostProcessorArguments { get; set; } + + public bool SaveRecordingNFO { get; set; } = true; + + public bool SaveRecordingImages { get; set; } = true; } } From 8f4ac1cb811ac4d62512149a5feb01703004b058 Mon Sep 17 00:00:00 2001 From: SenorSmartyPants Date: Sun, 27 Nov 2022 13:13:11 -0600 Subject: [PATCH 2/2] Call GetConfiguration just once in function --- Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 6739c10c1e..f27978a449 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1814,7 +1814,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV program.AddGenre("News"); } - if (GetConfiguration().SaveRecordingNFO) + var config = GetConfiguration(); + + if (config.SaveRecordingNFO) { if (timer.IsProgramSeries) { @@ -1831,7 +1833,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV } } - if (GetConfiguration().SaveRecordingImages) + if (config.SaveRecordingImages) { await SaveRecordingImages(recordingPath, program).ConfigureAwait(false); }