reduce file checks during library scan
This commit is contained in:
parent
0bc3cdfab7
commit
0351c968c3
|
@ -17,7 +17,7 @@ using TagLib.IFD.Tags;
|
|||
|
||||
namespace Emby.Photos
|
||||
{
|
||||
public class PhotoProvider : ICustomMetadataProvider<Photo>, IHasItemChangeMonitor, IForcedProvider
|
||||
public class PhotoProvider : ICustomMetadataProvider<Photo>, IForcedProvider
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
|
@ -177,19 +177,5 @@ namespace Emby.Photos
|
|||
{
|
||||
get { return "Embedded Information"; }
|
||||
}
|
||||
|
||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||
{
|
||||
if (item.EnableRefreshOnDateModifiedChange && !string.IsNullOrWhiteSpace(item.Path) && item.LocationType == LocationType.FileSystem)
|
||||
{
|
||||
var file = directoryService.GetFile(item.Path);
|
||||
if (file != null && file.LastWriteTimeUtc != item.DateModified)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,23 +96,17 @@ namespace Emby.Server.Implementations.Library
|
|||
return GetMediaStreamsForItem(list);
|
||||
}
|
||||
|
||||
private List<MediaStream> GetMediaStreamsForItem(IEnumerable<MediaStream> streams)
|
||||
private List<MediaStream> GetMediaStreamsForItem(List<MediaStream> streams)
|
||||
{
|
||||
var list = streams.ToList();
|
||||
|
||||
var subtitleStreams = list
|
||||
.Where(i => i.Type == MediaStreamType.Subtitle)
|
||||
.ToList();
|
||||
|
||||
if (subtitleStreams.Count > 0)
|
||||
foreach (var stream in streams)
|
||||
{
|
||||
foreach (var subStream in subtitleStreams)
|
||||
if (stream.Type == MediaStreamType.Subtitle)
|
||||
{
|
||||
subStream.SupportsExternalStream = StreamSupportsExternalStream(subStream);
|
||||
stream.SupportsExternalStream = StreamSupportsExternalStream(stream);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
return streams;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<MediaSourceInfo>> GetPlayackMediaSources(string id, string userId, bool enablePathSubstitution, string[] supportedLiveMediaTypes, CancellationToken cancellationToken)
|
||||
|
|
|
@ -51,12 +51,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
return null;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool EnableRefreshOnDateModifiedChange
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public Guid? FindSeriesId()
|
||||
{
|
||||
return SeriesId;
|
||||
|
|
|
@ -38,12 +38,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
return SeriesPresentationUniqueKey;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool EnableRefreshOnDateModifiedChange
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public Guid? FindSeriesId()
|
||||
{
|
||||
return SeriesId;
|
||||
|
|
|
@ -28,12 +28,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
locationType != LocationType.Virtual;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool EnableRefreshOnDateModifiedChange
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsThemeMedia
|
||||
{
|
||||
|
|
|
@ -136,7 +136,8 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
Name = Name,
|
||||
Path = Path,
|
||||
RunTimeTicks = RunTimeTicks,
|
||||
Type = MediaSourceType.Placeholder
|
||||
Type = MediaSourceType.Placeholder,
|
||||
IsInfiniteStream = RunTimeTicks == null
|
||||
};
|
||||
|
||||
list.Add(info);
|
||||
|
|
|
@ -220,7 +220,6 @@
|
|||
<Compile Include="Providers\IExternalId.cs" />
|
||||
<Compile Include="Providers\IExtrasProvider.cs" />
|
||||
<Compile Include="Providers\IForcedProvider.cs" />
|
||||
<Compile Include="Providers\IHasChangeMonitor.cs" />
|
||||
<Compile Include="Entities\IHasMetadata.cs" />
|
||||
<Compile Include="Providers\IHasItemChangeMonitor.cs" />
|
||||
<Compile Include="Providers\IHasLookupInfo.cs" />
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public interface IHasChangeMonitor
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines whether the specified item has changed.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="directoryService">The directory service.</param>
|
||||
/// <param name="date">The date.</param>
|
||||
/// <returns><c>true</c> if the specified item has changed; otherwise, <c>false</c>.</returns>
|
||||
bool HasChanged(IHasMetadata item, IDirectoryService directoryService, DateTime date);
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
/// <summary>
|
||||
/// Uses ffmpeg to create video images
|
||||
/// </summary>
|
||||
public class AudioImageProvider : IDynamicImageProvider, IHasItemChangeMonitor
|
||||
public class AudioImageProvider : IDynamicImageProvider
|
||||
{
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
@ -134,19 +134,5 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
|
||||
return item.LocationType == LocationType.FileSystem && audio != null;
|
||||
}
|
||||
|
||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||
{
|
||||
if (item.EnableRefreshOnDateModifiedChange && !string.IsNullOrWhiteSpace(item.Path) && item.LocationType == LocationType.FileSystem)
|
||||
{
|
||||
var file = directoryService.GetFile(item.Path);
|
||||
if (file != null && file.LastWriteTimeUtc != item.DateModified)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
ICustomMetadataProvider<Audio>,
|
||||
ICustomMetadataProvider<AudioPodcast>,
|
||||
ICustomMetadataProvider<AudioBook>,
|
||||
IHasItemChangeMonitor,
|
||||
IHasOrder,
|
||||
IForcedProvider,
|
||||
IPreRefreshProvider
|
||||
|
@ -180,32 +179,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
return prober.Probe(item, cancellationToken);
|
||||
}
|
||||
|
||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||
{
|
||||
if (item.EnableRefreshOnDateModifiedChange && !string.IsNullOrWhiteSpace(item.Path) && item.LocationType == LocationType.FileSystem)
|
||||
{
|
||||
var file = directoryService.GetFile(item.Path);
|
||||
if (file != null && file.LastWriteTimeUtc != item.DateModified)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.SupportsLocalMetadata)
|
||||
{
|
||||
var video = item as Video;
|
||||
|
||||
if (video != null && !video.IsPlaceHolder)
|
||||
{
|
||||
return !video.SubtitleFiles
|
||||
.SequenceEqual(SubtitleResolver.GetSubtitleFiles(video, directoryService, _fileSystem, false)
|
||||
.OrderBy(i => i), StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int Order
|
||||
{
|
||||
get
|
||||
|
|
|
@ -16,7 +16,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace MediaBrowser.Providers.MediaInfo
|
||||
{
|
||||
public class VideoImageProvider : IDynamicImageProvider, IHasItemChangeMonitor, IHasOrder
|
||||
public class VideoImageProvider : IDynamicImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IMediaEncoder _mediaEncoder;
|
||||
private readonly ILogger _logger;
|
||||
|
@ -149,19 +149,5 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasChanged(IHasMetadata item, IDirectoryService directoryService)
|
||||
{
|
||||
if (item.EnableRefreshOnDateModifiedChange && !string.IsNullOrWhiteSpace(item.Path) && item.LocationType == LocationType.FileSystem)
|
||||
{
|
||||
var file = directoryService.GetFile(item.Path);
|
||||
if (file != null && file.LastWriteTimeUtc != item.DateModified)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user