mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 01:54:42 +01:00
update recordings
This commit is contained in:
@@ -576,6 +576,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
recording.Path = recordPath;
|
||||
recording.Status = RecordingStatus.InProgress;
|
||||
recording.DateLastUpdated = DateTime.UtcNow;
|
||||
_recordingProvider.Update(recording);
|
||||
|
||||
try
|
||||
@@ -598,7 +599,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
_logger.Info("Recording cancelled");
|
||||
_logger.Info("Recording stopped");
|
||||
recording.Status = RecordingStatus.Completed;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -607,6 +608,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
|
||||
recording.Status = RecordingStatus.Error;
|
||||
}
|
||||
|
||||
recording.DateLastUpdated = DateTime.UtcNow;
|
||||
_recordingProvider.Update(recording);
|
||||
_timerProvider.Delete(timer);
|
||||
_logger.Info("Recording was a success");
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using MediaBrowser.Common;
|
||||
using System.IO;
|
||||
using MediaBrowser.Common;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.IO;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
@@ -61,8 +63,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
|
||||
private readonly List<ITunerHost> _tunerHosts = new List<ITunerHost>();
|
||||
private readonly List<IListingsProvider> _listingProviders = new List<IListingsProvider>();
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
||||
public LiveTvManager(IApplicationHost appHost, IServerConfigurationManager config, ILogger logger, IItemRepository itemRepo, IImageProcessor imageProcessor, IUserDataManager userDataManager, IDtoService dtoService, IUserManager userManager, ILibraryManager libraryManager, ITaskManager taskManager, ILocalizationManager localization, IJsonSerializer jsonSerializer, IProviderManager providerManager)
|
||||
public LiveTvManager(IApplicationHost appHost, 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)
|
||||
{
|
||||
_config = config;
|
||||
_logger = logger;
|
||||
@@ -73,6 +76,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
_localization = localization;
|
||||
_jsonSerializer = jsonSerializer;
|
||||
_providerManager = providerManager;
|
||||
_fileSystem = fileSystem;
|
||||
_dtoService = dtoService;
|
||||
_userDataManager = userDataManager;
|
||||
|
||||
@@ -729,6 +733,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
if (!string.IsNullOrEmpty(info.Path))
|
||||
{
|
||||
item.Path = info.Path;
|
||||
var fileInfo = new FileInfo(info.Path);
|
||||
|
||||
recording.DateCreated = _fileSystem.GetCreationTimeUtc(fileInfo);
|
||||
recording.DateModified = _fileSystem.GetLastWriteTimeUtc(fileInfo);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(info.Url))
|
||||
{
|
||||
@@ -741,7 +749,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
|
||||
{
|
||||
await _libraryManager.CreateItem(item, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
else if (pathChanged)
|
||||
else if (pathChanged || info.DateLastUpdated > recording.DateLastSaved)
|
||||
{
|
||||
await _libraryManager.UpdateItem(item, ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user