added item type to refresh info
This commit is contained in:
parent
3ffd95a637
commit
7f5a4c2d4e
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
@ -56,7 +57,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
public List<string> PhysicalLocationsList { get; set; }
|
||||
|
||||
protected override IEnumerable<FileSystemInfo> GetFileSystemChildren()
|
||||
protected override IEnumerable<FileSystemInfo> GetFileSystemChildren(DirectoryService directoryService)
|
||||
{
|
||||
return CreateResolveArgs().FileSystemChildren;
|
||||
}
|
||||
|
@ -118,9 +119,9 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Get the children of this folder from the actual file system
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
protected override IEnumerable<BaseItem> GetNonCachedChildren()
|
||||
protected override IEnumerable<BaseItem> GetNonCachedChildren(DirectoryService directoryService)
|
||||
{
|
||||
return base.GetNonCachedChildren().Concat(_virtualChildren);
|
||||
return base.GetNonCachedChildren(directoryService).Concat(_virtualChildren);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
}
|
||||
|
||||
private readonly Task _cachedTask = Task.FromResult(true);
|
||||
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions)
|
||||
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, DirectoryService directoryService)
|
||||
{
|
||||
if (IsAccessedByName)
|
||||
{
|
||||
|
@ -60,17 +60,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
return _cachedTask;
|
||||
}
|
||||
|
||||
return base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions);
|
||||
}
|
||||
|
||||
public override string GetClientTypeName()
|
||||
{
|
||||
if (IsAccessedByName)
|
||||
{
|
||||
//return "Artist";
|
||||
}
|
||||
|
||||
return base.GetClientTypeName();
|
||||
return base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService);
|
||||
}
|
||||
|
||||
public MusicArtist()
|
||||
|
|
|
@ -565,8 +565,10 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
if (IsFolder || Parent != null)
|
||||
{
|
||||
options.DirectoryService = options.DirectoryService ?? new DirectoryService(Logger);
|
||||
|
||||
var files = locationType == LocationType.FileSystem || locationType == LocationType.Offline ?
|
||||
GetFileSystemChildren().ToList() :
|
||||
GetFileSystemChildren(options.DirectoryService).ToList() :
|
||||
new List<FileSystemInfo>();
|
||||
|
||||
await BeforeRefreshMetadata(options, files, cancellationToken).ConfigureAwait(false);
|
||||
|
@ -609,11 +611,11 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
protected virtual IEnumerable<FileSystemInfo> GetFileSystemChildren()
|
||||
protected virtual IEnumerable<FileSystemInfo> GetFileSystemChildren(DirectoryService directoryService)
|
||||
{
|
||||
var path = ContainingFolderPath;
|
||||
|
||||
return new DirectoryInfo(path).EnumerateFileSystemInfos("*", SearchOption.TopDirectoryOnly);
|
||||
return directoryService.GetFileSystemEntries(path);
|
||||
}
|
||||
|
||||
private async Task<bool> RefreshLocalTrailers(IHasTrailers item, MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
||||
|
@ -850,29 +852,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
return IsParentalAllowed(user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the particular item by searching through our parents and, if not found there, loading from repo
|
||||
/// </summary>
|
||||
/// <param name="id">The id.</param>
|
||||
/// <returns>BaseItem.</returns>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
protected BaseItem FindParentItem(Guid id)
|
||||
{
|
||||
if (id == Guid.Empty)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
var parent = Parent;
|
||||
while (parent != null && !parent.IsRoot)
|
||||
{
|
||||
if (parent.Id == id) return parent;
|
||||
parent = parent.Parent;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is folder.
|
||||
/// </summary>
|
||||
|
@ -1226,10 +1205,13 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <summary>
|
||||
/// Validates that images within the item are still on the file system
|
||||
/// </summary>
|
||||
public bool ValidateImages()
|
||||
public bool ValidateImages(DirectoryService directoryService)
|
||||
{
|
||||
var allDirectories = ImageInfos.Select(i => System.IO.Path.GetDirectoryName(i.Path)).Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
||||
var allFiles = allDirectories.SelectMany(directoryService.GetFiles).Select(i => i.FullName).ToList();
|
||||
|
||||
var deletedImages = ImageInfos
|
||||
.Where(image => !File.Exists(image.Path))
|
||||
.Where(image => !allFiles.Contains(image.Path, StringComparer.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
|
||||
if (deletedImages.Count > 0)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -7,7 +8,6 @@ using System.Linq;
|
|||
using System.Runtime.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
public List<string> PhysicalLocationsList { get; set; }
|
||||
|
||||
protected override IEnumerable<FileSystemInfo> GetFileSystemChildren()
|
||||
protected override IEnumerable<FileSystemInfo> GetFileSystemChildren(DirectoryService directoryService)
|
||||
{
|
||||
return CreateResolveArgs().FileSystemChildren;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <param name="refreshChildMetadata">if set to <c>true</c> [refresh child metadata].</param>
|
||||
/// <param name="refreshOptions">The refresh options.</param>
|
||||
/// <returns>Task.</returns>
|
||||
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions)
|
||||
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, DirectoryService directoryService)
|
||||
{
|
||||
CreateResolveArgs();
|
||||
ResetDynamicChildren();
|
||||
|
|
|
@ -309,15 +309,19 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <returns>Task.</returns>
|
||||
public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken, bool? recursive = null, bool forceRefreshMetadata = false)
|
||||
{
|
||||
var directoryService = new DirectoryService(Logger);
|
||||
|
||||
return ValidateChildrenWithCancellationSupport(progress, cancellationToken, recursive ?? true, true,
|
||||
|
||||
new MetadataRefreshOptions
|
||||
{
|
||||
ReplaceAllMetadata = forceRefreshMetadata
|
||||
});
|
||||
ReplaceAllMetadata = forceRefreshMetadata,
|
||||
DirectoryService = directoryService
|
||||
|
||||
}, directoryService);
|
||||
}
|
||||
|
||||
private async Task ValidateChildrenWithCancellationSupport(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions)
|
||||
private async Task ValidateChildrenWithCancellationSupport(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, DirectoryService directoryService)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
|
@ -337,7 +341,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
var linkedCancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(innerCancellationTokenSource.Token, cancellationToken);
|
||||
|
||||
await ValidateChildrenInternal(progress, linkedCancellationTokenSource.Token, recursive, refreshChildMetadata, refreshOptions).ConfigureAwait(false);
|
||||
await ValidateChildrenInternal(progress, linkedCancellationTokenSource.Token, recursive, refreshChildMetadata, refreshOptions, directoryService).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException ex)
|
||||
{
|
||||
|
@ -369,8 +373,9 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <param name="recursive">if set to <c>true</c> [recursive].</param>
|
||||
/// <param name="refreshChildMetadata">if set to <c>true</c> [refresh child metadata].</param>
|
||||
/// <param name="refreshOptions">The refresh options.</param>
|
||||
/// <param name="directoryService">The directory service.</param>
|
||||
/// <returns>Task.</returns>
|
||||
protected async virtual Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions)
|
||||
protected async virtual Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, DirectoryService directoryService)
|
||||
{
|
||||
var locationType = LocationType;
|
||||
|
||||
|
@ -384,7 +389,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
try
|
||||
{
|
||||
nonCachedChildren = GetNonCachedChildren();
|
||||
nonCachedChildren = GetNonCachedChildren(directoryService);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
|
@ -482,7 +487,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
if (recursive)
|
||||
{
|
||||
await ValidateSubFolders(ActualChildren.OfType<Folder>().ToList(), progress, cancellationToken).ConfigureAwait(false);
|
||||
await ValidateSubFolders(ActualChildren.OfType<Folder>().ToList(), directoryService, progress, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
progress.Report(20);
|
||||
|
@ -586,10 +591,11 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Refreshes the children.
|
||||
/// </summary>
|
||||
/// <param name="children">The children.</param>
|
||||
/// <param name="directoryService">The directory service.</param>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
private async Task ValidateSubFolders(IList<Folder> children, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
private async Task ValidateSubFolders(IList<Folder> children, DirectoryService directoryService, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var list = children;
|
||||
var childCount = list.Count;
|
||||
|
@ -617,7 +623,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
});
|
||||
|
||||
await child.ValidateChildrenWithCancellationSupport(innerProgress, cancellationToken, true, false, null)
|
||||
await child.ValidateChildrenWithCancellationSupport(innerProgress, cancellationToken, true, false, null, directoryService)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
@ -675,9 +681,9 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Get the children of this folder from the actual file system
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
protected virtual IEnumerable<BaseItem> GetNonCachedChildren()
|
||||
protected virtual IEnumerable<BaseItem> GetNonCachedChildren(DirectoryService directoryService)
|
||||
{
|
||||
return LibraryManager.ResolvePaths<BaseItem>(GetFileSystemChildren(), this);
|
||||
return LibraryManager.ResolvePaths<BaseItem>(GetFileSystemChildren(directoryService), this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.IO;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -108,7 +109,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <summary>
|
||||
/// Validates the images and returns true or false indicating if any were removed.
|
||||
/// </summary>
|
||||
bool ValidateImages();
|
||||
bool ValidateImages(DirectoryService directoryService);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is owned item.
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
|||
}
|
||||
}
|
||||
|
||||
private async Task<bool> RefreshSpecialFeatures(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
||||
private async Task<bool> RefreshSpecialFeatures(MetadataRefreshOptions options, IEnumerable<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
||||
{
|
||||
var newItems = LoadSpecialFeatures(fileSystemChildren).ToList();
|
||||
var newItemIds = newItems.Select(i => i.Id).ToList();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MediaBrowser.Controller.Localization;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
|
@ -11,7 +12,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
/// <summary>
|
||||
/// Class Season
|
||||
/// </summary>
|
||||
public class Season : Folder, IHasSeries
|
||||
public class Season : Folder, IHasSeries, IHasLookupInfo<SeasonInfo>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
|
@ -241,5 +242,10 @@ namespace MediaBrowser.Controller.Entities.TV
|
|||
return series == null ? null : series.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public SeasonInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<SeasonInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
|
@ -13,9 +14,9 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Get the children of this folder from the actual file system
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
protected override IEnumerable<BaseItem> GetNonCachedChildren()
|
||||
protected override IEnumerable<BaseItem> GetNonCachedChildren(DirectoryService directoryService)
|
||||
{
|
||||
return base.GetNonCachedChildren().Concat(LibraryManager.RootFolder.VirtualChildren);
|
||||
return base.GetNonCachedChildren(directoryService).Concat(LibraryManager.RootFolder.VirtualChildren);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <param name="fileSystemChildren">The file system children.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{System.Boolean}.</returns>
|
||||
private async Task<bool> RefreshAdditionalParts(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
||||
private async Task<bool> RefreshAdditionalParts(MetadataRefreshOptions options, IEnumerable<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)
|
||||
{
|
||||
var newItems = LoadAdditionalParts(fileSystemChildren).ToList();
|
||||
|
||||
|
|
|
@ -146,6 +146,7 @@
|
|||
<Compile Include="Notifications\NotificationUpdateEventArgs.cs" />
|
||||
<Compile Include="Persistence\IFileOrganizationRepository.cs" />
|
||||
<Compile Include="Persistence\MediaStreamQuery.cs" />
|
||||
<Compile Include="Providers\DirectoryService.cs" />
|
||||
<Compile Include="Providers\ICustomMetadataProvider.cs" />
|
||||
<Compile Include="Providers\IHasChangeMonitor.cs" />
|
||||
<Compile Include="Entities\IHasMetadata.cs" />
|
||||
|
|
62
MediaBrowser.Controller/Providers/DirectoryService.cs
Normal file
62
MediaBrowser.Controller/Providers/DirectoryService.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public class DirectoryService
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly Dictionary<string, List<FileSystemInfo>> _cache = new Dictionary<string, List<FileSystemInfo>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public DirectoryService(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public List<FileSystemInfo> GetFileSystemEntries(string path)
|
||||
{
|
||||
List<FileSystemInfo> entries;
|
||||
|
||||
if (!_cache.TryGetValue(path, out entries))
|
||||
{
|
||||
//_logger.Debug("Getting files for " + path);
|
||||
|
||||
entries = new DirectoryInfo(path).EnumerateFileSystemInfos("*", SearchOption.TopDirectoryOnly).ToList();
|
||||
_cache.Add(path, entries);
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public IEnumerable<FileInfo> GetFiles(string path)
|
||||
{
|
||||
return GetFileSystemEntries(path).OfType<FileInfo>();
|
||||
}
|
||||
|
||||
public IEnumerable<DirectoryInfo> GetDirectories(string path)
|
||||
{
|
||||
return GetFileSystemEntries(path).OfType<DirectoryInfo>();
|
||||
}
|
||||
|
||||
public FileInfo GetFile(string path)
|
||||
{
|
||||
var directory = Path.GetDirectoryName(path);
|
||||
var filename = Path.GetFileName(path);
|
||||
|
||||
return GetFiles(directory).FirstOrDefault(i => string.Equals(i.Name, filename, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
|
||||
public DirectoryInfo GetDirectory(string path)
|
||||
{
|
||||
var directory = Path.GetDirectoryName(path);
|
||||
var name = Path.GetFileName(path);
|
||||
|
||||
return GetDirectories(directory).FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Providers
|
|||
|
||||
public interface ILocalImageFileProvider : ILocalImageProvider
|
||||
{
|
||||
List<LocalImageInfo> GetImages(IHasImages item);
|
||||
List<LocalImageInfo> GetImages(IHasImages item, DirectoryService directoryService);
|
||||
}
|
||||
|
||||
public class LocalImageInfo
|
||||
|
|
|
@ -149,4 +149,9 @@ namespace MediaBrowser.Controller.Providers
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public class SeasonInfo : ItemLookupInfo
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
|
@ -16,6 +17,8 @@ namespace MediaBrowser.Controller.Providers
|
|||
/// </summary>
|
||||
[Obsolete]
|
||||
public bool ForceSave { get; set; }
|
||||
|
||||
public DirectoryService DirectoryService { get; set; }
|
||||
}
|
||||
|
||||
public class ImageRefreshOptions
|
||||
|
|
|
@ -18,6 +18,12 @@ namespace MediaBrowser.Controller.Providers
|
|||
/// <value>The name of the item.</value>
|
||||
public string ItemName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the item.
|
||||
/// </summary>
|
||||
/// <value>The type of the item.</value>
|
||||
public string ItemType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the series.
|
||||
/// </summary>
|
||||
|
|
|
@ -54,13 +54,13 @@ namespace MediaBrowser.Providers.All
|
|||
}
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(IHasImages item)
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, DirectoryService directoryService)
|
||||
{
|
||||
var path = _config.ApplicationPaths.GetInternalMetadataPath(item.Id);
|
||||
|
||||
try
|
||||
{
|
||||
return new LocalImageProvider().GetImages(item, path);
|
||||
return new LocalImageProvider().GetImages(item, path, directoryService);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace MediaBrowser.Providers.All
|
|||
return false;
|
||||
}
|
||||
|
||||
private IEnumerable<FileSystemInfo> GetFiles(IHasImages item, bool includeDirectories)
|
||||
private IEnumerable<FileSystemInfo> GetFiles(IHasImages item, bool includeDirectories, DirectoryService directoryService)
|
||||
{
|
||||
if (item.LocationType != LocationType.FileSystem)
|
||||
{
|
||||
|
@ -68,34 +68,34 @@ namespace MediaBrowser.Providers.All
|
|||
|
||||
if (includeDirectories)
|
||||
{
|
||||
return new DirectoryInfo(path).EnumerateFileSystemInfos("*", SearchOption.TopDirectoryOnly)
|
||||
return directoryService.GetFileSystemEntries(path)
|
||||
.Where(i => BaseItem.SupportedImageExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase) ||
|
||||
(i.Attributes & FileAttributes.Directory) == FileAttributes.Directory);
|
||||
}
|
||||
|
||||
return new DirectoryInfo(path).EnumerateFiles("*", SearchOption.TopDirectoryOnly)
|
||||
return directoryService.GetFiles(path)
|
||||
.Where(i => BaseItem.SupportedImageExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(IHasImages item)
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, DirectoryService directoryService)
|
||||
{
|
||||
var files = GetFiles(item, true).ToList();
|
||||
var files = GetFiles(item, true, directoryService).ToList();
|
||||
|
||||
var list = new List<LocalImageInfo>();
|
||||
|
||||
PopulateImages(item, list, files, true);
|
||||
PopulateImages(item, list, files, true, directoryService);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, string path)
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, string path, DirectoryService directoryService)
|
||||
{
|
||||
return GetImages(item, new[] { path });
|
||||
return GetImages(item, new[] { path }, directoryService);
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, IEnumerable<string> paths)
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, IEnumerable<string> paths, DirectoryService directoryService)
|
||||
{
|
||||
var files = paths.SelectMany(i => new DirectoryInfo(i).EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
||||
var files = paths.SelectMany(directoryService.GetFiles)
|
||||
.Where(i =>
|
||||
{
|
||||
var ext = i.Extension;
|
||||
|
@ -108,12 +108,12 @@ namespace MediaBrowser.Providers.All
|
|||
|
||||
var list = new List<LocalImageInfo>();
|
||||
|
||||
PopulateImages(item, list, files, false);
|
||||
PopulateImages(item, list, files, false, directoryService);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private void PopulateImages(IHasImages item, List<LocalImageInfo> images, List<FileSystemInfo> files, bool supportParentSeriesFiles)
|
||||
private void PopulateImages(IHasImages item, List<LocalImageInfo> images, List<FileSystemInfo> files, bool supportParentSeriesFiles, DirectoryService directoryService)
|
||||
{
|
||||
var imagePrefix = string.Empty;
|
||||
|
||||
|
@ -124,7 +124,7 @@ namespace MediaBrowser.Providers.All
|
|||
}
|
||||
|
||||
PopulatePrimaryImages(item, images, files, imagePrefix);
|
||||
PopulateBackdrops(item, images, files, imagePrefix);
|
||||
PopulateBackdrops(item, images, files, imagePrefix, directoryService);
|
||||
PopulateScreenshots(images, files, imagePrefix);
|
||||
|
||||
AddImage(files, images, imagePrefix + "logo", ImageType.Logo);
|
||||
|
@ -149,7 +149,7 @@ namespace MediaBrowser.Providers.All
|
|||
|
||||
if (season != null)
|
||||
{
|
||||
PopulateSeasonImagesFromSeriesFolder(season, images);
|
||||
PopulateSeasonImagesFromSeriesFolder(season, images, directoryService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ namespace MediaBrowser.Providers.All
|
|||
}
|
||||
}
|
||||
|
||||
private void PopulateBackdrops(IHasImages item, List<LocalImageInfo> images, List<FileSystemInfo> files, string imagePrefix)
|
||||
private void PopulateBackdrops(IHasImages item, List<LocalImageInfo> images, List<FileSystemInfo> files, string imagePrefix, DirectoryService directoryService)
|
||||
{
|
||||
PopulateBackdrops(images, files, imagePrefix, "backdrop", "backdrop", ImageType.Backdrop);
|
||||
|
||||
|
@ -208,13 +208,13 @@ namespace MediaBrowser.Providers.All
|
|||
|
||||
if (extraFanartFolder != null)
|
||||
{
|
||||
PopulateBackdropsFromExtraFanart(extraFanartFolder.FullName, images);
|
||||
PopulateBackdropsFromExtraFanart(extraFanartFolder.FullName, images, directoryService);
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo> images)
|
||||
private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo> images, DirectoryService directoryService)
|
||||
{
|
||||
var imageFiles = new DirectoryInfo(path).EnumerateFiles("*", SearchOption.TopDirectoryOnly)
|
||||
var imageFiles = directoryService.GetFiles(path)
|
||||
.Where(i =>
|
||||
{
|
||||
var extension = i.Extension;
|
||||
|
@ -262,7 +262,7 @@ namespace MediaBrowser.Providers.All
|
|||
}
|
||||
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
private void PopulateSeasonImagesFromSeriesFolder(Season season, List<LocalImageInfo> images)
|
||||
private void PopulateSeasonImagesFromSeriesFolder(Season season, List<LocalImageInfo> images, DirectoryService directoryService)
|
||||
{
|
||||
var seasonNumber = season.IndexNumber;
|
||||
|
||||
|
@ -272,7 +272,7 @@ namespace MediaBrowser.Providers.All
|
|||
return;
|
||||
}
|
||||
|
||||
var seriesFiles = GetFiles(series, false).ToList();
|
||||
var seriesFiles = GetFiles(series, false, directoryService).ToList();
|
||||
|
||||
// Try using the season name
|
||||
var prefix = season.Name.ToLower().Replace(" ", string.Empty);
|
||||
|
|
|
@ -7,8 +7,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Providers.Manager;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Providers.Books
|
||||
{
|
||||
|
|
|
@ -11,12 +11,10 @@ using MediaBrowser.Providers.Manager;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Providers.BoxSets
|
||||
{
|
||||
public class BoxSetMetadataService : MetadataService<BoxSet, ItemLookupInfo>
|
||||
public class BoxSetMetadataService : MetadataService<BoxSet, BoxSetInfo>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILocalizationManager _iLocalizationManager;
|
||||
|
|
|
@ -27,11 +27,11 @@ namespace MediaBrowser.Providers.Folders
|
|||
}
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(IHasImages item)
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, DirectoryService directoryService)
|
||||
{
|
||||
var collectionFolder = (CollectionFolder)item;
|
||||
|
||||
return new LocalImageProvider().GetImages(item, collectionFolder.PhysicalLocations);
|
||||
return new LocalImageProvider().GetImages(item, collectionFolder.PhysicalLocations, directoryService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MediaBrowser.Providers.Folders
|
|||
}
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(IHasImages item)
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, DirectoryService directoryService)
|
||||
{
|
||||
var name = _fileSystem.GetValidFilename(item.Name);
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace MediaBrowser.Providers.Folders
|
|||
|
||||
try
|
||||
{
|
||||
return new LocalImageProvider().GetImages(item, path);
|
||||
return new LocalImageProvider().GetImages(item, path, directoryService);
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
|
|
|
@ -34,13 +34,13 @@ namespace MediaBrowser.Providers.Manager
|
|||
_fileSystem = fileSystem;
|
||||
}
|
||||
|
||||
public bool ValidateImages(IHasImages item, IEnumerable<IImageProvider> providers)
|
||||
public bool ValidateImages(IHasImages item, IEnumerable<IImageProvider> providers, DirectoryService directoryService)
|
||||
{
|
||||
var hasChanges = item.ValidateImages();
|
||||
var hasChanges = item.ValidateImages(directoryService);
|
||||
|
||||
foreach (var provider in providers.OfType<ILocalImageFileProvider>())
|
||||
{
|
||||
var images = provider.GetImages(item);
|
||||
var images = provider.GetImages(item, directoryService);
|
||||
|
||||
if (MergeImages(item, images))
|
||||
{
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace MediaBrowser.Providers.Manager
|
|||
{
|
||||
result.ItemId = item.Id;
|
||||
result.ItemName = item.Name;
|
||||
result.ItemType = item.GetType().Name;
|
||||
|
||||
var series = item as IHasSeries;
|
||||
|
||||
|
@ -64,6 +65,11 @@ namespace MediaBrowser.Providers.Manager
|
|||
|
||||
public async Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
|
||||
{
|
||||
if (refreshOptions.DirectoryService == null)
|
||||
{
|
||||
refreshOptions.DirectoryService = new DirectoryService(Logger);
|
||||
}
|
||||
|
||||
var itemOfType = (TItemType)item;
|
||||
var config = GetMetadataOptions(itemOfType);
|
||||
|
||||
|
@ -81,7 +87,7 @@ namespace MediaBrowser.Providers.Manager
|
|||
try
|
||||
{
|
||||
// Always validate images and check for new locally stored ones.
|
||||
if (itemImageProvider.ValidateImages(item, allImageProviders.OfType<ILocalImageProvider>()))
|
||||
if (itemImageProvider.ValidateImages(item, allImageProviders.OfType<ILocalImageProvider>(), refreshOptions.DirectoryService))
|
||||
{
|
||||
updateType = updateType | ItemUpdateType.ImageUpdate;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
{
|
||||
public class MovieMetadataService : MetadataService<Movie, ItemLookupInfo>
|
||||
public class MovieMetadataService : MetadataService<Movie, MovieInfo>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace MediaBrowser.Providers.Movies
|
||||
{
|
||||
public class TrailerMetadataService : MetadataService<Trailer, ItemLookupInfo>
|
||||
public class TrailerMetadataService : MetadataService<Trailer, TrailerInfo>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
|
|
|
@ -7,12 +7,10 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Providers.Manager;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Providers.Music
|
||||
{
|
||||
public class AudioMetadataService : MetadataService<Audio, ItemLookupInfo>
|
||||
public class AudioMetadataService : MetadataService<Audio, SongInfo>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace MediaBrowser.Providers.People
|
||||
{
|
||||
public class PersonMetadataService : MetadataService<Person, ItemLookupInfo>
|
||||
public class PersonMetadataService : MetadataService<Person, PersonLookupInfo>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Providers.TV
|
||||
{
|
||||
|
@ -19,48 +21,84 @@ namespace MediaBrowser.Providers.TV
|
|||
return item is Episode && item.LocationType == LocationType.FileSystem;
|
||||
}
|
||||
|
||||
public List<LocalImageInfo> GetImages(IHasImages item)
|
||||
{
|
||||
var file = GetFile(item);
|
||||
|
||||
var list = new List<LocalImageInfo>();
|
||||
|
||||
if (file != null)
|
||||
{
|
||||
list.Add(new LocalImageInfo
|
||||
{
|
||||
FileInfo = file,
|
||||
Type = ImageType.Primary
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private FileInfo GetFile(IHasImages item)
|
||||
public List<LocalImageInfo> GetImages(IHasImages item, DirectoryService directoryService)
|
||||
{
|
||||
var parentPath = Path.GetDirectoryName(item.Path);
|
||||
|
||||
var parentPathFiles = directoryService.GetFileSystemEntries(parentPath);
|
||||
|
||||
var nameWithoutExtension = Path.GetFileNameWithoutExtension(item.Path);
|
||||
var thumbName = nameWithoutExtension + "-thumb";
|
||||
|
||||
var path = Path.Combine(parentPath, thumbName + ".jpg");
|
||||
var fileInfo = new FileInfo(path);
|
||||
var files = GetFilesFromParentFolder(nameWithoutExtension, parentPathFiles);
|
||||
|
||||
if (fileInfo.Exists)
|
||||
if (files.Count > 0)
|
||||
{
|
||||
return fileInfo;
|
||||
return files;
|
||||
}
|
||||
|
||||
path = Path.Combine(parentPath, "metadata", nameWithoutExtension + ".jpg");
|
||||
fileInfo = new FileInfo(path);
|
||||
var metadataPath = Path.Combine(parentPath, "metadata");
|
||||
|
||||
if (fileInfo.Exists)
|
||||
if (parentPathFiles.Any(i => string.Equals(i.FullName, metadataPath, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return fileInfo;
|
||||
return GetFilesFromParentFolder(nameWithoutExtension, directoryService.GetFiles(metadataPath));
|
||||
}
|
||||
|
||||
return null;
|
||||
return new List<LocalImageInfo>();
|
||||
}
|
||||
|
||||
private List<LocalImageInfo> GetFilesFromParentFolder(string filenameWithoutExtension, IEnumerable<FileSystemInfo> parentPathFiles)
|
||||
{
|
||||
var thumbName = filenameWithoutExtension + "-thumb";
|
||||
|
||||
return parentPathFiles
|
||||
.Where(i =>
|
||||
{
|
||||
if (BaseItem.SupportedImageExtensions.Contains(i.Extension))
|
||||
{
|
||||
var currentNameWithoutExtension = Path.GetFileNameWithoutExtension(i.Name);
|
||||
|
||||
if (string.Equals(filenameWithoutExtension, currentNameWithoutExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (string.Equals(thumbName, currentNameWithoutExtension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
.Select(i => new LocalImageInfo
|
||||
{
|
||||
FileInfo = (FileInfo)i,
|
||||
Type = ImageType.Primary
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
private List<LocalImageInfo> GetFilesFromMetadataFolder(string filenameWithoutExtension, IEnumerable<FileInfo> metadataFiles)
|
||||
{
|
||||
return metadataFiles
|
||||
.Where(i =>
|
||||
{
|
||||
if (BaseItem.SupportedImageExtensions.Contains(i.Extension))
|
||||
{
|
||||
if (string.Equals(filenameWithoutExtension, Path.GetFileNameWithoutExtension(i.Name), StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
.Select(i => new LocalImageInfo
|
||||
{
|
||||
FileInfo = i,
|
||||
Type = ImageType.Primary
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace MediaBrowser.Providers.TV
|
||||
{
|
||||
public class SeasonMetadataService : MetadataService<Season, ItemLookupInfo>
|
||||
public class SeasonMetadataService : MetadataService<Season, SeasonInfo>
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
|
|
|
@ -174,8 +174,7 @@ namespace MediaBrowser.Providers.TV
|
|||
{
|
||||
await series.RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
}, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await series.ValidateChildren(new Progress<double>(), cancellationToken, true)
|
||||
.ConfigureAwait(false);
|
||||
|
@ -469,6 +468,7 @@ namespace MediaBrowser.Providers.TV
|
|||
};
|
||||
|
||||
await series.AddChild(season, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
await season.RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
|
|
@ -194,10 +194,14 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
public bool HasChanged(IHasMetadata item, DateTime date)
|
||||
{
|
||||
if (!_config.Configuration.EnableTvDbUpdates && item.LocationType != LocationType.Virtual)
|
||||
if (item.LocationType != LocationType.Virtual)
|
||||
{
|
||||
// For non-virtual items, only enable if configured
|
||||
if (!_config.Configuration.EnableTvDbUpdates)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!item.HasImage(ImageType.Primary))
|
||||
{
|
||||
|
|
|
@ -68,7 +68,8 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
public bool HasChanged(IHasMetadata item, DateTime date)
|
||||
{
|
||||
if (!_config.Configuration.EnableTvDbUpdates && item.LocationType != LocationType.Virtual)
|
||||
// Only enable for virtual items
|
||||
if (item.LocationType != LocationType.Virtual)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -342,10 +342,14 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
public bool HasChanged(IHasMetadata item, DateTime date)
|
||||
{
|
||||
if (!_config.Configuration.EnableTvDbUpdates && item.LocationType != LocationType.Virtual)
|
||||
if (item.LocationType != LocationType.Virtual)
|
||||
{
|
||||
// For non-virtual items, only enable if configured
|
||||
if (!_config.Configuration.EnableTvDbUpdates)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var season = (Season)item;
|
||||
var series = season.Series;
|
||||
|
|
|
@ -1079,33 +1079,5 @@ namespace MediaBrowser.Providers.TV
|
|||
{
|
||||
get { return "TheTVDB"; }
|
||||
}
|
||||
|
||||
public bool HasChanged(IHasMetadata item, DateTime date)
|
||||
{
|
||||
if (!_config.Configuration.EnableTvDbUpdates)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var seriesId = item.GetProviderId(MetadataProviders.Tvdb);
|
||||
|
||||
if (!string.IsNullOrEmpty(seriesId))
|
||||
{
|
||||
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesId);
|
||||
|
||||
var seriesXmlFilename = item.GetPreferredMetadataLanguage() + ".xml";
|
||||
|
||||
var filePath = Path.Combine(seriesDataPath, seriesXmlFilename);
|
||||
|
||||
var seriesFile = new FileInfo(filePath);
|
||||
|
||||
if (!seriesFile.Exists || _fileSystem.GetLastWriteTimeUtc(seriesFile) > date)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
string[] queries = {
|
||||
|
||||
"create table if not exists MetadataStatus (ItemId GUID PRIMARY KEY, ItemName TEXT, SeriesName TEXT, DateLastMetadataRefresh datetime, DateLastImagesRefresh datetime, LastStatus TEXT, LastErrorMessage TEXT, MetadataProvidersRefreshed TEXT, ImageProvidersRefreshed TEXT)",
|
||||
"create table if not exists MetadataStatus (ItemId GUID PRIMARY KEY, ItemName TEXT, ItemType TEXT, SeriesName TEXT, DateLastMetadataRefresh datetime, DateLastImagesRefresh datetime, LastStatus TEXT, LastErrorMessage TEXT, MetadataProvidersRefreshed TEXT, ImageProvidersRefreshed TEXT)",
|
||||
"create index if not exists idx_MetadataStatus on MetadataStatus(ItemId)",
|
||||
|
||||
//pragmas
|
||||
|
@ -71,6 +71,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
{
|
||||
"ItemId",
|
||||
"ItemName",
|
||||
"ItemType",
|
||||
"SeriesName",
|
||||
"DateLastMetadataRefresh",
|
||||
"DateLastImagesRefresh",
|
||||
|
@ -144,37 +145,42 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
if (!reader.IsDBNull(2))
|
||||
{
|
||||
result.SeriesName = reader.GetString(2);
|
||||
result.ItemName = reader.GetString(2);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(3))
|
||||
{
|
||||
result.DateLastMetadataRefresh = reader.GetDateTime(3).ToUniversalTime();
|
||||
result.SeriesName = reader.GetString(3);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(4))
|
||||
{
|
||||
result.DateLastImagesRefresh = reader.GetDateTime(4).ToUniversalTime();
|
||||
result.DateLastMetadataRefresh = reader.GetDateTime(4).ToUniversalTime();
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(5))
|
||||
{
|
||||
result.LastStatus = (ProviderRefreshStatus)Enum.Parse(typeof(ProviderRefreshStatus), reader.GetString(5), true);
|
||||
result.DateLastImagesRefresh = reader.GetDateTime(5).ToUniversalTime();
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(6))
|
||||
{
|
||||
result.LastErrorMessage = reader.GetString(6);
|
||||
result.LastStatus = (ProviderRefreshStatus)Enum.Parse(typeof(ProviderRefreshStatus), reader.GetString(6), true);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(7))
|
||||
{
|
||||
result.MetadataProvidersRefreshed = reader.GetString(7).Split('|').Where(i => !string.IsNullOrEmpty(i)).Select(i => new Guid(i)).ToList();
|
||||
result.LastErrorMessage = reader.GetString(7);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(8))
|
||||
{
|
||||
result.ImageProvidersRefreshed = reader.GetString(8).Split('|').Where(i => !string.IsNullOrEmpty(i)).Select(i => new Guid(i)).ToList();
|
||||
result.MetadataProvidersRefreshed = reader.GetString(8).Split('|').Where(i => !string.IsNullOrEmpty(i)).Select(i => new Guid(i)).ToList();
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(9))
|
||||
{
|
||||
result.ImageProvidersRefreshed = reader.GetString(9).Split('|').Where(i => !string.IsNullOrEmpty(i)).Select(i => new Guid(i)).ToList();
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -199,13 +205,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
_saveStatusCommand.GetParameter(0).Value = status.ItemId;
|
||||
_saveStatusCommand.GetParameter(1).Value = status.ItemName;
|
||||
_saveStatusCommand.GetParameter(2).Value = status.SeriesName;
|
||||
_saveStatusCommand.GetParameter(3).Value = status.DateLastMetadataRefresh;
|
||||
_saveStatusCommand.GetParameter(4).Value = status.DateLastImagesRefresh;
|
||||
_saveStatusCommand.GetParameter(5).Value = status.LastStatus.ToString();
|
||||
_saveStatusCommand.GetParameter(6).Value = status.LastErrorMessage;
|
||||
_saveStatusCommand.GetParameter(7).Value = string.Join("|", status.MetadataProvidersRefreshed.ToArray());
|
||||
_saveStatusCommand.GetParameter(8).Value = string.Join("|", status.ImageProvidersRefreshed.ToArray());
|
||||
_saveStatusCommand.GetParameter(2).Value = status.ItemType;
|
||||
_saveStatusCommand.GetParameter(3).Value = status.SeriesName;
|
||||
_saveStatusCommand.GetParameter(4).Value = status.DateLastMetadataRefresh;
|
||||
_saveStatusCommand.GetParameter(5).Value = status.DateLastImagesRefresh;
|
||||
_saveStatusCommand.GetParameter(6).Value = status.LastStatus.ToString();
|
||||
_saveStatusCommand.GetParameter(7).Value = status.LastErrorMessage;
|
||||
_saveStatusCommand.GetParameter(8).Value = string.Join("|", status.MetadataProvidersRefreshed.ToArray());
|
||||
_saveStatusCommand.GetParameter(9).Value = string.Join("|", status.ImageProvidersRefreshed.ToArray());
|
||||
|
||||
_saveStatusCommand.Transaction = transaction;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user