mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-15 18:53:27 +01:00
Cleanup external item data cleanup (#14072)
This commit is contained in:
@@ -34,10 +34,12 @@ using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.MediaEncoding;
|
||||
using MediaBrowser.Controller.MediaSegments;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Controller.Sorting;
|
||||
using MediaBrowser.Controller.Trickplay;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Drawing;
|
||||
@@ -66,11 +68,11 @@ namespace Emby.Server.Implementations.Library
|
||||
private readonly ILogger<LibraryManager> _logger;
|
||||
private readonly ITaskManager _taskManager;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IUserDataManager _userDataRepository;
|
||||
private readonly IUserDataManager _userDataManager;
|
||||
private readonly IServerConfigurationManager _configurationManager;
|
||||
private readonly Lazy<ILibraryMonitor> _libraryMonitorFactory;
|
||||
private readonly Lazy<IProviderManager> _providerManagerFactory;
|
||||
private readonly Lazy<IUserViewManager> _userviewManagerFactory;
|
||||
private readonly Lazy<IUserViewManager> _userViewManagerFactory;
|
||||
private readonly IServerApplicationHost _appHost;
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
@@ -106,11 +108,11 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
/// <param name="configurationManager">The configuration manager.</param>
|
||||
/// <param name="userDataRepository">The user data repository.</param>
|
||||
/// <param name="userDataManager">The user data manager.</param>
|
||||
/// <param name="libraryMonitorFactory">The library monitor.</param>
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <param name="providerManagerFactory">The provider manager.</param>
|
||||
/// <param name="userviewManagerFactory">The userview manager.</param>
|
||||
/// <param name="userViewManagerFactory">The user view manager.</param>
|
||||
/// <param name="mediaEncoder">The media encoder.</param>
|
||||
/// <param name="itemRepository">The item repository.</param>
|
||||
/// <param name="imageProcessor">The image processor.</param>
|
||||
@@ -124,11 +126,11 @@ namespace Emby.Server.Implementations.Library
|
||||
ITaskManager taskManager,
|
||||
IUserManager userManager,
|
||||
IServerConfigurationManager configurationManager,
|
||||
IUserDataManager userDataRepository,
|
||||
IUserDataManager userDataManager,
|
||||
Lazy<ILibraryMonitor> libraryMonitorFactory,
|
||||
IFileSystem fileSystem,
|
||||
Lazy<IProviderManager> providerManagerFactory,
|
||||
Lazy<IUserViewManager> userviewManagerFactory,
|
||||
Lazy<IUserViewManager> userViewManagerFactory,
|
||||
IMediaEncoder mediaEncoder,
|
||||
IItemRepository itemRepository,
|
||||
IImageProcessor imageProcessor,
|
||||
@@ -142,11 +144,11 @@ namespace Emby.Server.Implementations.Library
|
||||
_taskManager = taskManager;
|
||||
_userManager = userManager;
|
||||
_configurationManager = configurationManager;
|
||||
_userDataRepository = userDataRepository;
|
||||
_userDataManager = userDataManager;
|
||||
_libraryMonitorFactory = libraryMonitorFactory;
|
||||
_fileSystem = fileSystem;
|
||||
_providerManagerFactory = providerManagerFactory;
|
||||
_userviewManagerFactory = userviewManagerFactory;
|
||||
_userViewManagerFactory = userViewManagerFactory;
|
||||
_mediaEncoder = mediaEncoder;
|
||||
_itemRepository = itemRepository;
|
||||
_imageProcessor = imageProcessor;
|
||||
@@ -202,7 +204,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
private IProviderManager ProviderManager => _providerManagerFactory.Value;
|
||||
|
||||
private IUserViewManager UserViewManager => _userviewManagerFactory.Value;
|
||||
private IUserViewManager UserViewManager => _userViewManagerFactory.Value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the postscan tasks.
|
||||
@@ -1889,7 +1891,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
userComparer.User = user;
|
||||
userComparer.UserManager = _userManager;
|
||||
userComparer.UserDataRepository = _userDataRepository;
|
||||
userComparer.UserDataManager = _userDataManager;
|
||||
|
||||
return userComparer;
|
||||
}
|
||||
@@ -2586,7 +2588,6 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var isFolder = episode.VideoType == VideoType.BluRay || episode.VideoType == VideoType.Dvd;
|
||||
|
||||
// TODO nullable - what are we trying to do there with empty episodeInfo?
|
||||
EpisodeInfo? episodeInfo = null;
|
||||
if (episode.IsFileProtocol)
|
||||
{
|
||||
@@ -2604,43 +2605,11 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
episodeInfo ??= new EpisodeInfo(episode.Path);
|
||||
|
||||
try
|
||||
{
|
||||
var libraryOptions = GetLibraryOptions(episode);
|
||||
if (libraryOptions.EnableEmbeddedEpisodeInfos && string.Equals(episodeInfo.Container, "mp4", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Read from metadata
|
||||
var mediaInfo = _mediaEncoder.GetMediaInfo(
|
||||
new MediaInfoRequest
|
||||
{
|
||||
MediaSource = episode.GetMediaSources(false)[0],
|
||||
MediaType = DlnaProfileType.Video
|
||||
},
|
||||
CancellationToken.None).GetAwaiter().GetResult();
|
||||
if (mediaInfo.ParentIndexNumber > 0)
|
||||
{
|
||||
episodeInfo.SeasonNumber = mediaInfo.ParentIndexNumber;
|
||||
}
|
||||
|
||||
if (mediaInfo.IndexNumber > 0)
|
||||
{
|
||||
episodeInfo.EpisodeNumber = mediaInfo.IndexNumber;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(mediaInfo.ShowName))
|
||||
{
|
||||
episodeInfo.SeriesName = mediaInfo.ShowName;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error reading the episode information with ffprobe. Episode: {EpisodeInfo}", episodeInfo.Path);
|
||||
}
|
||||
|
||||
var changed = false;
|
||||
if (episodeInfo is null)
|
||||
{
|
||||
return changed;
|
||||
}
|
||||
|
||||
if (episodeInfo.IsByDate)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user