Support Jellyfin 10.7

This commit is contained in:
crobibero
2021-02-24 10:29:09 -07:00
parent 1458fd7534
commit 84a1d0934e
35 changed files with 699 additions and 751 deletions
+9 -3
View File
@@ -1,4 +1,8 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Season.
@@ -8,11 +12,13 @@
/// <summary>
/// Gets or sets the season number.
/// </summary>
public int? number { get; set; }
[JsonPropertyName("number")]
public int? Number { get; set; }
/// <summary>
/// Gets or sets the episodes.
/// </summary>
public ShowEpisode[] episodes { get; set; }
[JsonPropertyName("episodes")]
public IReadOnlyList<ShowEpisode> Episodes { get; set; } = Array.Empty<ShowEpisode>();
}
}
@@ -1,4 +1,6 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Show episode.
@@ -8,7 +10,8 @@
/// <summary>
/// Gets or sets episode number.
/// </summary>
public int? number { get; set; }
[JsonPropertyName("number")]
public int? Number { get; set; }
// TODO: watched_at
}
}
@@ -1,3 +1,4 @@
using System;
using System.Text.Json.Serialization;
#pragma warning disable SA1300
@@ -12,31 +13,30 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// Gets or sets watched at.
/// </summary>
[JsonPropertyName("watched_at")]
public string watched_at { get; set; }
/// <summary>
/// Gets or sets ids.
/// </summary>
public override SimklIds ids { get; set; }
public DateTime? WatchedAt { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
public string title { get; set; }
[JsonPropertyName("title")]
public string? Title { get; set; }
/// <summary>
/// Gets or sets the season.
/// </summary>
public int season { get; set; }
[JsonPropertyName("season")]
public int? Season { get; set; }
/// <summary>
/// Gets or sets the episode.
/// </summary>
public int episode { get; set; }
[JsonPropertyName("episode")]
public int? Episode { get; set; }
/// <summary>
/// Gets or sets multipart.
/// </summary>
public bool? multipart { get; set; }
[JsonPropertyName("multipart")]
public bool? Multipart { get; set; }
}
}
@@ -1,3 +1,5 @@
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
@@ -8,16 +10,19 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets the file.
/// </summary>
public string file { get; set; }
[JsonPropertyName("file")]
public string? File { get; set; }
/// <summary>
/// Gets or sets the part.
/// </summary>
public int? part { get; set; }
[JsonPropertyName("part")]
public int? Part { get; set; }
/// <summary>
/// Gets or sets the hash.
/// </summary>
public string hash { get; set; }
[JsonPropertyName("hash")]
public string? Hash { get; set; }
}
}
@@ -1,6 +1,7 @@
#pragma warning disable CA2227
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
@@ -14,24 +15,27 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// </summary>
public SimklHistory()
{
movies = new List<SimklMovie>();
shows = new List<SimklShow>();
episodes = new List<SimklEpisode>();
Movies = new List<SimklMovie>();
Shows = new List<SimklShow>();
Episodes = new List<SimklEpisode>();
}
/// <summary>
/// Gets or sets list of movies.
/// </summary>
public List<SimklMovie> movies { get; set; }
[JsonPropertyName("movies")]
public List<SimklMovie> Movies { get; set; }
/// <summary>
/// Gets or sets the list of shows.
/// </summary>
public List<SimklShow> shows { get; set; }
[JsonPropertyName("shows")]
public List<SimklShow> Shows { get; set; }
/// <summary>
/// Gets or sets the list of episodes.
/// </summary>
public List<SimklEpisode> episodes { get; set; }
[JsonPropertyName("episodes")]
public List<SimklEpisode> Episodes { get; set; }
}
}
+22 -16
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
@@ -17,52 +18,57 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
{
foreach (var (key, value) in providerIds)
{
if (key.Equals(nameof(simkl), StringComparison.OrdinalIgnoreCase))
if (key.Equals(nameof(Simkl), StringComparison.OrdinalIgnoreCase))
{
simkl = Convert.ToInt32(value, CultureInfo.InvariantCulture);
Simkl = Convert.ToInt32(value, CultureInfo.InvariantCulture);
}
else if (key.Equals(nameof(imdb), StringComparison.OrdinalIgnoreCase))
else if (key.Equals(nameof(Imdb), StringComparison.OrdinalIgnoreCase))
{
imdb = value;
Imdb = value;
}
else if (key.Equals(nameof(slug), StringComparison.OrdinalIgnoreCase))
else if (key.Equals(nameof(Slug), StringComparison.OrdinalIgnoreCase))
{
slug = value;
Slug = value;
}
else if (key.Equals(nameof(netflix), StringComparison.OrdinalIgnoreCase))
else if (key.Equals(nameof(Netflix), StringComparison.OrdinalIgnoreCase))
{
netflix = value;
Netflix = value;
}
else if (key.Equals(nameof(tmdb), StringComparison.OrdinalIgnoreCase))
else if (key.Equals(nameof(Tmdb), StringComparison.OrdinalIgnoreCase))
{
tmdb = value;
Tmdb = value;
}
}
}
/// <summary>
/// Gets or sets simkl.
/// Gets or sets the simkl id.
/// </summary>
public int? simkl { get; set; }
[JsonPropertyName("simkl")]
public int? Simkl { get; set; }
/// <summary>
/// Gets or sets the imdb id.
/// </summary>
public string imdb { get; set; }
[JsonPropertyName("imdb")]
public string? Imdb { get; set; }
/// <summary>
/// Gets or sets the slug.
/// </summary>
public string slug { get; set; }
[JsonPropertyName("slug")]
public string? Slug { get; set; }
/// <summary>
/// Gets or sets the netflix id.
/// </summary>
public string netflix { get; set; }
[JsonPropertyName("netflix")]
public string? Netflix { get; set; }
/// <summary>
/// Gets or sets the TMDb id.
/// </summary>
public string tmdb { get; set; }
[JsonPropertyName("tmdb")]
public string? Tmdb { get; set; }
}
}
@@ -1,13 +1,16 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl media object.
/// </summary>
public abstract class SimklMediaObject
public class SimklMediaObject
{
/// <summary>
/// Gets or sets ids.
/// </summary>
public abstract SimklIds ids { get; set; }
[JsonPropertyName("ids")]
public SimklIds? Ids { get; set; }
}
}
+12 -12
View File
@@ -1,5 +1,5 @@
using System;
using System.Globalization;
using System.Text.Json.Serialization;
using MediaBrowser.Model.Dto;
namespace Jellyfin.Plugin.Simkl.API.Objects
@@ -15,28 +15,28 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <param name="item">The base item dto.</param>
public SimklMovie(BaseItemDto item)
{
title = item.OriginalTitle;
year = item.ProductionYear;
ids = new SimklMovieIds(item.ProviderIds);
watched_at = DateTime.UtcNow.ToString("yyyy-MM-dd HH\\:mm\\:ss", CultureInfo.InvariantCulture);
Title = item.OriginalTitle;
Year = item.ProductionYear;
Ids = new SimklMovieIds(item.ProviderIds);
WatchedAt = DateTime.UtcNow;
}
/// <summary>
/// Gets or sets the movie title.
/// </summary>
public string title { get; set; }
[JsonPropertyName("title")]
public string? Title { get; set; }
/// <summary>
/// Gets or sets the year.
/// </summary>
public int? year { get; set; }
/// <inheritdoc />
public override SimklIds ids { get; set; }
[JsonPropertyName("year")]
public int? Year { get; set; }
/// <summary>
/// Gets watched at.
/// Gets or sets watched at.
/// </summary>
public string watched_at { get; }
[JsonPropertyName("watched_at")]
public DateTime? WatchedAt { get; set; }
}
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
@@ -19,31 +20,37 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets the tvdb id.
/// </summary>
public int? tvdb { get; set; }
[JsonPropertyName("tvdb")]
public int? Tvdb { get; set; }
/// <summary>
/// Gets or sets the mal id.
/// </summary>
public int? mal { get; set; }
[JsonPropertyName("mal")]
public int? Mal { get; set; }
/// <summary>
/// Gets or sets the anidb id.
/// </summary>
public int? anidb { get; set; }
[JsonPropertyName("anidb")]
public int? Anidb { get; set; }
/// <summary>
/// Gets or sets the hulu id.
/// </summary>
public int? hulu { get; set; }
[JsonPropertyName("hulu")]
public int? Hulu { get; set; }
/// <summary>
/// Gets or sets the crunchyroll id.
/// </summary>
public int? crunchyroll { get; set; }
[JsonPropertyName("crunchyroll")]
public int? Crunchyroll { get; set; }
/// <summary>
/// Gets or sets the movie db id.
/// </summary>
public string moviedb { get; set; }
[JsonPropertyName("moviedb")]
public string? Moviedb { get; set; }
}
}
+16 -16
View File
@@ -1,4 +1,6 @@
using MediaBrowser.Model.Dto;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using MediaBrowser.Model.Dto;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
@@ -13,19 +15,19 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <param name="mediaInfo">The media info.</param>
public SimklShow(BaseItemDto mediaInfo)
{
title = mediaInfo.SeriesName;
ids = new SimklShowIds(mediaInfo.ProviderIds);
year = mediaInfo.ProductionYear;
seasons = new[]
Title = mediaInfo.SeriesName;
Ids = new SimklShowIds(mediaInfo.ProviderIds);
Year = mediaInfo.ProductionYear;
Seasons = new[]
{
new Season
{
number = mediaInfo.ParentIndexNumber,
episodes = new[]
Number = mediaInfo.ParentIndexNumber,
Episodes = new[]
{
new ShowEpisode
{
number = mediaInfo.IndexNumber
Number = mediaInfo.IndexNumber
}
}
}
@@ -35,21 +37,19 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets title.
/// </summary>
public string title { get; set; }
[JsonPropertyName("title")]
public string Title { get; set; }
/// <summary>
/// Gets or sets year.
/// </summary>
public int? year { get; set; }
[JsonPropertyName("year")]
public int? Year { get; set; }
/// <summary>
/// Gets or sets seasons.
/// </summary>
public Season[] seasons { get; set; }
/// <summary>
/// Gets or sets ids.
/// </summary>
public override SimklIds ids { get; set; }
[JsonPropertyName("seasons")]
public IReadOnlyList<Season> Seasons { get; set; }
}
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
@@ -19,31 +20,37 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets tvdb.
/// </summary>
public int? tvdb { get; set; }
[JsonPropertyName("tvdb")]
public int? Tvdb { get; set; }
/// <summary>
/// Gets or sets mal.
/// </summary>
public int? mal { get; set; }
[JsonPropertyName("mal")]
public int? Mal { get; set; }
/// <summary>
/// Gets or sets anidb.
/// </summary>
public int? anidb { get; set; }
[JsonPropertyName("anidb")]
public int? Anidb { get; set; }
/// <summary>
/// Gets or sets hulu.
/// </summary>
public int? hulu { get; set; }
[JsonPropertyName("hulu")]
public int? Hulu { get; set; }
/// <summary>
/// Gets or sets crunchyroll.
/// </summary>
public int? crunchyroll { get; set; }
[JsonPropertyName("crunchyroll")]
public int? Crunchyroll { get; set; }
/// <summary>
/// Gets or sets zap2it.
/// </summary>
public string zap2It { get; set; }
[JsonPropertyName("zap2It")]
public string? Zap2It { get; set; }
}
}
+5 -2
View File
@@ -1,4 +1,6 @@
#pragma warning disable SA1300
using System.Text.Json.Serialization;
#pragma warning disable SA1300
namespace Jellyfin.Plugin.Simkl.API.Objects
{
@@ -10,6 +12,7 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets name.
/// </summary>
public string name { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
}
}
@@ -1,4 +1,6 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// User settings.
@@ -8,11 +10,13 @@
/// <summary>
/// Gets or sets user.
/// </summary>
public User user { get; set; }
[JsonPropertyName("user")]
public User? User { get; set; }
/// <summary>
/// Gets or sets error.
/// </summary>
public string error { get; set; }
[JsonPropertyName("error")]
public string? Error { get; set; }
}
}