Rename providers to be more generic

This commit is contained in:
Shadowghost 2022-03-29 17:06:30 +02:00
parent 61fa325ef0
commit e6c6482b9e
2 changed files with 10 additions and 11 deletions

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -22,14 +21,14 @@ using TagLib;
namespace MediaBrowser.Providers.MediaInfo namespace MediaBrowser.Providers.MediaInfo
{ {
public class FFProbeAudioInfo public class AudioFileProber
{ {
private readonly IMediaEncoder _mediaEncoder; private readonly IMediaEncoder _mediaEncoder;
private readonly IItemRepository _itemRepo; private readonly IItemRepository _itemRepo;
private readonly ILibraryManager _libraryManager; private readonly ILibraryManager _libraryManager;
private readonly IMediaSourceManager _mediaSourceManager; private readonly IMediaSourceManager _mediaSourceManager;
public FFProbeAudioInfo( public AudioFileProber(
IMediaSourceManager mediaSourceManager, IMediaSourceManager mediaSourceManager,
IMediaEncoder mediaEncoder, IMediaEncoder mediaEncoder,
IItemRepository itemRepo, IItemRepository itemRepo,
@ -170,7 +169,7 @@ namespace MediaBrowser.Providers.MediaInfo
audio.Album = tags.Album; audio.Album = tags.Album;
audio.IndexNumber = Convert.ToInt32(tags.Track); audio.IndexNumber = Convert.ToInt32(tags.Track);
audio.ParentIndexNumber = Convert.ToInt32(tags.Disc); audio.ParentIndexNumber = Convert.ToInt32(tags.Disc);
if(tags.Year != 0) if (tags.Year != 0)
{ {
var year = Convert.ToInt32(tags.Year); var year = Convert.ToInt32(tags.Year);
audio.ProductionYear = year; audio.ProductionYear = year;

View File

@ -27,7 +27,7 @@ using Microsoft.Extensions.Logging;
namespace MediaBrowser.Providers.MediaInfo namespace MediaBrowser.Providers.MediaInfo
{ {
public class FFProbeProvider : ICustomMetadataProvider<Episode>, public class ProbeProvider : ICustomMetadataProvider<Episode>,
ICustomMetadataProvider<MusicVideo>, ICustomMetadataProvider<MusicVideo>,
ICustomMetadataProvider<Movie>, ICustomMetadataProvider<Movie>,
ICustomMetadataProvider<Trailer>, ICustomMetadataProvider<Trailer>,
@ -39,14 +39,14 @@ namespace MediaBrowser.Providers.MediaInfo
IPreRefreshProvider, IPreRefreshProvider,
IHasItemChangeMonitor IHasItemChangeMonitor
{ {
private readonly ILogger<FFProbeProvider> _logger; private readonly ILogger<ProbeProvider> _logger;
private readonly AudioResolver _audioResolver; private readonly AudioResolver _audioResolver;
private readonly SubtitleResolver _subtitleResolver; private readonly SubtitleResolver _subtitleResolver;
private readonly FFProbeVideoInfo _videoProber; private readonly FFProbeVideoInfo _videoProber;
private readonly FFProbeAudioInfo _audioProber; private readonly AudioFileProber _audioProber;
private readonly Task<ItemUpdateType> _cachedTask = Task.FromResult(ItemUpdateType.None); private readonly Task<ItemUpdateType> _cachedTask = Task.FromResult(ItemUpdateType.None);
public FFProbeProvider( public ProbeProvider(
IMediaSourceManager mediaSourceManager, IMediaSourceManager mediaSourceManager,
IMediaEncoder mediaEncoder, IMediaEncoder mediaEncoder,
IItemRepository itemRepo, IItemRepository itemRepo,
@ -61,7 +61,8 @@ namespace MediaBrowser.Providers.MediaInfo
ILoggerFactory loggerFactory, ILoggerFactory loggerFactory,
NamingOptions namingOptions) NamingOptions namingOptions)
{ {
_logger = loggerFactory.CreateLogger<FFProbeProvider>(); _logger = loggerFactory.CreateLogger<ProbeProvider>();
_audioProber = new AudioFileProber(mediaSourceManager, mediaEncoder, itemRepo, libraryManager);
_audioResolver = new AudioResolver(loggerFactory.CreateLogger<AudioResolver>(), localization, mediaEncoder, fileSystem, namingOptions); _audioResolver = new AudioResolver(loggerFactory.CreateLogger<AudioResolver>(), localization, mediaEncoder, fileSystem, namingOptions);
_subtitleResolver = new SubtitleResolver(loggerFactory.CreateLogger<SubtitleResolver>(), localization, mediaEncoder, fileSystem, namingOptions); _subtitleResolver = new SubtitleResolver(loggerFactory.CreateLogger<SubtitleResolver>(), localization, mediaEncoder, fileSystem, namingOptions);
_videoProber = new FFProbeVideoInfo( _videoProber = new FFProbeVideoInfo(
@ -78,10 +79,9 @@ namespace MediaBrowser.Providers.MediaInfo
libraryManager, libraryManager,
_audioResolver, _audioResolver,
_subtitleResolver); _subtitleResolver);
_audioProber = new FFProbeAudioInfo(mediaSourceManager, mediaEncoder, itemRepo, libraryManager);
} }
public string Name => "ffprobe"; public string Name => "filemetadataprober";
// Run last // Run last
public int Order => 100; public int Order => 100;