mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 01:54:42 +01:00
fixed remote control flyout
This commit is contained in:
@@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
// Refresh all non-songs
|
||||
foreach (var item in others)
|
||||
{
|
||||
if (tasks.Count > 3)
|
||||
if (tasks.Count >= 3)
|
||||
{
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
tasks.Clear();
|
||||
|
||||
@@ -216,8 +216,18 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// Returns true if this item should not attempt to fetch metadata
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [dont fetch meta]; otherwise, <c>false</c>.</value>
|
||||
[Obsolete("Please use IsLocked instead of DontFetchMeta")]
|
||||
public bool DontFetchMeta { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public bool IsLocked
|
||||
{
|
||||
get
|
||||
{
|
||||
return DontFetchMeta;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the locked fields.
|
||||
/// </summary>
|
||||
|
||||
@@ -521,7 +521,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
foreach (var child in children)
|
||||
{
|
||||
if (tasks.Count >= 4)
|
||||
if (tasks.Count >= 3)
|
||||
{
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
tasks.Clear();
|
||||
|
||||
@@ -148,6 +148,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is in mixed folder; otherwise, <c>false</c>.</value>
|
||||
bool IsInMixedFolder { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is locked.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is locked; otherwise, <c>false</c>.</value>
|
||||
bool IsLocked { get; }
|
||||
}
|
||||
|
||||
public static class HasImagesExtensions
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
// Refresh songs
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (tasks.Count >= 4)
|
||||
if (tasks.Count >= 3)
|
||||
{
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
tasks.Clear();
|
||||
|
||||
@@ -147,9 +147,11 @@
|
||||
<Compile Include="Persistence\MediaStreamQuery.cs" />
|
||||
<Compile Include="Providers\DirectoryService.cs" />
|
||||
<Compile Include="Providers\ICustomMetadataProvider.cs" />
|
||||
<Compile Include="Providers\IForcedProvider.cs" />
|
||||
<Compile Include="Providers\IHasChangeMonitor.cs" />
|
||||
<Compile Include="Entities\IHasMetadata.cs" />
|
||||
<Compile Include="Providers\IImageProvider.cs" />
|
||||
<Compile Include="Providers\IImageSaver.cs" />
|
||||
<Compile Include="Providers\ILocalMetadataProvider.cs" />
|
||||
<Compile Include="Providers\IProviderRepository.cs" />
|
||||
<Compile Include="Providers\IRemoteImageProvider.cs" />
|
||||
@@ -216,7 +218,7 @@
|
||||
<Compile Include="Plugins\IPluginConfigurationPage.cs" />
|
||||
<Compile Include="Plugins\IServerEntryPoint.cs" />
|
||||
<Compile Include="Providers\IImageEnhancer.cs" />
|
||||
<Compile Include="Providers\BaseProviderInfo.cs" />
|
||||
<Compile Include="Providers\ProviderRefreshStatus.cs" />
|
||||
<Compile Include="Resolvers\IResolverIgnoreRule.cs" />
|
||||
<Compile Include="Resolvers\EntityResolutionHelper.cs" />
|
||||
<Compile Include="Resolvers\ResolverPriority.cs" />
|
||||
@@ -224,7 +226,6 @@
|
||||
<Compile Include="Library\ItemResolveArgs.cs" />
|
||||
<Compile Include="IO\FileData.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Providers\BaseMetadataProvider.cs" />
|
||||
<Compile Include="Session\ISessionController.cs" />
|
||||
<Compile Include="Session\ISessionControllerFactory.cs" />
|
||||
<Compile Include="Session\PlaybackInfo.cs" />
|
||||
|
||||
@@ -719,7 +719,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "TvRageId":
|
||||
case "TVRageId":
|
||||
{
|
||||
var id = reader.ReadElementContentAsString();
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
|
||||
@@ -1,268 +0,0 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BaseMetadataProvider
|
||||
/// </summary>
|
||||
public abstract class BaseMetadataProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the logger.
|
||||
/// </summary>
|
||||
/// <value>The logger.</value>
|
||||
protected ILogger Logger { get; set; }
|
||||
|
||||
protected ILogManager LogManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration manager.
|
||||
/// </summary>
|
||||
/// <value>The configuration manager.</value>
|
||||
protected IServerConfigurationManager ConfigurationManager { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The _id
|
||||
/// </summary>
|
||||
public readonly Guid Id;
|
||||
|
||||
/// <summary>
|
||||
/// The true task result
|
||||
/// </summary>
|
||||
protected static readonly Task<bool> TrueTaskResult = Task.FromResult(true);
|
||||
|
||||
protected static readonly Task<bool> FalseTaskResult = Task.FromResult(false);
|
||||
|
||||
/// <summary>
|
||||
/// Supportses the specified item.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
public abstract bool Supports(BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether [requires internet].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [requires internet]; otherwise, <c>false</c>.</value>
|
||||
public virtual bool RequiresInternet
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the provider version.
|
||||
/// </summary>
|
||||
/// <value>The provider version.</value>
|
||||
protected virtual string ProviderVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual ItemUpdateType ItemUpdateType
|
||||
{
|
||||
get { return RequiresInternet ? ItemUpdateType.MetadataDownload : ItemUpdateType.MetadataImport; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether [refresh on version change].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [refresh on version change]; otherwise, <c>false</c>.</value>
|
||||
protected virtual bool RefreshOnVersionChange
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if this provider is relatively slow and, therefore, should be skipped
|
||||
/// in certain instances. Default is whether or not it requires internet. Can be overridden
|
||||
/// for explicit designation.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is slow; otherwise, <c>false</c>.</value>
|
||||
public virtual bool IsSlow
|
||||
{
|
||||
get { return RequiresInternet; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BaseMetadataProvider" /> class.
|
||||
/// </summary>
|
||||
protected BaseMetadataProvider(ILogManager logManager, IServerConfigurationManager configurationManager)
|
||||
{
|
||||
Logger = logManager.GetLogger(GetType().Name);
|
||||
LogManager = logManager;
|
||||
ConfigurationManager = configurationManager;
|
||||
Id = GetType().FullName.GetMD5();
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes this instance.
|
||||
/// </summary>
|
||||
protected virtual void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the persisted last refresh date on the item for this provider.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="providerVersion">The provider version.</param>
|
||||
/// <param name="providerInfo">The provider information.</param>
|
||||
/// <param name="status">The status.</param>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
public virtual void SetLastRefreshed(BaseItem item, DateTime value, string providerVersion,
|
||||
BaseProviderInfo providerInfo, ProviderRefreshStatus status = ProviderRefreshStatus.Success)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
|
||||
providerInfo.LastRefreshed = value;
|
||||
providerInfo.LastRefreshStatus = status;
|
||||
providerInfo.ProviderVersion = providerVersion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the last refreshed.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="providerInfo">The provider information.</param>
|
||||
/// <param name="status">The status.</param>
|
||||
public void SetLastRefreshed(BaseItem item, DateTime value,
|
||||
BaseProviderInfo providerInfo, ProviderRefreshStatus status = ProviderRefreshStatus.Success)
|
||||
{
|
||||
SetLastRefreshed(item, value, ProviderVersion, providerInfo, status);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether or not this provider should be re-fetched. Default functionality can
|
||||
/// compare a provided date with a last refresh time. This can be overridden for more complex
|
||||
/// determinations.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public bool NeedsRefresh(BaseItem item, BaseProviderInfo data)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
return NeedsRefreshInternal(item, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether [enforce dont fetch metadata].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [enforce dont fetch metadata]; otherwise, <c>false</c>.</value>
|
||||
public virtual bool EnforceDontFetchMetadata
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Needses the refresh internal.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="providerInfo">The provider info.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
protected virtual bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
throw new ArgumentNullException("item");
|
||||
}
|
||||
|
||||
if (providerInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("providerInfo");
|
||||
}
|
||||
|
||||
if (providerInfo.LastRefreshed == default(DateTime))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NeedsRefreshBasedOnCompareDate(item, providerInfo))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (RefreshOnVersionChange && !String.Equals(ProviderVersion, providerInfo.ProviderVersion))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (providerInfo.LastRefreshStatus != ProviderRefreshStatus.Success)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Needses the refresh based on compare date.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="providerInfo">The provider info.</param>
|
||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||
protected virtual bool NeedsRefreshBasedOnCompareDate(BaseItem item, BaseProviderInfo providerInfo)
|
||||
{
|
||||
return CompareDate(item) > providerInfo.LastRefreshed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override this to return the date that should be compared to the last refresh date
|
||||
/// to determine if this provider should be re-fetched.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>DateTime.</returns>
|
||||
protected virtual DateTime CompareDate(BaseItem item)
|
||||
{
|
||||
return DateTime.MinValue.AddMinutes(1); // want this to be greater than mindate so new items will refresh
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="force">if set to <c>true</c> [force].</param>
|
||||
/// <param name="providerInfo">The provider information.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{System.Boolean}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
public abstract Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the priority.
|
||||
/// </summary>
|
||||
/// <value>The priority.</value>
|
||||
public abstract MetadataProviderPriority Priority { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BaseProviderInfo
|
||||
/// </summary>
|
||||
public class BaseProviderInfo
|
||||
{
|
||||
public Guid ProviderId { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the last refreshed.
|
||||
/// </summary>
|
||||
/// <value>The last refreshed.</value>
|
||||
public DateTime LastRefreshed { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the file system stamp.
|
||||
/// </summary>
|
||||
/// <value>The file system stamp.</value>
|
||||
public Guid FileStamp { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the last refresh status.
|
||||
/// </summary>
|
||||
/// <value>The last refresh status.</value>
|
||||
public ProviderRefreshStatus LastRefreshStatus { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the provider version.
|
||||
/// </summary>
|
||||
/// <value>The provider version.</value>
|
||||
public string ProviderVersion { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enum ProviderRefreshStatus
|
||||
/// </summary>
|
||||
public enum ProviderRefreshStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// The success
|
||||
/// </summary>
|
||||
Success = 0,
|
||||
/// <summary>
|
||||
/// The completed with errors
|
||||
/// </summary>
|
||||
CompletedWithErrors = 1,
|
||||
/// <summary>
|
||||
/// The failure
|
||||
/// </summary>
|
||||
Failure = 2
|
||||
}
|
||||
}
|
||||
10
MediaBrowser.Controller/Providers/IForcedProvider.cs
Normal file
10
MediaBrowser.Controller/Providers/IForcedProvider.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a marker interface that will cause a provider to run even if IsLocked=true
|
||||
/// </summary>
|
||||
public interface IForcedProvider
|
||||
{
|
||||
}
|
||||
}
|
||||
29
MediaBrowser.Controller/Providers/IImageSaver.cs
Normal file
29
MediaBrowser.Controller/Providers/IImageSaver.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using MediaBrowser.Controller.Drawing;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public interface IImageSaver
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; }
|
||||
}
|
||||
|
||||
public interface IImageFileSaver : IImageSaver
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the save paths.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="format">The format.</param>
|
||||
/// <param name="index">The index.</param>
|
||||
/// <returns>IEnumerable{System.String}.</returns>
|
||||
IEnumerable<string> GetSavePaths(IHasImages item, ImageType type, ImageFormat format, int index);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
@@ -26,10 +25,8 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
|
||||
public class MetadataResult<T>
|
||||
where T : IHasMetadata
|
||||
{
|
||||
public bool HasMetadata { get; set; }
|
||||
public T Item { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,8 +55,10 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <param name="metadataServices">The metadata services.</param>
|
||||
/// <param name="metadataProviders">The metadata providers.</param>
|
||||
/// <param name="savers">The savers.</param>
|
||||
/// <param name="imageSavers">The image savers.</param>
|
||||
void AddParts(IEnumerable<IImageProvider> imageProviders, IEnumerable<IMetadataService> metadataServices, IEnumerable<IMetadataProvider> metadataProviders,
|
||||
IEnumerable<IMetadataSaver> savers);
|
||||
IEnumerable<IMetadataSaver> savers,
|
||||
IEnumerable<IImageSaver> imageSavers);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available remote images.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Threading;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
@@ -8,10 +9,24 @@ namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
}
|
||||
|
||||
public interface IRemoteMetadataProvider<TItemType, in TLookupInfoType> : IMetadataProvider<TItemType>, IRemoteMetadataProvider
|
||||
public interface IRemoteMetadataProvider<TItemType, TLookupInfoType> : IMetadataProvider<TItemType>, IRemoteMetadataProvider
|
||||
where TItemType : IHasMetadata, IHasLookupInfo<TLookupInfoType>
|
||||
where TLookupInfoType : ItemLookupInfo, new()
|
||||
{
|
||||
Task<MetadataResult<TItemType>> GetMetadata(TLookupInfoType info, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public interface IRemoteSearchProvider<TLookupInfoType>
|
||||
where TLookupInfoType : ItemLookupInfo
|
||||
{
|
||||
Task<IEnumerable<SearchResult<TLookupInfoType>>> GetSearchResults(TLookupInfoType searchInfo, CancellationToken cancellationToken);
|
||||
}
|
||||
|
||||
public class SearchResult<T>
|
||||
where T : ItemLookupInfo
|
||||
{
|
||||
public T Item { get; set; }
|
||||
|
||||
public string ImageUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
22
MediaBrowser.Controller/Providers/ProviderRefreshStatus.cs
Normal file
22
MediaBrowser.Controller/Providers/ProviderRefreshStatus.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum ProviderRefreshStatus
|
||||
/// </summary>
|
||||
public enum ProviderRefreshStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// The success
|
||||
/// </summary>
|
||||
Success = 0,
|
||||
/// <summary>
|
||||
/// The completed with errors
|
||||
/// </summary>
|
||||
CompletedWithErrors = 1,
|
||||
/// <summary>
|
||||
/// The failure
|
||||
/// </summary>
|
||||
Failure = 2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user