mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
New provider system. Only for people right now
This commit is contained in:
@@ -18,17 +18,17 @@ namespace MediaBrowser.Controller.Drawing
|
||||
/// <param name="image">The image.</param>
|
||||
/// <param name="toStream">To stream.</param>
|
||||
/// <param name="quality">The quality.</param>
|
||||
public static void Save(this Image image, ImageFormat outputFormat, Stream toStream, int quality)
|
||||
public static void Save(this Image image, System.Drawing.Imaging.ImageFormat outputFormat, Stream toStream, int quality)
|
||||
{
|
||||
// Use special save methods for jpeg and png that will result in a much higher quality image
|
||||
// All other formats use the generic Image.Save
|
||||
if (ImageFormat.Jpeg.Equals(outputFormat))
|
||||
if (System.Drawing.Imaging.ImageFormat.Jpeg.Equals(outputFormat))
|
||||
{
|
||||
SaveAsJpeg(image, toStream, quality);
|
||||
}
|
||||
else if (ImageFormat.Png.Equals(outputFormat))
|
||||
else if (System.Drawing.Imaging.ImageFormat.Png.Equals(outputFormat))
|
||||
{
|
||||
image.Save(toStream, ImageFormat.Png);
|
||||
image.Save(toStream, System.Drawing.Imaging.ImageFormat.Png);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
11
MediaBrowser.Controller/Drawing/ImageFormat.cs
Normal file
11
MediaBrowser.Controller/Drawing/ImageFormat.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
namespace MediaBrowser.Controller.Drawing
|
||||
{
|
||||
public enum ImageFormat
|
||||
{
|
||||
Jpg,
|
||||
Png,
|
||||
Gif,
|
||||
Bmp
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// Class BaseItem
|
||||
/// </summary>
|
||||
public abstract class BaseItem : IHasProviderIds, ILibraryItem, IHasImages, IHasUserData
|
||||
public abstract class BaseItem : IHasProviderIds, ILibraryItem, IHasImages, IHasUserData, IHasMetadata
|
||||
{
|
||||
protected BaseItem()
|
||||
{
|
||||
@@ -767,25 +767,35 @@ namespace MediaBrowser.Controller.Entities
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool resetResolveArgs = true)
|
||||
{
|
||||
return RefreshMetadata(new MetadataRefreshOptions { ResetResolveArgs = resetResolveArgs }, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the base implementation to refresh metadata for local trailers
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="forceSave">if set to <c>true</c> [is new item].</param>
|
||||
/// <param name="forceRefresh">if set to <c>true</c> [force].</param>
|
||||
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
||||
/// <param name="resetResolveArgs">if set to <c>true</c> [reset resolve args].</param>
|
||||
/// <returns>true if a provider reports we changed</returns>
|
||||
public virtual async Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true, bool resetResolveArgs = true)
|
||||
public async Task<bool> RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
|
||||
{
|
||||
if (resetResolveArgs)
|
||||
if (options.ResetResolveArgs)
|
||||
{
|
||||
// Reload this
|
||||
ResetResolveArgs();
|
||||
}
|
||||
|
||||
await ProviderManager.RefreshMetadata(this, options, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
public virtual async Task<bool> RefreshMetadataDirect(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
|
||||
{
|
||||
// Refresh for the item
|
||||
var itemRefreshTask = ProviderManager.ExecuteMetadataProviders(this, cancellationToken, forceRefresh, allowSlowProviders);
|
||||
var itemRefreshTask = ProviderManager.ExecuteMetadataProviders(this, cancellationToken, forceRefresh);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
@@ -800,15 +810,15 @@ namespace MediaBrowser.Controller.Entities
|
||||
var hasThemeMedia = this as IHasThemeMedia;
|
||||
if (hasThemeMedia != null)
|
||||
{
|
||||
themeSongsChanged = await RefreshThemeSongs(hasThemeMedia, cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false);
|
||||
themeSongsChanged = await RefreshThemeSongs(hasThemeMedia, cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
|
||||
|
||||
themeVideosChanged = await RefreshThemeVideos(hasThemeMedia, cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false);
|
||||
themeVideosChanged = await RefreshThemeVideos(hasThemeMedia, cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var hasTrailers = this as IHasTrailers;
|
||||
if (hasTrailers != null)
|
||||
{
|
||||
localTrailersChanged = await RefreshLocalTrailers(hasTrailers, cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false);
|
||||
localTrailersChanged = await RefreshLocalTrailers(hasTrailers, cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,14 +839,20 @@ namespace MediaBrowser.Controller.Entities
|
||||
return changed;
|
||||
}
|
||||
|
||||
private async Task<bool> RefreshLocalTrailers(IHasTrailers item, CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true)
|
||||
private async Task<bool> RefreshLocalTrailers(IHasTrailers item, CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
|
||||
{
|
||||
var newItems = LoadLocalTrailers().ToList();
|
||||
var newItemIds = newItems.Select(i => i.Id).ToList();
|
||||
|
||||
var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds);
|
||||
|
||||
var tasks = newItems.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs: false));
|
||||
var tasks = newItems.Select(i => i.RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = forceSave,
|
||||
ReplaceAllMetadata = forceRefresh,
|
||||
ResetResolveArgs = false
|
||||
|
||||
}, cancellationToken));
|
||||
|
||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
@@ -845,14 +861,20 @@ namespace MediaBrowser.Controller.Entities
|
||||
return itemsChanged || results.Contains(true);
|
||||
}
|
||||
|
||||
private async Task<bool> RefreshThemeVideos(IHasThemeMedia item, CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true)
|
||||
private async Task<bool> RefreshThemeVideos(IHasThemeMedia item, CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
|
||||
{
|
||||
var newThemeVideos = LoadThemeVideos().ToList();
|
||||
var newThemeVideoIds = newThemeVideos.Select(i => i.Id).ToList();
|
||||
|
||||
var themeVideosChanged = !item.ThemeVideoIds.SequenceEqual(newThemeVideoIds);
|
||||
|
||||
var tasks = newThemeVideos.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs: false));
|
||||
var tasks = newThemeVideos.Select(i => i.RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = forceSave,
|
||||
ReplaceAllMetadata = forceRefresh,
|
||||
ResetResolveArgs = false
|
||||
|
||||
}, cancellationToken));
|
||||
|
||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
@@ -864,14 +886,20 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// Refreshes the theme songs.
|
||||
/// </summary>
|
||||
private async Task<bool> RefreshThemeSongs(IHasThemeMedia item, CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true)
|
||||
private async Task<bool> RefreshThemeSongs(IHasThemeMedia item, CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
|
||||
{
|
||||
var newThemeSongs = LoadThemeSongs().ToList();
|
||||
var newThemeSongIds = newThemeSongs.Select(i => i.Id).ToList();
|
||||
|
||||
var themeSongsChanged = !item.ThemeSongIds.SequenceEqual(newThemeSongIds);
|
||||
|
||||
var tasks = newThemeSongs.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs: false));
|
||||
var tasks = newThemeSongs.Select(i => i.RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = forceSave,
|
||||
ReplaceAllMetadata = forceRefresh,
|
||||
ResetResolveArgs = false
|
||||
|
||||
}, cancellationToken));
|
||||
|
||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
@@ -1456,7 +1484,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
// Refresh metadata
|
||||
// Need to disable slow providers or the image might get re-downloaded
|
||||
return RefreshMetadata(CancellationToken.None, forceSave: true, allowSlowProviders: false);
|
||||
return RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = true,
|
||||
ImageRefreshMode = MetadataRefreshMode.None,
|
||||
MetadataRefreshMode = MetadataRefreshMode.None
|
||||
|
||||
}, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1482,8 +1516,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// Validates that images within the item are still on the file system
|
||||
/// </summary>
|
||||
public void ValidateImages()
|
||||
public bool ValidateImages()
|
||||
{
|
||||
var changed = false;
|
||||
|
||||
// Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below
|
||||
var deletedKeys = Images
|
||||
.Where(image => !File.Exists(image.Value))
|
||||
@@ -1494,14 +1530,28 @@ namespace MediaBrowser.Controller.Entities
|
||||
foreach (var key in deletedKeys)
|
||||
{
|
||||
Images.Remove(key);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (ValidateBackdrops())
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
if (ValidateScreenshots())
|
||||
{
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates that backdrops within the item are still on the file system
|
||||
/// </summary>
|
||||
public void ValidateBackdrops()
|
||||
private bool ValidateBackdrops()
|
||||
{
|
||||
var changed = false;
|
||||
|
||||
// Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below
|
||||
var deletedImages = BackdropImagePaths
|
||||
.Where(path => !File.Exists(path))
|
||||
@@ -1513,7 +1563,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
BackdropImagePaths.Remove(path);
|
||||
|
||||
RemoveImageSourceForPath(path);
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1593,9 +1647,16 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// Validates the screenshots.
|
||||
/// </summary>
|
||||
public void ValidateScreenshots()
|
||||
private bool ValidateScreenshots()
|
||||
{
|
||||
var hasScreenshots = (IHasScreenshots)this;
|
||||
var changed = false;
|
||||
|
||||
var hasScreenshots = this as IHasScreenshots;
|
||||
|
||||
if (hasScreenshots == null)
|
||||
{
|
||||
return changed;
|
||||
}
|
||||
|
||||
// Only validate paths from the same directory - need to copy to a list because we are going to potentially modify the collection below
|
||||
var deletedImages = hasScreenshots.ScreenshotImagePaths
|
||||
@@ -1606,7 +1667,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
foreach (var path in deletedImages)
|
||||
{
|
||||
hasScreenshots.ScreenshotImagePaths.Remove(path);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1699,7 +1763,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
FileSystem.SwapFiles(file1, file2);
|
||||
|
||||
// Directory watchers should repeat this, but do a quick refresh first
|
||||
return RefreshMetadata(CancellationToken.None, forceSave: true, allowSlowProviders: false);
|
||||
return RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = true,
|
||||
MetadataRefreshMode = MetadataRefreshMode.None
|
||||
|
||||
}, CancellationToken.None);
|
||||
}
|
||||
|
||||
public virtual bool IsPlayed(User user)
|
||||
|
||||
@@ -3,6 +3,7 @@ using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Localization;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MoreLinq;
|
||||
@@ -535,7 +536,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
try
|
||||
{
|
||||
//refresh it
|
||||
await child.RefreshMetadata(cancellationToken, forceSave: currentTuple.Item2, forceRefresh: forceRefreshMetadata, resetResolveArgs: false).ConfigureAwait(false);
|
||||
await child.RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = currentTuple.Item2,
|
||||
ReplaceAllMetadata = forceRefreshMetadata,
|
||||
ResetResolveArgs = false
|
||||
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
@@ -907,9 +914,9 @@ namespace MediaBrowser.Controller.Entities
|
||||
return item;
|
||||
}
|
||||
|
||||
public override async Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true, bool resetResolveArgs = true)
|
||||
public override async Task<bool> RefreshMetadataDirect(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
|
||||
{
|
||||
var changed = await base.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs).ConfigureAwait(false);
|
||||
var changed = await base.RefreshMetadataDirect(cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
|
||||
|
||||
return (SupportsShortcutChildren && LocationType == LocationType.FileSystem && RefreshLinkedChildren()) || changed;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
@@ -10,7 +11,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; }
|
||||
string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the path.
|
||||
@@ -24,6 +25,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The identifier.</value>
|
||||
Guid Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the location.
|
||||
/// </summary>
|
||||
/// <value>The type of the location.</value>
|
||||
LocationType LocationType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image path.
|
||||
/// </summary>
|
||||
@@ -81,6 +88,24 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetPreferredMetadataLanguage();
|
||||
|
||||
/// <summary>
|
||||
/// Validates the images and returns true or false indicating if any were removed.
|
||||
/// </summary>
|
||||
bool ValidateImages();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the backdrop image paths.
|
||||
/// </summary>
|
||||
/// <value>The backdrop image paths.</value>
|
||||
List<string> BackdropImagePaths { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [contains image with source URL] [the specified URL].
|
||||
/// </summary>
|
||||
/// <param name="url">The URL.</param>
|
||||
/// <returns><c>true</c> if [contains image with source URL] [the specified URL]; otherwise, <c>false</c>.</returns>
|
||||
bool ContainsImageWithSourceUrl(string url);
|
||||
}
|
||||
|
||||
public static class HasImagesExtensions
|
||||
|
||||
@@ -14,8 +14,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
List<string> ScreenshotImagePaths { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Validates the screenshots.
|
||||
/// Determines whether [contains image with source URL] [the specified URL].
|
||||
/// </summary>
|
||||
void ValidateScreenshots();
|
||||
/// <param name="url">The URL.</param>
|
||||
/// <returns><c>true</c> if [contains image with source URL] [the specified URL]; otherwise, <c>false</c>.</returns>
|
||||
bool ContainsImageWithSourceUrl(string url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -108,13 +109,11 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="forceSave">if set to <c>true</c> [is new item].</param>
|
||||
/// <param name="forceRefresh">if set to <c>true</c> [force].</param>
|
||||
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
||||
/// <param name="resetResolveArgs">The reset resolve args.</param>
|
||||
/// <returns>Task{System.Boolean}.</returns>
|
||||
public override async Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true, bool resetResolveArgs = true)
|
||||
public override async Task<bool> RefreshMetadataDirect(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
|
||||
{
|
||||
// Kick off a task to refresh the main item
|
||||
var result = await base.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs).ConfigureAwait(false);
|
||||
var result = await base.RefreshMetadataDirect(cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
|
||||
|
||||
var specialFeaturesChanged = false;
|
||||
|
||||
@@ -122,7 +121,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
// In other words, it must be part of the Parent/Child tree
|
||||
if (LocationType == LocationType.FileSystem && Parent != null && !IsInMixedFolder)
|
||||
{
|
||||
specialFeaturesChanged = await RefreshSpecialFeatures(cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false);
|
||||
specialFeaturesChanged = await RefreshSpecialFeatures(cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return specialFeaturesChanged || result;
|
||||
@@ -135,7 +134,13 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
|
||||
var itemsChanged = !SpecialFeatureIds.SequenceEqual(newItemIds);
|
||||
|
||||
var tasks = newItems.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs: false));
|
||||
var tasks = newItems.Select(i => i.RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = forceSave,
|
||||
ReplaceAllMetadata = forceRefresh,
|
||||
ResetResolveArgs = false
|
||||
|
||||
}, cancellationToken));
|
||||
|
||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Serialization;
|
||||
using System;
|
||||
@@ -212,7 +213,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
// Kick off a task to validate the media library
|
||||
Task.Run(() => ValidateMediaLibrary(new Progress<double>(), CancellationToken.None));
|
||||
|
||||
return RefreshMetadata(CancellationToken.None, forceSave: true, forceRefresh: true);
|
||||
return RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = true,
|
||||
ReplaceAllMetadata = true
|
||||
|
||||
}, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -275,17 +281,13 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="forceSave">if set to <c>true</c> [is new item].</param>
|
||||
/// <param name="forceRefresh">if set to <c>true</c> [force].</param>
|
||||
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
||||
/// <returns>true if a provider reports we changed</returns>
|
||||
public override async Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true, bool resetResolveArgs = true)
|
||||
public override async Task<bool> RefreshMetadataDirect(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
|
||||
{
|
||||
if (resetResolveArgs)
|
||||
{
|
||||
// Reload this
|
||||
ResetResolveArgs();
|
||||
}
|
||||
// Reload this
|
||||
ResetResolveArgs();
|
||||
|
||||
var updateReason = await ProviderManager.ExecuteMetadataProviders(this, cancellationToken, forceRefresh, allowSlowProviders).ConfigureAwait(false);
|
||||
var updateReason = await ProviderManager.ExecuteMetadataProviders(this, cancellationToken, forceRefresh).ConfigureAwait(false);
|
||||
|
||||
var changed = updateReason.HasValue;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
@@ -164,13 +165,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="forceSave">if set to <c>true</c> [is new item].</param>
|
||||
/// <param name="forceRefresh">if set to <c>true</c> [force].</param>
|
||||
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
||||
/// <param name="resetResolveArgs">The reset resolve args.</param>
|
||||
/// <returns>true if a provider reports we changed</returns>
|
||||
public override async Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true, bool resetResolveArgs = true)
|
||||
public override async Task<bool> RefreshMetadataDirect(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
|
||||
{
|
||||
// Kick off a task to refresh the main item
|
||||
var result = await base.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders, resetResolveArgs).ConfigureAwait(false);
|
||||
var result = await base.RefreshMetadataDirect(cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
|
||||
|
||||
var additionalPartsChanged = false;
|
||||
|
||||
@@ -181,7 +180,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
try
|
||||
{
|
||||
additionalPartsChanged = await RefreshAdditionalParts(cancellationToken, forceSave, forceRefresh, allowSlowProviders).ConfigureAwait(false);
|
||||
additionalPartsChanged = await RefreshAdditionalParts(cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
@@ -208,7 +207,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var itemsChanged = !AdditionalPartIds.SequenceEqual(newItemIds);
|
||||
|
||||
var tasks = newItems.Select(i => i.RefreshMetadata(cancellationToken, forceSave, forceRefresh, allowSlowProviders));
|
||||
var tasks = newItems.Select(i => i.RefreshMetadata(new MetadataRefreshOptions
|
||||
{
|
||||
ForceSave = forceSave,
|
||||
ReplaceAllMetadata = forceRefresh
|
||||
|
||||
}, cancellationToken));
|
||||
|
||||
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -11,8 +12,6 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
|
||||
string MediaType { get; }
|
||||
|
||||
LocationType LocationType { get; }
|
||||
|
||||
RecordingInfo RecordingInfo { get; set; }
|
||||
|
||||
string GetClientTypeName();
|
||||
@@ -21,6 +20,6 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
|
||||
bool IsParentalAllowed(User user);
|
||||
|
||||
Task<bool> RefreshMetadata(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false, bool allowSlowProviders = true, bool resetResolveArgs = true);
|
||||
Task<bool> RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Controller.LiveTv
|
||||
{
|
||||
@@ -14,6 +15,6 @@ namespace MediaBrowser.Controller.LiveTv
|
||||
/// Gets or sets the type of the MIME.
|
||||
/// </summary>
|
||||
/// <value>The type of the MIME.</value>
|
||||
public string MimeType { get; set; }
|
||||
public ImageFormat Format { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
<Link>Properties\SharedVersion.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Drawing\IImageProcessor.cs" />
|
||||
<Compile Include="Drawing\ImageFormat.cs" />
|
||||
<Compile Include="Drawing\ImageProcessingOptions.cs" />
|
||||
<Compile Include="Dto\IDtoService.cs" />
|
||||
<Compile Include="Entities\AdultVideo.cs" />
|
||||
@@ -143,8 +144,15 @@
|
||||
<Compile Include="Persistence\IFileOrganizationRepository.cs" />
|
||||
<Compile Include="Persistence\MediaStreamQuery.cs" />
|
||||
<Compile Include="Providers\IDynamicInfoProvider.cs" />
|
||||
<Compile Include="Providers\IHasMetadata.cs" />
|
||||
<Compile Include="Providers\IImageProvider.cs" />
|
||||
<Compile Include="Providers\IRemoteImageProvider.cs" />
|
||||
<Compile Include="Providers\ILocalImageProvider.cs" />
|
||||
<Compile Include="Providers\IMetadataProvider.cs" />
|
||||
<Compile Include="Providers\IMetadataService.cs" />
|
||||
<Compile Include="Providers\MetadataRefreshOptions.cs" />
|
||||
<Compile Include="Providers\NameParser.cs" />
|
||||
<Compile Include="Providers\ProviderResult.cs" />
|
||||
<Compile Include="Session\ISessionManager.cs" />
|
||||
<Compile Include="Drawing\ImageExtensions.cs" />
|
||||
<Compile Include="Entities\AggregateFolder.cs" />
|
||||
|
||||
31
MediaBrowser.Controller/Providers/IHasMetadata.cs
Normal file
31
MediaBrowser.Controller/Providers/IHasMetadata.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IHasMetadata
|
||||
/// </summary>
|
||||
public interface IHasMetadata : IHasImages, IHasProviderIds
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the preferred metadata country code.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetPreferredMetadataCountryCode();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the locked fields.
|
||||
/// </summary>
|
||||
/// <value>The locked fields.</value>
|
||||
List<MetadataFields> LockedFields { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date last saved.
|
||||
/// </summary>
|
||||
/// <value>The date last saved.</value>
|
||||
DateTime DateLastSaved { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,4 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
@@ -26,26 +21,9 @@ namespace MediaBrowser.Controller.Providers
|
||||
bool Supports(IHasImages item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the images.
|
||||
/// Gets the order.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="imageType">Type of the image.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{IEnumerable{RemoteImageInfo}}.</returns>
|
||||
Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, ImageType imageType, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the images.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{IEnumerable{RemoteImageInfo}}.</returns>
|
||||
Task<IEnumerable<RemoteImageInfo>> GetAllImages(IHasImages item, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
int Priority { get; }
|
||||
/// <value>The order.</value>
|
||||
int Order { get; }
|
||||
}
|
||||
}
|
||||
|
||||
58
MediaBrowser.Controller/Providers/ILocalImageProvider.cs
Normal file
58
MediaBrowser.Controller/Providers/ILocalImageProvider.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// This is just a marker interface
|
||||
/// </summary>
|
||||
public interface ILocalImageProvider : IImageProvider
|
||||
{
|
||||
}
|
||||
|
||||
public interface IImageFileProvider : ILocalImageProvider
|
||||
{
|
||||
List<LocalImageInfo> GetImages(IHasImages item);
|
||||
}
|
||||
|
||||
public class LocalImageInfo
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public ImageType Type { get; set; }
|
||||
}
|
||||
|
||||
public interface IDynamicImageProvider : ILocalImageProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the images.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>List{DynamicImageInfo}.</returns>
|
||||
List<DynamicImageInfo> GetImageInfos(IHasImages item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="info">The information.</param>
|
||||
/// <returns>Task{DynamicImageResponse}.</returns>
|
||||
Task<DynamicImageResponse> GetImage(IHasImages item, DynamicImageInfo info);
|
||||
}
|
||||
|
||||
public class DynamicImageInfo
|
||||
{
|
||||
public string ImageId { get; set; }
|
||||
public ImageType Type { get; set; }
|
||||
}
|
||||
|
||||
public class DynamicImageResponse
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public Stream Stream { get; set; }
|
||||
public ImageFormat Format { get; set; }
|
||||
}
|
||||
}
|
||||
90
MediaBrowser.Controller/Providers/IMetadataProvider.cs
Normal file
90
MediaBrowser.Controller/Providers/IMetadataProvider.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Marker interface
|
||||
/// </summary>
|
||||
public interface IMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; }
|
||||
}
|
||||
|
||||
public interface IMetadataProvider<TItemType> : IMetadataProvider
|
||||
where TItemType : IHasMetadata
|
||||
{
|
||||
}
|
||||
|
||||
public interface ILocalMetadataProvider : IMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines whether [has local metadata] [the specified item].
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns><c>true</c> if [has local metadata] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||
bool HasLocalMetadata(IHasMetadata item);
|
||||
}
|
||||
|
||||
public interface IRemoteMetadataProvider : IMetadataProvider
|
||||
{
|
||||
}
|
||||
|
||||
public interface IRemoteMetadataProvider<TItemType> : IMetadataProvider<TItemType>, IRemoteMetadataProvider
|
||||
where TItemType : IHasMetadata
|
||||
{
|
||||
Task<MetadataResult<TItemType>> GetMetadata(ItemId id, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public interface ILocalMetadataProvider<TItemType> : IMetadataProvider<TItemType>, ILocalMetadataProvider
|
||||
where TItemType : IHasMetadata
|
||||
{
|
||||
Task<MetadataResult<TItemType>> GetMetadata(string path, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public interface IHasChangeMonitor
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines whether the specified date has changed.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="date">The date.</param>
|
||||
/// <returns><c>true</c> if the specified date has changed; otherwise, <c>false</c>.</returns>
|
||||
bool HasChanged(IHasMetadata item, DateTime date);
|
||||
}
|
||||
|
||||
public enum MetadataProviderType
|
||||
{
|
||||
Embedded = 0,
|
||||
Local = 1,
|
||||
Remote = 2
|
||||
}
|
||||
|
||||
public class MetadataResult<T>
|
||||
where T : IHasMetadata
|
||||
{
|
||||
public bool HasMetadata { get; set; }
|
||||
public T Item { get; set; }
|
||||
}
|
||||
|
||||
public class ItemId : IHasProviderIds
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string MetadataLanguage { get; set; }
|
||||
public string MetadataCountryCode { get; set; }
|
||||
|
||||
public Dictionary<string, string> ProviderIds { get; set; }
|
||||
|
||||
public ItemId()
|
||||
{
|
||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
38
MediaBrowser.Controller/Providers/IMetadataService.cs
Normal file
38
MediaBrowser.Controller/Providers/IMetadataService.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public interface IMetadataService
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds the parts.
|
||||
/// </summary>
|
||||
/// <param name="providers">The providers.</param>
|
||||
/// <param name="imageProviders">The image providers.</param>
|
||||
void AddParts(IEnumerable<IMetadataProvider> providers, IEnumerable<IImageProvider> imageProviders);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this instance can refresh the specified item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns><c>true</c> if this instance can refresh the specified item; otherwise, <c>false</c>.</returns>
|
||||
bool CanRefresh(IHasMetadata item);
|
||||
|
||||
/// <summary>
|
||||
/// Refreshes the metadata.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions options, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the order.
|
||||
/// </summary>
|
||||
/// <value>The order.</value>
|
||||
int Order { get; }
|
||||
}
|
||||
}
|
||||
@@ -14,15 +14,23 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// </summary>
|
||||
public interface IProviderManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Refreshes the metadata.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions options, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Executes the metadata providers.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="force">if set to <c>true</c> [force].</param>
|
||||
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
||||
/// <returns>Task{System.Boolean}.</returns>
|
||||
Task<ItemUpdateType?> ExecuteMetadataProviders(BaseItem item, CancellationToken cancellationToken, bool force = false, bool allowSlowProviders = true);
|
||||
Task<ItemUpdateType?> ExecuteMetadataProviders(BaseItem item, CancellationToken cancellationToken, bool force = false);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the image.
|
||||
@@ -54,7 +62,9 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// </summary>
|
||||
/// <param name="providers">The providers.</param>
|
||||
/// <param name="imageProviders">The image providers.</param>
|
||||
void AddParts(IEnumerable<BaseMetadataProvider> providers, IEnumerable<IImageProvider> imageProviders);
|
||||
/// <param name="metadataServices">The metadata services.</param>
|
||||
/// <param name="metadataProviders">The metadata providers.</param>
|
||||
void AddParts(IEnumerable<BaseMetadataProvider> providers, IEnumerable<IImageProvider> imageProviders, IEnumerable<IMetadataService> metadataServices, IEnumerable<IMetadataProvider> metadataProviders);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available remote images.
|
||||
@@ -70,7 +80,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// Gets the image providers.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{IImageProvider}.</returns>
|
||||
IEnumerable<IImageProvider> GetImageProviders(BaseItem item);
|
||||
/// <returns>IEnumerable{ImageProviderInfo}.</returns>
|
||||
IEnumerable<ImageProviderInfo> GetImageProviderInfo(BaseItem item);
|
||||
}
|
||||
}
|
||||
48
MediaBrowser.Controller/Providers/IRemoteImageProvider.cs
Normal file
48
MediaBrowser.Controller/Providers/IRemoteImageProvider.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IImageProvider
|
||||
/// </summary>
|
||||
public interface IRemoteImageProvider : IImageProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the supported images.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{ImageType}.</returns>
|
||||
IEnumerable<ImageType> GetSupportedImages(IHasImages item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the images.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="imageType">Type of the image.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{IEnumerable{RemoteImageInfo}}.</returns>
|
||||
Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, ImageType imageType, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the images.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{IEnumerable{RemoteImageInfo}}.</returns>
|
||||
Task<IEnumerable<RemoteImageInfo>> GetAllImages(IHasImages item, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image response.
|
||||
/// </summary>
|
||||
/// <param name="url">The URL.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{HttpResponseInfo}.</returns>
|
||||
Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
49
MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
Normal file
49
MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public class MetadataRefreshOptions : ImageRefreshOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// When paired with MetadataRefreshMode=FullRefresh, all existing data will be overwritten with new data from the providers.
|
||||
/// </summary>
|
||||
public bool ReplaceAllMetadata { get; set; }
|
||||
|
||||
public MetadataRefreshMode MetadataRefreshMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TODO: deprecate. Keeping this for now, for api compatibility
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public bool ForceSave { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TODO: deprecate. Keeping this for now, for api compatibility
|
||||
/// </summary>
|
||||
[Obsolete]
|
||||
public bool ResetResolveArgs { get; set; }
|
||||
}
|
||||
|
||||
public class ImageRefreshOptions
|
||||
{
|
||||
public MetadataRefreshMode ImageRefreshMode { get; set; }
|
||||
}
|
||||
|
||||
public enum MetadataRefreshMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Providers will be executed based on default rules
|
||||
/// </summary>
|
||||
EnsureMetadata,
|
||||
|
||||
/// <summary>
|
||||
/// No providers will be executed
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// All providers will be executed to search for new metadata
|
||||
/// </summary>
|
||||
FullRefresh
|
||||
}
|
||||
}
|
||||
60
MediaBrowser.Controller/Providers/ProviderResult.cs
Normal file
60
MediaBrowser.Controller/Providers/ProviderResult.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public class ProviderResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the item identifier.
|
||||
/// </summary>
|
||||
/// <value>The item identifier.</value>
|
||||
public Guid ItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance has refreshed metadata.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has refreshed metadata; otherwise, <c>false</c>.</value>
|
||||
public bool HasRefreshedMetadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this instance has refreshed images.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has refreshed images; otherwise, <c>false</c>.</value>
|
||||
public bool HasRefreshedImages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date last refreshed.
|
||||
/// </summary>
|
||||
/// <value>The date last refreshed.</value>
|
||||
public DateTime DateLastRefreshed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last result.
|
||||
/// </summary>
|
||||
/// <value>The last result.</value>
|
||||
public ProviderRefreshStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the last result error message.
|
||||
/// </summary>
|
||||
/// <value>The last result error message.</value>
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public void AddStatus(ProviderRefreshStatus status, string errorMessage)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ErrorMessage))
|
||||
{
|
||||
ErrorMessage = errorMessage;
|
||||
}
|
||||
if (Status == ProviderRefreshStatus.Success)
|
||||
{
|
||||
Status = status;
|
||||
}
|
||||
}
|
||||
|
||||
public ProviderResult()
|
||||
{
|
||||
Status = ProviderRefreshStatus.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user