update recordings
This commit is contained in:
parent
51f69bcb31
commit
2f2ccfe8f3
|
@ -42,5 +42,8 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
RecordingStatus Status { get; set; }
|
||||
DateTime? EndDate { get; set; }
|
||||
ChannelType ChannelType { get; set; }
|
||||
DateTime DateLastSaved { get; set; }
|
||||
DateTime DateCreated { get; set; }
|
||||
DateTime DateModified { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,6 +191,12 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
/// <value>The show identifier.</value>
|
||||
public string ShowId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date last updated.
|
||||
/// </summary>
|
||||
/// <value>The date last updated.</value>
|
||||
public DateTime DateLastUpdated { get; set; }
|
||||
|
||||
public RecordingInfo()
|
||||
{
|
||||
Genres = new List<string>();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -496,7 +496,7 @@ namespace MediaBrowser.Server.Startup.Common
|
|||
PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LogManager.GetLogger("PlaylistManager"), UserManager, ProviderManager);
|
||||
RegisterSingleInstance<IPlaylistManager>(PlaylistManager);
|
||||
|
||||
LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager);
|
||||
LiveTvManager = new LiveTvManager(this, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager);
|
||||
RegisterSingleInstance(LiveTvManager);
|
||||
|
||||
UserViewManager = new UserViewManager(LibraryManager, LocalizationManager, UserManager, ChannelManager, LiveTvManager, PlaylistManager, CollectionManager, ServerConfigurationManager);
|
||||
|
|
Loading…
Reference in New Issue
Block a user