-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add cast, crew, studios & characters
- Added `ICast`, `ICast<TMetadata>`, `ICrew`, `ICrew<TMetadata>` & `IWithCastAndCrew` to get cast and crew information for series, movies, and episodes. Works with Shoko, AniDB and TMDB, but the shoko data is an aggregate of all data linked to AniDB and TMDB. - Added `IStudio` & `IWithStudios` to get studio information for series and movies. Works with Shoko, AniDB and TMDB, but the Shoko data is an aggregate of all studios linked to AniDB and TMDB. - Added `ICharacter` for cross-series characters, accessible through `ICast`. For now only AniDB supports this, but if in the future either TMDB receives native character info support, or we can reliably implement the support for them locally, then it might arrive for it too.
- Loading branch information
Showing
50 changed files
with
1,596 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using Shoko.Plugin.Abstractions.Enums; | ||
|
||
namespace Shoko.Plugin.Abstractions.DataModels; | ||
|
||
/// <summary> | ||
/// A cast role. | ||
/// </summary> | ||
public interface ICast : IMetadata<string>, IWithPortraitImage | ||
{ | ||
/// <summary> | ||
/// Creator ID, if the cast role has a known creator. | ||
/// </summary> | ||
int? CreatorID { get; } | ||
|
||
/// <summary> | ||
/// Character ID, if the cast role has a character shared with one or more | ||
/// other cast roles. | ||
/// </summary> | ||
int? CharacterID { get; } | ||
|
||
/// <summary> | ||
/// Parent entity ID. | ||
/// </summary> | ||
int ParentID { get; } | ||
|
||
/// <summary> | ||
/// Casted role name. | ||
/// </summary> | ||
string Name { get; } | ||
|
||
/// <summary> | ||
/// Casted role name in the original language of the media, if available | ||
/// from | ||
/// </summary> | ||
string? OriginalName { get; } | ||
|
||
/// <summary> | ||
/// Role description, if available from the provider. | ||
/// </summary> | ||
string? Description { get; } | ||
|
||
/// <summary> | ||
/// Role type. | ||
/// </summary> | ||
CastRoleType RoleType { get; } | ||
|
||
/// <summary> | ||
/// Parent metadata entity. | ||
/// </summary> | ||
IMetadata<int>? Parent { get; } | ||
|
||
/// <summary> | ||
/// Character, if the cast role has a character shared with one or more | ||
/// other cast roles. | ||
/// </summary> | ||
ICharacter? Character { get; } | ||
|
||
/// <summary> | ||
/// Creator. Can be null if the cast role has no known creator or if the | ||
/// metadata is currently not locally available. | ||
/// </summary> | ||
ICreator? Creator { get; } | ||
} | ||
|
||
/// <summary> | ||
/// A cast role for a parent entity. | ||
/// </summary> | ||
/// <typeparam name="TMetadata">Metadata type.</typeparam> | ||
public interface ICast<TMetadata> : ICast where TMetadata : IMetadata<int> | ||
{ | ||
/// <summary> | ||
/// Parent metadata entity. | ||
/// </summary> | ||
TMetadata? ParentOfType { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections.Generic; | ||
using Shoko.Plugin.Abstractions.Enums; | ||
|
||
namespace Shoko.Plugin.Abstractions.DataModels; | ||
|
||
/// <summary> | ||
/// Character. | ||
/// </summary> | ||
public interface ICharacter : IMetadata<int>, IWithDescriptions, IWithPortraitImage | ||
{ | ||
/// <summary> | ||
/// Casted role name. | ||
/// </summary> | ||
string Name { get; } | ||
|
||
/// <summary> | ||
/// Casted role name in the original language of the media, if available | ||
/// from | ||
/// </summary> | ||
string? OriginalName { get; } | ||
|
||
/// <summary> | ||
/// All episode cast roles with the character. | ||
/// </summary> | ||
IEnumerable<ICast<IEpisode>> EpisodeCastRoles { get; } | ||
|
||
/// <summary> | ||
/// All movie cast roles with the character. | ||
/// </summary> | ||
IEnumerable<ICast<IMovie>> MovieCastRoles { get; } | ||
|
||
/// <summary> | ||
/// All series cast roles with the character. | ||
/// </summary> | ||
IEnumerable<ICast<ISeries>> SeriesCastRoles { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System.Collections.Generic; | ||
using Shoko.Plugin.Abstractions.Enums; | ||
|
||
namespace Shoko.Plugin.Abstractions.DataModels; | ||
|
||
/// <summary> | ||
/// Creator. | ||
/// </summary> | ||
public interface ICreator : IMetadata<int>, IWithDescriptions, IWithPortraitImage | ||
{ | ||
/// <summary> | ||
/// Casted role name. | ||
/// </summary> | ||
string Name { get; } | ||
|
||
/// <summary> | ||
/// Casted role name in the original language of the media, if available | ||
/// from | ||
/// </summary> | ||
string? OriginalName { get; } | ||
|
||
/// <summary> | ||
/// The type of the creator. | ||
/// </summary> | ||
CreatorType Type { get; } | ||
|
||
/// <summary> | ||
/// All episode cast roles the creator have participated in. | ||
/// </summary> | ||
IEnumerable<ICast<IEpisode>> EpisodeCastRoles { get; } | ||
|
||
/// <summary> | ||
/// All movie cast roles the creator have participated in. | ||
/// </summary> | ||
IEnumerable<ICast<IMovie>> MovieCastRoles { get; } | ||
|
||
/// <summary> | ||
/// All series cast roles the creator have participated in. | ||
/// </summary> | ||
IEnumerable<ICast<ISeries>> SeriesCastRoles { get; } | ||
|
||
/// <summary> | ||
/// All episode crew roles the creator have participated in. | ||
/// </summary> | ||
IEnumerable<ICrew<IEpisode>> EpisodeCrewRoles { get; } | ||
|
||
/// <summary> | ||
/// All movie crew roles the creator have participated in. | ||
/// </summary> | ||
IEnumerable<ICrew<IMovie>> MovieCrewRoles { get; } | ||
|
||
/// <summary> | ||
/// All series crew roles the creator have participated in. | ||
/// </summary> | ||
IEnumerable<ICrew<ISeries>> SeriesCrewRoles { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Shoko.Plugin.Abstractions.Enums; | ||
|
||
namespace Shoko.Plugin.Abstractions.DataModels; | ||
|
||
/// <summary> | ||
/// A crew role. | ||
/// </summary> | ||
public interface ICrew : IMetadata<string> | ||
{ | ||
/// <summary> | ||
/// Creator ID. | ||
/// </summary> | ||
int CreatorID { get; } | ||
|
||
/// <summary> | ||
/// Parent entity ID. | ||
/// </summary> | ||
int ParentID { get; } | ||
|
||
/// <summary> | ||
/// Name of the crew role, in English. | ||
/// </summary> | ||
string Name { get; } | ||
|
||
/// <summary> | ||
/// Programmatic type of the crew role. | ||
/// </summary> | ||
CrewRoleType RoleType { get; } | ||
|
||
/// <summary> | ||
/// Parent metadata entity. | ||
/// </summary> | ||
IMetadata<int>? Parent { get; } | ||
|
||
/// <summary> | ||
/// Creator. Can be null if the metadata is | ||
/// currently not locally available. | ||
/// </summary> | ||
ICreator? Creator { get; } | ||
} | ||
|
||
/// <summary> | ||
/// A crew role for a parent entity. | ||
/// </summary> | ||
/// <typeparam name="TMetadata">Metadata type.</typeparam> | ||
public interface ICrew<TMetadata> : ICrew where TMetadata : IMetadata<int> | ||
{ | ||
/// <summary> | ||
/// Parent metadata entity. | ||
/// </summary> | ||
TMetadata? ParentOfType { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using System.Collections.Generic; | ||
using Shoko.Plugin.Abstractions.Enums; | ||
|
||
namespace Shoko.Plugin.Abstractions.DataModels; | ||
|
||
/// <summary> | ||
/// A studio. | ||
/// </summary> | ||
public interface IStudio : IMetadata<int>, IWithPortraitImage | ||
{ | ||
/// <summary> | ||
/// Parent entity ID. | ||
/// </summary> | ||
int ParentID { get; } | ||
|
||
/// <summary> | ||
/// The name of the studio. | ||
/// </summary> | ||
string Name { get; } | ||
|
||
/// <summary> | ||
/// The original name of the studio. | ||
/// </summary> | ||
string? OriginalName { get; } | ||
|
||
/// <summary> | ||
/// The type of studio. | ||
/// </summary> | ||
StudioType StudioType { get; } | ||
|
||
/// <summary> | ||
/// Parent metadata entity. | ||
/// </summary> | ||
IMetadata<int>? Parent { get; } | ||
|
||
/// <summary> | ||
/// All locally known movie works by the studio. | ||
/// </summary> | ||
IEnumerable<IMovie> MovieWorks { get; } | ||
|
||
/// <summary> | ||
/// All locally known series works by the studio. | ||
/// </summary> | ||
IEnumerable<ISeries> SeriesWorks { get; } | ||
|
||
/// <summary> | ||
/// All locally known works by the studio. | ||
/// </summary> | ||
IEnumerable<IMetadata> Works { get; } | ||
} | ||
|
||
/// <summary> | ||
/// A studio for a parent entity. | ||
/// </summary> | ||
public interface IStudio<TMetadata> : IStudio where TMetadata : IMetadata<int> | ||
{ | ||
/// <summary> | ||
/// Parent metadata entity. | ||
/// </summary> | ||
TMetadata? ParentOfType { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Shoko.Plugin.Abstractions.DataModels; | ||
|
||
/// <summary> | ||
/// Represents an entity with cast and crew. | ||
/// </summary> | ||
public interface IWithCastAndCrew | ||
{ | ||
/// <summary> | ||
/// Cast associated with the entity. | ||
/// </summary> | ||
IReadOnlyList<ICast> Cast { get; } | ||
|
||
/// <summary> | ||
/// Crew associated with the entity. | ||
/// </summary> | ||
IReadOnlyList<ICrew> Crew { get; } | ||
} |
14 changes: 14 additions & 0 deletions
14
Shoko.Plugin.Abstractions/DataModels/IWithPortraitImage.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
namespace Shoko.Plugin.Abstractions.DataModels; | ||
|
||
/// <summary> | ||
/// Represents an entity with a portrait image. | ||
/// </summary> | ||
public interface IWithPortraitImage | ||
{ | ||
/// <summary> | ||
/// Portrait image of the casted role, if | ||
/// available from the provider. | ||
/// </summary> | ||
IImageMetadata? PortraitImage { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace Shoko.Plugin.Abstractions.DataModels; | ||
|
||
/// <summary> | ||
/// Represents an entity with studios. | ||
/// </summary> | ||
public interface IWithStudios | ||
{ | ||
/// <summary> | ||
/// Studios associated with the entity. | ||
/// </summary> | ||
IReadOnlyList<IStudio> Studios { get; } | ||
} |
Oops, something went wrong.