Merge branch 'dev' into reformat
# Conflicts: # Emby.Server.Implementations/ApplicationHost.cs # Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs # Emby.Server.Implementations/LiveTv/LiveTvManager.cs # Emby.Server.Implementations/Security/MBLicenseFile.cs # Emby.Server.Implementations/Security/PluginSecurityManager.cs # Emby.Server.Implementations/Security/RegRecord.cs # MediaBrowser.Api/PluginService.cs # MediaBrowser.Api/System/SystemService.cs # MediaBrowser.Common/Security/IRequiresRegistration.cs # MediaBrowser.Common/Security/ISecurityManager.cs # MediaBrowser.Common/Security/PaymentRequiredException.cs # MediaBrowser.Model/Entities/MBRegistrationRecord.cs # MediaBrowser.Model/Entities/PluginSecurityInfo.cs # deployment/win-generic/build-jellyfin.ps1
This commit is contained in:
@@ -451,18 +451,14 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
public ChannelInfo GetChannelByNumber(string number)
|
||||
{
|
||||
ChannelInfo result = null;
|
||||
|
||||
ChannelsByNumber.TryGetValue(number, out result);
|
||||
ChannelsByNumber.TryGetValue(number, out var result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public ChannelInfo GetChannelByName(string name)
|
||||
{
|
||||
ChannelInfo result = null;
|
||||
|
||||
ChannelsByName.TryGetValue(name, out result);
|
||||
ChannelsByName.TryGetValue(name, out var result);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1178,14 +1174,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
return;
|
||||
}
|
||||
|
||||
var registration = await _liveTvManager.GetRegistrationInfo("dvr").ConfigureAwait(false);
|
||||
if (!registration.IsValid)
|
||||
{
|
||||
_logger.LogWarning("Emby Premiere required to use Emby DVR.");
|
||||
OnTimerOutOfDate(timer);
|
||||
return;
|
||||
}
|
||||
|
||||
var activeRecordingInfo = new ActiveRecordingInfo
|
||||
{
|
||||
CancellationTokenSource = new CancellationTokenSource(),
|
||||
@@ -2372,41 +2360,57 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
var allTimers = GetTimersForSeries(seriesTimer)
|
||||
.ToList();
|
||||
|
||||
var registration = await _liveTvManager.GetRegistrationInfo("seriesrecordings").ConfigureAwait(false);
|
||||
|
||||
var enabledTimersForSeries = new List<TimerInfo>();
|
||||
|
||||
if (registration.IsValid)
|
||||
foreach (var timer in allTimers)
|
||||
{
|
||||
foreach (var timer in allTimers)
|
||||
var existingTimer = _timerProvider.GetTimer(timer.Id);
|
||||
|
||||
if (existingTimer == null)
|
||||
{
|
||||
var existingTimer = _timerProvider.GetTimer(timer.Id);
|
||||
existingTimer = string.IsNullOrWhiteSpace(timer.ProgramId)
|
||||
? null
|
||||
: _timerProvider.GetTimerByProgramId(timer.ProgramId);
|
||||
}
|
||||
|
||||
if (existingTimer == null)
|
||||
if (existingTimer == null)
|
||||
{
|
||||
if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
|
||||
{
|
||||
existingTimer = string.IsNullOrWhiteSpace(timer.ProgramId)
|
||||
? null
|
||||
: _timerProvider.GetTimerByProgramId(timer.ProgramId);
|
||||
}
|
||||
|
||||
if (existingTimer == null)
|
||||
{
|
||||
if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
|
||||
{
|
||||
timer.Status = RecordingStatus.Cancelled;
|
||||
}
|
||||
else
|
||||
{
|
||||
enabledTimersForSeries.Add(timer);
|
||||
}
|
||||
_timerProvider.Add(timer);
|
||||
|
||||
if (TimerCreated != null)
|
||||
{
|
||||
TimerCreated(this, new GenericEventArgs<TimerInfo>(timer));
|
||||
}
|
||||
timer.Status = RecordingStatus.Cancelled;
|
||||
}
|
||||
else
|
||||
{
|
||||
enabledTimersForSeries.Add(timer);
|
||||
}
|
||||
_timerProvider.Add(timer);
|
||||
|
||||
TimerCreated?.Invoke(this, new GenericEventArgs<TimerInfo>(timer));
|
||||
}
|
||||
// Only update if not currently active - test both new timer and existing in case Id's are different
|
||||
// Id's could be different if the timer was created manually prior to series timer creation
|
||||
else if (!_activeRecordings.TryGetValue(timer.Id, out _) && !_activeRecordings.TryGetValue(existingTimer.Id, out _))
|
||||
{
|
||||
UpdateExistingTimerWithNewMetadata(existingTimer, timer);
|
||||
|
||||
// Needed by ShouldCancelTimerForSeriesTimer
|
||||
timer.IsManual = existingTimer.IsManual;
|
||||
|
||||
if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
|
||||
{
|
||||
existingTimer.Status = RecordingStatus.Cancelled;
|
||||
}
|
||||
else if (!existingTimer.IsManual)
|
||||
{
|
||||
existingTimer.Status = RecordingStatus.New;
|
||||
}
|
||||
|
||||
if (existingTimer.Status != RecordingStatus.Cancelled)
|
||||
{
|
||||
enabledTimersForSeries.Add(existingTimer);
|
||||
}
|
||||
|
||||
if (updateTimerSettings)
|
||||
{
|
||||
// Only update if not currently active - test both new timer and existing in case Id's are different
|
||||
// Id's could be different if the timer was created manually prior to series timer creation
|
||||
@@ -2445,6 +2449,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
_timerProvider.Update(existingTimer);
|
||||
}
|
||||
}
|
||||
|
||||
existingTimer.SeriesTimerId = seriesTimer.Id;
|
||||
_timerProvider.Update(existingTimer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2770,15 +2777,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
{
|
||||
var configuredDevice = configuredDevices.FirstOrDefault(i => string.Equals(i.DeviceId, device.DeviceId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (configuredDevice != null)
|
||||
if (configuredDevice != null && !string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
if (!string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_logger.LogInformation("Tuner url has changed from {0} to {1}", configuredDevice.Url, device.Url);
|
||||
_logger.LogInformation("Tuner url has changed from {PreviousUrl} to {NewUrl}", configuredDevice.Url, device.Url);
|
||||
|
||||
configuredDevice.Url = device.Url;
|
||||
await _liveTvManager.SaveTunerHost(configuredDevice).ConfigureAwait(false);
|
||||
}
|
||||
configuredDevice.Url = device.Url;
|
||||
await _liveTvManager.SaveTunerHost(configuredDevice).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
private readonly ITaskManager _taskManager;
|
||||
private readonly IJsonSerializer _jsonSerializer;
|
||||
private readonly IProviderManager _providerManager;
|
||||
private readonly ISecurityManager _security;
|
||||
private readonly Func<IChannelManager> _channelManager;
|
||||
|
||||
private readonly IDtoService _dtoService;
|
||||
@@ -78,7 +77,23 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
private IServerApplicationHost _appHost;
|
||||
private IHttpClient _httpClient;
|
||||
|
||||
public LiveTvManager(IServerApplicationHost appHost, IHttpClient httpClient, IServerConfigurationManager config, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager, ILocalizationManager localization, IJsonSerializer jsonSerializer, IProviderManager providerManager, IFileSystem fileSystem, ISecurityManager security, Func<IChannelManager> channelManager)
|
||||
public LiveTvManager(
|
||||
IServerApplicationHost appHost,
|
||||
IHttpClient httpClient,
|
||||
IServerConfigurationManager config,
|
||||
ILogger logger,
|
||||
IItemRepository itemRepo,
|
||||
IImageProcessor imageProcessor,
|
||||
IUserDataManager userDataManager,
|
||||
IDtoService dtoService,
|
||||
IUserManager userManager,
|
||||
ILibraryManager libraryManager,
|
||||
ITaskManager taskManager,
|
||||
ILocalizationManager localization,
|
||||
IJsonSerializer jsonSerializer,
|
||||
IProviderManager providerManager,
|
||||
IFileSystem fileSystem,
|
||||
Func<IChannelManager> channelManager)
|
||||
{
|
||||
_appHost = appHost;
|
||||
_config = config;
|
||||
@@ -91,7 +106,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_providerManager = providerManager;
|
||||
_fileSystem = fileSystem;
|
||||
_security = security;
|
||||
_dtoService = dtoService;
|
||||
_userDataManager = userDataManager;
|
||||
_channelManager = channelManager;
|
||||
@@ -2085,14 +2099,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
public async Task CreateSeriesTimer(SeriesTimerInfoDto timer, CancellationToken cancellationToken)
|
||||
{
|
||||
var registration = await GetRegistrationInfo("seriesrecordings").ConfigureAwait(false);
|
||||
|
||||
if (!registration.IsValid)
|
||||
{
|
||||
_logger.LogInformation("Creating series recordings requires an active Emby Premiere subscription.");
|
||||
return;
|
||||
}
|
||||
|
||||
var service = GetService(timer.ServiceName);
|
||||
|
||||
var info = await _tvDtoService.GetSeriesTimerInfo(timer, true, this, cancellationToken).ConfigureAwait(false);
|
||||
@@ -2434,30 +2440,6 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
}
|
||||
}
|
||||
|
||||
public Task<MBRegistrationRecord> GetRegistrationInfo(string feature)
|
||||
{
|
||||
if (string.Equals(feature, "seriesrecordings", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
feature = "embytvseriesrecordings";
|
||||
}
|
||||
|
||||
if (string.Equals(feature, "dvr-l", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var config = GetConfiguration();
|
||||
if (config.TunerHosts.Length > 0 &&
|
||||
config.ListingProviders.Count(i => (i.EnableAllTuners || i.EnabledTuners.Length > 0) && string.Equals(i.Type, SchedulesDirect.TypeName, StringComparison.OrdinalIgnoreCase)) > 0)
|
||||
{
|
||||
return Task.FromResult(new MBRegistrationRecord
|
||||
{
|
||||
IsRegistered = true,
|
||||
IsValid = true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return _security.GetRegistrationStatus(feature);
|
||||
}
|
||||
|
||||
public Task<List<ChannelInfo>> GetChannelsForListingsProvider(string id, CancellationToken cancellationToken)
|
||||
{
|
||||
var info = GetConfiguration().ListingProviders.First(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
Reference in New Issue
Block a user