-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Comic Vine Person provider (#85)
- Loading branch information
Showing
17 changed files
with
1,000 additions
and
74 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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
89 changes: 89 additions & 0 deletions
89
Jellyfin.Plugin.Bookshelf/Providers/ComicVine/Models/PersonDetails.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,89 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Jellyfin.Plugin.Bookshelf.Providers.ComicVine.Models | ||
{ | ||
/// <summary> | ||
/// Details of a person. | ||
/// </summary> | ||
public class PersonDetails : PersonCredit | ||
{ | ||
/// <summary> | ||
/// Gets the list of aliases the person is known by. A \n (newline) seperates each alias. | ||
/// </summary> | ||
public string? Aliases { get; init; } | ||
|
||
/// <summary> | ||
/// Gets a date, if one exists, that the person was born on. Not an origin date. | ||
/// </summary> | ||
public string? Birth { get; init; } | ||
|
||
/// <summary> | ||
/// Gets a date, if one exists, that the person was born on. Not an origin date. | ||
/// </summary> | ||
[JsonIgnore] | ||
public DateTime? BirthDate => ParseAsUTC(Birth); | ||
|
||
/// <summary> | ||
/// Gets the country the person resides in. | ||
/// </summary> | ||
public string? Country { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the date this person died on. | ||
/// </summary> | ||
public string? Death { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the date this person died on. | ||
/// </summary> | ||
[JsonIgnore] | ||
public DateTime? DeathDate => ParseAsUTC(Death); | ||
|
||
/// <summary> | ||
/// Gets a brief summary of the person. | ||
/// </summary> | ||
public string? Deck { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the description of the person. | ||
/// </summary> | ||
public string? Description { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the email of this person. | ||
/// </summary> | ||
public string? Email { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the gender of the person. Available options are: Male (1), Female (2), Other (0). | ||
/// </summary> | ||
public int? Gender { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the city or town the person resides in. | ||
/// </summary> | ||
public string? Hometown { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the main image of the person. | ||
/// </summary> | ||
public ImageList? Image { get; init; } | ||
|
||
/// <summary> | ||
/// Gets the URL to the person website. | ||
/// </summary> | ||
public string? Website { get; init; } | ||
|
||
private static DateTime? ParseAsUTC(string? value) | ||
{ | ||
if (!string.IsNullOrWhiteSpace(value) && DateTime.TryParse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out DateTime result)) | ||
{ | ||
return result; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Jellyfin.Plugin.Bookshelf/Providers/ComicVine/Persons/ComicVinePersonExternalId.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,26 @@ | ||
using MediaBrowser.Controller.Entities; | ||
using MediaBrowser.Controller.Providers; | ||
using MediaBrowser.Model.Entities; | ||
using MediaBrowser.Model.Providers; | ||
|
||
namespace Jellyfin.Plugin.Bookshelf.Providers.ComicVine | ||
{ | ||
/// <inheritdoc /> | ||
public class ComicVinePersonExternalId : IExternalId | ||
{ | ||
/// <inheritdoc /> | ||
public string ProviderName => ComicVineConstants.ProviderName; | ||
|
||
/// <inheritdoc /> | ||
public string Key => ComicVineConstants.ProviderId; | ||
|
||
/// <inheritdoc /> | ||
public ExternalIdMediaType? Type => ExternalIdMediaType.Person; | ||
|
||
/// <inheritdoc /> | ||
public string? UrlFormatString => ComicVineApiUrls.BaseWebsiteUrl + "/{0}"; | ||
|
||
/// <inheritdoc /> | ||
public bool Supports(IHasProviderIds item) => item is Person; | ||
} | ||
} |
Oops, something went wrong.