mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-03 22:38:30 +01:00
convert games to new providers
This commit is contained in:
@@ -34,7 +34,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
Images = new Dictionary<ImageType, string>();
|
||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
LockedFields = new List<MetadataFields>();
|
||||
ImageSources = new List<ImageSourceInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -474,12 +473,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <value>The backdrop image paths.</value>
|
||||
public List<string> BackdropImagePaths { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the backdrop image sources.
|
||||
/// </summary>
|
||||
/// <value>The backdrop image sources.</value>
|
||||
public List<ImageSourceInfo> ImageSources { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the official rating.
|
||||
/// </summary>
|
||||
@@ -1458,8 +1451,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
BackdropImagePaths.Remove(file);
|
||||
|
||||
RemoveImageSourceForPath(file);
|
||||
|
||||
// Delete the source file
|
||||
DeleteImagePath(file);
|
||||
}
|
||||
@@ -1567,88 +1558,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
BackdropImagePaths.Remove(path);
|
||||
|
||||
RemoveImageSourceForPath(path);
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the image source.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="url">The URL.</param>
|
||||
public void AddImageSource(string path, string url)
|
||||
{
|
||||
RemoveImageSourceForPath(path);
|
||||
|
||||
var pathMd5 = path.ToLower().GetMD5();
|
||||
|
||||
ImageSources.Add(new ImageSourceInfo
|
||||
{
|
||||
ImagePathMD5 = pathMd5,
|
||||
ImageUrlMD5 = url.ToLower().GetMD5()
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the image source info.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns>ImageSourceInfo.</returns>
|
||||
public ImageSourceInfo GetImageSourceInfo(string path)
|
||||
{
|
||||
if (ImageSources.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var pathMd5 = path.ToLower().GetMD5();
|
||||
|
||||
return ImageSources.FirstOrDefault(i => i.ImagePathMD5 == pathMd5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the image source for path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
public void RemoveImageSourceForPath(string path)
|
||||
{
|
||||
if (ImageSources.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var pathMd5 = path.ToLower().GetMD5();
|
||||
|
||||
// Remove existing
|
||||
foreach (var entry in ImageSources
|
||||
.Where(i => i.ImagePathMD5 == pathMd5)
|
||||
.ToList())
|
||||
{
|
||||
ImageSources.Remove(entry);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
public bool ContainsImageWithSourceUrl(string url)
|
||||
{
|
||||
if (ImageSources.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var md5 = url.ToLower().GetMD5();
|
||||
|
||||
return ImageSources.Any(i => i.ImageUrlMD5 == md5);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates the screenshots.
|
||||
/// </summary>
|
||||
|
||||
@@ -99,13 +99,6 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </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
|
||||
|
||||
@@ -12,12 +12,5 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
/// <value>The screenshot image paths.</value>
|
||||
List<string> ScreenshotImagePaths { 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,6 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="prescanTasks">The prescan tasks.</param>
|
||||
/// <param name="postscanTasks">The postscan tasks.</param>
|
||||
/// <param name="peoplePrescanTasks">The people prescan tasks.</param>
|
||||
/// <param name="savers">The savers.</param>
|
||||
void AddParts(IEnumerable<IResolverIgnoreRule> rules,
|
||||
IEnumerable<IVirtualFolderCreator> pluginFolders,
|
||||
IEnumerable<IItemResolver> resolvers,
|
||||
@@ -173,8 +172,7 @@ namespace MediaBrowser.Controller.Library
|
||||
IEnumerable<IBaseItemComparer> itemComparers,
|
||||
IEnumerable<ILibraryPrescanTask> prescanTasks,
|
||||
IEnumerable<ILibraryPostScanTask> postscanTasks,
|
||||
IEnumerable<IPeoplePrescanTask> peoplePrescanTasks,
|
||||
IEnumerable<IMetadataSaver> savers);
|
||||
IEnumerable<IPeoplePrescanTask> peoplePrescanTasks);
|
||||
|
||||
/// <summary>
|
||||
/// Sorts the specified items.
|
||||
@@ -300,14 +298,6 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <returns>System.String.</returns>
|
||||
string FindCollectionType(BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the metadata.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="updateType">Type of the update.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SaveMetadata(BaseItem item, ItemUpdateType updateType);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all artists.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Controller.Library
|
||||
@@ -8,20 +8,26 @@ namespace MediaBrowser.Controller.Library
|
||||
/// </summary>
|
||||
public interface IMetadataSaver
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is enabled for] [the specified item].
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="updateType">Type of the update.</param>
|
||||
/// <returns><c>true</c> if [is enabled for] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||
bool IsEnabledFor(BaseItem item, ItemUpdateType updateType);
|
||||
bool IsEnabledFor(IHasMetadata item, ItemUpdateType updateType);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the save path.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
string GetSavePath(BaseItem item);
|
||||
string GetSavePath(IHasMetadata item);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the specified item.
|
||||
@@ -29,6 +35,6 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
void Save(BaseItem item, CancellationToken cancellationToken);
|
||||
void Save(IHasMetadata item, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +143,7 @@
|
||||
<Compile Include="Notifications\NotificationUpdateEventArgs.cs" />
|
||||
<Compile Include="Persistence\IFileOrganizationRepository.cs" />
|
||||
<Compile Include="Persistence\MediaStreamQuery.cs" />
|
||||
<Compile Include="Providers\ICustomMetadataProvider.cs" />
|
||||
<Compile Include="Providers\IDynamicInfoProvider.cs" />
|
||||
<Compile Include="Providers\IHasMetadata.cs" />
|
||||
<Compile Include="Providers\IImageProvider.cs" />
|
||||
|
||||
15
MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs
Normal file
15
MediaBrowser.Controller/Providers/ICustomMetadataProvider.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public interface ICustomMetadataProvider : IMetadataProvider
|
||||
{
|
||||
}
|
||||
|
||||
public interface ICustomMetadataProvider<TItemType> : IMetadataProvider<TItemType>, ICustomMetadataProvider
|
||||
where TItemType : IHasMetadata
|
||||
{
|
||||
Task FetchAsync(TItemType item, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -27,5 +27,11 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// </summary>
|
||||
/// <value>The date last saved.</value>
|
||||
DateTime DateLastSaved { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is save local metadata enabled].
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if [is save local metadata enabled]; otherwise, <c>false</c>.</returns>
|
||||
bool IsSaveLocalMetadataEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
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>
|
||||
void AddParts(IEnumerable<IMetadataProvider> providers);
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this instance can refresh the specified item.
|
||||
/// </summary>
|
||||
@@ -23,10 +16,10 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// Refreshes the metadata.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="refreshOptions">The options.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions options, CancellationToken cancellationToken);
|
||||
Task RefreshMetadata(IHasMetadata item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the order.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using System.Collections.Generic;
|
||||
@@ -64,7 +65,9 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <param name="imageProviders">The image providers.</param>
|
||||
/// <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);
|
||||
/// <param name="savers">The savers.</param>
|
||||
void AddParts(IEnumerable<BaseMetadataProvider> providers, IEnumerable<IImageProvider> imageProviders, IEnumerable<IMetadataService> metadataServices, IEnumerable<IMetadataProvider> metadataProviders,
|
||||
IEnumerable<IMetadataSaver> savers);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the available remote images.
|
||||
@@ -82,5 +85,19 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{ImageProviderInfo}.</returns>
|
||||
IEnumerable<ImageProviderInfo> GetImageProviderInfo(IHasImages item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all metadata plugins.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{MetadataPlugin}.</returns>
|
||||
IEnumerable<MetadataPluginSummary> GetAllMetadataPlugins();
|
||||
|
||||
/// <summary>
|
||||
/// Saves the metadata.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="updateType">Type of the update.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SaveMetadata(IHasMetadata item, ItemUpdateType updateType);
|
||||
}
|
||||
}
|
||||
@@ -51,4 +51,22 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// <value>The artist music brainz identifier.</value>
|
||||
public string ArtistMusicBrainzId { get; set; }
|
||||
}
|
||||
|
||||
public class GameId : ItemId
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the game system.
|
||||
/// </summary>
|
||||
/// <value>The game system.</value>
|
||||
public string GameSystem { get; set; }
|
||||
}
|
||||
|
||||
public class GameSystemId : ItemId
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
/// </summary>
|
||||
/// <value>The path.</value>
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user