mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 06:48:35 +01:00
switch to generic lookup type
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,7 +10,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
/// <summary>
|
||||
/// Class Audio
|
||||
/// </summary>
|
||||
public class Audio : BaseItem, IHasMediaStreams, IHasAlbumArtist, IHasArtist, IHasMusicGenres
|
||||
public class Audio : BaseItem, IHasMediaStreams, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<SongInfo>
|
||||
{
|
||||
public Audio()
|
||||
{
|
||||
@@ -127,5 +128,16 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
return config.BlockUnratedMusic;
|
||||
}
|
||||
|
||||
public SongInfo GetLookupInfo()
|
||||
{
|
||||
var info = GetItemLookupInfo<SongInfo>();
|
||||
|
||||
info.AlbumArtist = AlbumArtist;
|
||||
info.Album = Album;
|
||||
info.Artists = Artists;
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -10,10 +11,10 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
/// <summary>
|
||||
/// Class MusicAlbum
|
||||
/// </summary>
|
||||
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasTags
|
||||
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasTags, IHasLookupInfo<AlbumInfo>
|
||||
{
|
||||
public List<Guid> SoundtrackIds { get; set; }
|
||||
|
||||
|
||||
public MusicAlbum()
|
||||
{
|
||||
Artists = new List<string>();
|
||||
@@ -112,6 +113,26 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
return config.BlockUnratedMusic;
|
||||
}
|
||||
|
||||
public AlbumInfo GetLookupInfo()
|
||||
{
|
||||
var id = GetItemLookupInfo<AlbumInfo>();
|
||||
|
||||
id.AlbumArtist = AlbumArtist;
|
||||
|
||||
var artist = Parents.OfType<MusicArtist>().FirstOrDefault();
|
||||
|
||||
if (artist != null)
|
||||
{
|
||||
id.ArtistProviderIds = artist.ProviderIds;
|
||||
}
|
||||
|
||||
id.SongInfos = RecursiveChildren.OfType<Audio>()
|
||||
.Select(i => i.GetLookupInfo())
|
||||
.ToList();
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
public class MusicAlbumDisc : Folder
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
/// <summary>
|
||||
/// Class MusicArtist
|
||||
/// </summary>
|
||||
public class MusicArtist : Folder, IMetadataContainer, IItemByName, IHasMusicGenres, IHasDualAccess, IHasTags, IHasProductionLocations
|
||||
public class MusicArtist : Folder, IMetadataContainer, IItemByName, IHasMusicGenres, IHasDualAccess, IHasTags, IHasProductionLocations, IHasLookupInfo<ArtistInfo>
|
||||
{
|
||||
[IgnoreDataMember]
|
||||
public List<ItemByNameCounts> UserItemCountList { get; set; }
|
||||
@@ -201,5 +201,16 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
|
||||
progress.Report(100);
|
||||
}
|
||||
|
||||
public ArtistInfo GetLookupInfo()
|
||||
{
|
||||
var info = GetItemLookupInfo<ArtistInfo>();
|
||||
|
||||
info.SongInfos = RecursiveChildren.OfType<Audio>()
|
||||
.Select(i => i.GetLookupInfo())
|
||||
.ToList();
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// Class BaseItem
|
||||
/// </summary>
|
||||
public abstract class BaseItem : IHasProviderIds, ILibraryItem, IHasImages, IHasUserData, IHasMetadata
|
||||
public abstract class BaseItem : IHasProviderIds, ILibraryItem, IHasImages, IHasUserData, IHasMetadata, IHasLookupInfo<ItemLookupInfo>
|
||||
{
|
||||
protected BaseItem()
|
||||
{
|
||||
@@ -236,7 +236,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var locationType = LocationType;
|
||||
|
||||
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
|
||||
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
|
||||
{
|
||||
return new string[] { };
|
||||
}
|
||||
@@ -610,7 +610,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
localTrailersChanged = await RefreshLocalTrailers(hasTrailers, options, fileSystemChildren, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (themeSongsChanged || themeVideosChanged || localTrailersChanged)
|
||||
{
|
||||
options.ForceSave = true;
|
||||
@@ -1455,5 +1455,24 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
return userdata == null || !userdata.Played;
|
||||
}
|
||||
|
||||
ItemLookupInfo IHasLookupInfo<ItemLookupInfo>.GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<ItemLookupInfo>();
|
||||
}
|
||||
|
||||
protected T GetItemLookupInfo<T>()
|
||||
where T : ItemLookupInfo, new()
|
||||
{
|
||||
return new T
|
||||
{
|
||||
MetadataCountryCode = GetPreferredMetadataCountryCode(),
|
||||
MetadataLanguage = GetPreferredMetadataLanguage(),
|
||||
Name = Name,
|
||||
ProviderIds = ProviderIds,
|
||||
IndexNumber = IndexNumber,
|
||||
ParentIndexNumber = ParentIndexNumber
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public class Book : BaseItem, IHasTags, IHasPreferredMetadataLanguage
|
||||
public class Book : BaseItem, IHasTags, IHasPreferredMetadataLanguage, IHasLookupInfo<BookInfo>
|
||||
{
|
||||
public override string MediaType
|
||||
{
|
||||
@@ -38,5 +39,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return config.BlockUnratedBooks;
|
||||
}
|
||||
|
||||
public BookInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<BookInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, IHasPreferredMetadataLanguage
|
||||
public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, IHasPreferredMetadataLanguage, IHasLookupInfo<GameInfo>
|
||||
{
|
||||
public List<Guid> SoundtrackIds { get; set; }
|
||||
|
||||
@@ -115,5 +116,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return config.BlockUnratedGames;
|
||||
}
|
||||
|
||||
public GameInfo GetLookupInfo()
|
||||
{
|
||||
var id = GetItemLookupInfo<GameInfo>();
|
||||
|
||||
id.GameSystem = GameSystem;
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Runtime.Serialization;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using System;
|
||||
|
||||
@@ -7,7 +8,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// Class GameSystem
|
||||
/// </summary>
|
||||
public class GameSystem : Folder
|
||||
public class GameSystem : Folder, IHasLookupInfo<GameSystemInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// Return the id that should be used to key display prefs for this item.
|
||||
@@ -47,5 +48,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
// Don't block. Determine by game
|
||||
return false;
|
||||
}
|
||||
|
||||
public GameSystemInfo GetLookupInfo()
|
||||
{
|
||||
var id = GetItemLookupInfo<GameSystemInfo>();
|
||||
|
||||
id.Path = Path;
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IHasMetadata
|
||||
@@ -1,15 +1,20 @@
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.Movies
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BoxSet
|
||||
/// </summary>
|
||||
public class BoxSet : Folder, IHasTrailers, IHasTags, IHasKeywords, IHasPreferredMetadataLanguage, IHasDisplayOrder
|
||||
public class BoxSet : Folder, IHasTrailers, IHasTags, IHasKeywords, IHasPreferredMetadataLanguage, IHasDisplayOrder, IHasLookupInfo<BoxSetInfo>, IMetadataContainer
|
||||
{
|
||||
public BoxSet()
|
||||
{
|
||||
@@ -74,5 +79,67 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
// Default sorting
|
||||
return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);
|
||||
}
|
||||
|
||||
public BoxSetInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<BoxSetInfo>();
|
||||
}
|
||||
|
||||
public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
// Refresh bottom up, children first, then the boxset
|
||||
// By then hopefully the movies within will have Tmdb collection values
|
||||
var items = RecursiveChildren.ToList();
|
||||
|
||||
var totalItems = items.Count;
|
||||
var percentages = new Dictionary<Guid, double>(totalItems);
|
||||
|
||||
var tasks = new List<Task>();
|
||||
|
||||
// Refresh songs
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (tasks.Count > 3)
|
||||
{
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
tasks.Clear();
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
var innerProgress = new ActionableProgress<double>();
|
||||
|
||||
// Avoid implicitly captured closure
|
||||
var currentChild = item;
|
||||
innerProgress.RegisterAction(p =>
|
||||
{
|
||||
lock (percentages)
|
||||
{
|
||||
percentages[currentChild.Id] = p / 100;
|
||||
|
||||
var percent = percentages.Values.Sum();
|
||||
percent /= totalItems;
|
||||
percent *= 100;
|
||||
progress.Report(percent);
|
||||
}
|
||||
});
|
||||
|
||||
tasks.Add(RefreshItem(item, refreshOptions, innerProgress, cancellationToken));
|
||||
}
|
||||
|
||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||
tasks.Clear();
|
||||
|
||||
// Refresh current item
|
||||
await RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
progress.Report(100);
|
||||
}
|
||||
|
||||
private async Task RefreshItem(BaseItem item, MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
await item.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
progress.Report(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
/// <summary>
|
||||
/// Class Movie
|
||||
/// </summary>
|
||||
public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasTags, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore
|
||||
public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasTags, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>
|
||||
{
|
||||
public List<Guid> SpecialFeatureIds { get; set; }
|
||||
|
||||
@@ -166,5 +166,10 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
{
|
||||
return config.BlockUnratedMovies;
|
||||
}
|
||||
|
||||
public MovieInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<MovieInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasBudget
|
||||
public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasBudget, IHasLookupInfo<MusicVideoInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the artist.
|
||||
@@ -54,5 +55,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return config.BlockUnratedMusic;
|
||||
}
|
||||
|
||||
public MusicVideoInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<MusicVideoInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Dto;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
@@ -7,7 +8,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// This is the full Person object that can be retrieved with all of it's data.
|
||||
/// </summary>
|
||||
public class Person : BaseItem, IItemByName
|
||||
public class Person : BaseItem, IItemByName, IHasLookupInfo<Providers.PersonLookupInfo>
|
||||
{
|
||||
public Person()
|
||||
{
|
||||
@@ -31,6 +32,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return "Person-" + Name;
|
||||
}
|
||||
|
||||
public Providers.PersonLookupInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<Providers.PersonLookupInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -9,7 +10,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
/// <summary>
|
||||
/// Class Episode
|
||||
/// </summary>
|
||||
public class Episode : Video
|
||||
public class Episode : Video, IHasLookupInfo<EpisodeInfo>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the season in which it aired.
|
||||
@@ -41,7 +42,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
/// </summary>
|
||||
/// <value>The index number.</value>
|
||||
public int? IndexNumberEnd { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// We want to group into series not show individually in an index
|
||||
/// </summary>
|
||||
@@ -233,5 +234,21 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
return config.BlockUnratedSeries;
|
||||
}
|
||||
|
||||
public EpisodeInfo GetLookupInfo()
|
||||
{
|
||||
var id = GetItemLookupInfo<EpisodeInfo>();
|
||||
|
||||
var series = Series;
|
||||
|
||||
if (series != null)
|
||||
{
|
||||
id.SeriesProviderIds = series.ProviderIds;
|
||||
}
|
||||
|
||||
id.IndexNumberEnd = IndexNumberEnd;
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Localization;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Querying;
|
||||
@@ -14,7 +15,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
/// <summary>
|
||||
/// Class Series
|
||||
/// </summary>
|
||||
public class Series : Folder, IHasSoundtracks, IHasTrailers, IHasTags, IHasPreferredMetadataLanguage, IHasDisplayOrder
|
||||
public class Series : Folder, IHasSoundtracks, IHasTrailers, IHasTags, IHasPreferredMetadataLanguage, IHasDisplayOrder, IHasLookupInfo<SeriesInfo>
|
||||
{
|
||||
public List<Guid> SpecialFeatureIds { get; set; }
|
||||
public List<Guid> SoundtrackIds { get; set; }
|
||||
@@ -222,5 +223,10 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
}
|
||||
|
||||
public string PreferredMetadataLanguage { get; set; }
|
||||
|
||||
public SeriesInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<SeriesInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -9,7 +10,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <summary>
|
||||
/// Class Trailer
|
||||
/// </summary>
|
||||
public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasTags, IHasPreferredMetadataLanguage, IHasMetascore
|
||||
public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasTags, IHasPreferredMetadataLanguage, IHasMetascore, IHasLookupInfo<TrailerInfo>
|
||||
{
|
||||
public List<Guid> SoundtrackIds { get; set; }
|
||||
|
||||
@@ -105,5 +106,10 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return config.BlockUnratedTrailers;
|
||||
}
|
||||
|
||||
public TrailerInfo GetLookupInfo()
|
||||
{
|
||||
return GetItemLookupInfo<TrailerInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Controller.Library
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
<Compile Include="Persistence\MediaStreamQuery.cs" />
|
||||
<Compile Include="Providers\ICustomMetadataProvider.cs" />
|
||||
<Compile Include="Providers\IHasChangeMonitor.cs" />
|
||||
<Compile Include="Providers\IHasMetadata.cs" />
|
||||
<Compile Include="Entities\IHasMetadata.cs" />
|
||||
<Compile Include="Providers\IImageProvider.cs" />
|
||||
<Compile Include="Providers\ILocalMetadataProvider.cs" />
|
||||
<Compile Include="Providers\IProviderRepository.cs" />
|
||||
@@ -155,7 +155,7 @@
|
||||
<Compile Include="Providers\IMetadataProvider.cs" />
|
||||
<Compile Include="Providers\IMetadataService.cs" />
|
||||
<Compile Include="Providers\IRemoteMetadataProvider.cs" />
|
||||
<Compile Include="Providers\ItemId.cs" />
|
||||
<Compile Include="Providers\ItemLookupInfo.cs" />
|
||||
<Compile Include="Providers\MetadataRefreshOptions.cs" />
|
||||
<Compile Include="Providers\NameParser.cs" />
|
||||
<Compile Include="Providers\MetadataStatus.cs" />
|
||||
|
||||
@@ -479,7 +479,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
case "Director":
|
||||
{
|
||||
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Director }))
|
||||
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new Entities.PersonInfo { Name = v.Trim(), Type = PersonType.Director }))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(p.Name))
|
||||
{
|
||||
@@ -491,7 +491,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
case "Writer":
|
||||
{
|
||||
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Writer }))
|
||||
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new Entities.PersonInfo { Name = v.Trim(), Type = PersonType.Writer }))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(p.Name))
|
||||
{
|
||||
@@ -516,7 +516,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
else
|
||||
{
|
||||
// Old-style piped string
|
||||
foreach (var p in SplitNames(actors).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Actor }))
|
||||
foreach (var p in SplitNames(actors).Select(v => new Entities.PersonInfo { Name = v.Trim(), Type = PersonType.Actor }))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(p.Name))
|
||||
{
|
||||
@@ -530,7 +530,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
|
||||
case "GuestStars":
|
||||
{
|
||||
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.GuestStar }))
|
||||
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new Entities.PersonInfo { Name = v.Trim(), Type = PersonType.GuestStar }))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(p.Name))
|
||||
{
|
||||
@@ -1195,7 +1195,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// </summary>
|
||||
/// <param name="reader">The reader.</param>
|
||||
/// <returns>IEnumerable{PersonInfo}.</returns>
|
||||
private IEnumerable<PersonInfo> GetPersonsFromXmlNode(XmlReader reader)
|
||||
private IEnumerable<Entities.PersonInfo> GetPersonsFromXmlNode(XmlReader reader)
|
||||
{
|
||||
var name = string.Empty;
|
||||
var type = "Actor"; // If type is not specified assume actor
|
||||
@@ -1257,7 +1257,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
}
|
||||
|
||||
var personInfo = new PersonInfo
|
||||
var personInfo = new Entities.PersonInfo
|
||||
{
|
||||
Name = name.Trim(),
|
||||
Role = role,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
@@ -7,15 +8,10 @@ namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
}
|
||||
|
||||
public interface IRemoteMetadataProvider<TItemType> : IMetadataProvider<TItemType>, IRemoteMetadataProvider
|
||||
where TItemType : IHasMetadata
|
||||
public interface IRemoteMetadataProvider<TItemType, in TLookupInfoType> : IMetadataProvider<TItemType>, IRemoteMetadataProvider
|
||||
where TItemType : IHasMetadata, IHasLookupInfo<TLookupInfoType>
|
||||
where TLookupInfoType : ItemLookupInfo, new()
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the metadata.
|
||||
/// </summary>
|
||||
/// <param name="id">The identifier.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task{MetadataResult{`0}}.</returns>
|
||||
Task<MetadataResult<TItemType>> GetMetadata(ItemId id, CancellationToken cancellationToken);
|
||||
Task<MetadataResult<TItemType>> GetMetadata(TLookupInfoType info, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public class ItemId : IHasProviderIds
|
||||
public class ItemLookupInfo : IHasProviderIds
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
@@ -34,13 +34,29 @@ namespace MediaBrowser.Controller.Providers
|
||||
public int? IndexNumber { get; set; }
|
||||
public int? ParentIndexNumber { get; set; }
|
||||
|
||||
public ItemId()
|
||||
public ItemLookupInfo()
|
||||
{
|
||||
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public class AlbumId : ItemId
|
||||
public interface IHasLookupInfo<out TLookupInfoType>
|
||||
where TLookupInfoType : ItemLookupInfo, new()
|
||||
{
|
||||
TLookupInfoType GetLookupInfo();
|
||||
}
|
||||
|
||||
public class ArtistInfo : ItemLookupInfo
|
||||
{
|
||||
public List<SongInfo> SongInfos { get; set; }
|
||||
|
||||
public ArtistInfo()
|
||||
{
|
||||
SongInfos = new List<SongInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
public class AlbumInfo : ItemLookupInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the album artist.
|
||||
@@ -53,14 +69,16 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// </summary>
|
||||
/// <value>The artist provider ids.</value>
|
||||
public Dictionary<string, string> ArtistProviderIds { get; set; }
|
||||
public List<SongInfo> SongInfos { get; set; }
|
||||
|
||||
public AlbumId()
|
||||
public AlbumInfo()
|
||||
{
|
||||
ArtistProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
SongInfos = new List<SongInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
public class GameId : ItemId
|
||||
public class GameInfo : ItemLookupInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the game system.
|
||||
@@ -69,7 +87,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
public string GameSystem { get; set; }
|
||||
}
|
||||
|
||||
public class GameSystemId : ItemId
|
||||
public class GameSystemInfo : ItemLookupInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the path.
|
||||
@@ -78,15 +96,57 @@ namespace MediaBrowser.Controller.Providers
|
||||
public string Path { get; set; }
|
||||
}
|
||||
|
||||
public class EpisodeId : ItemId
|
||||
public class EpisodeInfo : ItemLookupInfo
|
||||
{
|
||||
public Dictionary<string, string> SeriesProviderIds { get; set; }
|
||||
|
||||
public int? IndexNumberEnd { get; set; }
|
||||
|
||||
public EpisodeId()
|
||||
public EpisodeInfo()
|
||||
{
|
||||
SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public class SongInfo : ItemLookupInfo
|
||||
{
|
||||
public string AlbumArtist { get; set; }
|
||||
public string Album { get; set; }
|
||||
public List<string> Artists { get; set; }
|
||||
}
|
||||
|
||||
public class SeriesInfo : ItemLookupInfo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class PersonLookupInfo : ItemLookupInfo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class MovieInfo : ItemLookupInfo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class BoxSetInfo : ItemLookupInfo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class MusicVideoInfo : ItemLookupInfo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class TrailerInfo : ItemLookupInfo
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class BookInfo : ItemLookupInfo
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user