simkl only likes snake_case

This commit is contained in:
crobibero
2020-09-08 16:35:21 -06:00
parent f823281059
commit 1458fd7534
18 changed files with 93 additions and 151 deletions
@@ -1,18 +0,0 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Account.
/// </summary>
public class Account
{
/// <summary>
/// Gets or sets account id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets timezone.
/// </summary>
public string Timezone { get; set; }
}
}
@@ -1,13 +0,0 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Connections.
/// </summary>
public class Connections
{
/// <summary>
/// Gets or sets a value indicating whether facebook.
/// </summary>
public bool Facebook { get; set; }
}
}
+2 -2
View File
@@ -8,11 +8,11 @@
/// <summary>
/// Gets or sets the season number.
/// </summary>
public int? Number { get; set; }
public int? number { get; set; }
/// <summary>
/// Gets or sets the episodes.
/// </summary>
public ShowEpisode[] Episodes { get; set; }
public ShowEpisode[] episodes { get; set; }
}
}
@@ -8,7 +8,7 @@
/// <summary>
/// Gets or sets episode number.
/// </summary>
public int? Number { get; set; }
public int? number { get; set; }
// TODO: watched_at
}
}
@@ -17,26 +17,26 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets ids.
/// </summary>
public override SimklIds Ids { get; set; }
public override SimklIds ids { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
public string Title { get; set; }
public string title { get; set; }
/// <summary>
/// Gets or sets the season.
/// </summary>
public int Season { get; set; }
public int season { get; set; }
/// <summary>
/// Gets or sets the episode.
/// </summary>
public int Episode { get; set; }
public int episode { get; set; }
/// <summary>
/// Gets or sets multipart.
/// </summary>
public bool? Multipart { get; set; }
public bool? multipart { get; set; }
}
}
@@ -8,16 +8,16 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets the file.
/// </summary>
public string File { get; set; }
public string file { get; set; }
/// <summary>
/// Gets or sets the part.
/// </summary>
public int? Part { get; set; }
public int? part { get; set; }
/// <summary>
/// Gets or sets the hash.
/// </summary>
public string Hash { get; set; }
public string hash { get; set; }
}
}
@@ -14,24 +14,24 @@ 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; }
public List<SimklMovie> movies { get; set; }
/// <summary>
/// Gets or sets the list of shows.
/// </summary>
public List<SimklShow> Shows { get; set; }
public List<SimklShow> shows { get; set; }
/// <summary>
/// Gets or sets the list of episodes.
/// </summary>
public List<SimklEpisode> Episodes { get; set; }
public List<SimklEpisode> episodes { get; set; }
}
}
+22 -11
View File
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
@@ -17,14 +17,25 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
{
foreach (var (key, value) in providerIds)
{
var prop = GetType().GetProperty(key, BindingFlags.IgnoreCase);
if (prop.PropertyType == typeof(int?))
if (key.Equals(nameof(simkl), StringComparison.OrdinalIgnoreCase))
{
prop.SetValue(this, int.Parse(value, NumberStyles.Any, CultureInfo.InvariantCulture));
simkl = Convert.ToInt32(value, CultureInfo.InvariantCulture);
}
else if (prop.PropertyType == typeof(string))
else if (key.Equals(nameof(imdb), StringComparison.OrdinalIgnoreCase))
{
prop.SetValue(this, value);
imdb = value;
}
else if (key.Equals(nameof(slug), StringComparison.OrdinalIgnoreCase))
{
slug = value;
}
else if (key.Equals(nameof(netflix), StringComparison.OrdinalIgnoreCase))
{
netflix = value;
}
else if (key.Equals(nameof(tmdb), StringComparison.OrdinalIgnoreCase))
{
tmdb = value;
}
}
}
@@ -32,26 +43,26 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets simkl.
/// </summary>
public int? Simkl { get; set; }
public int? simkl { get; set; }
/// <summary>
/// Gets or sets the imdb id.
/// </summary>
public string Imdb { get; set; }
public string imdb { get; set; }
/// <summary>
/// Gets or sets the slug.
/// </summary>
public string Slug { get; set; }
public string slug { get; set; }
/// <summary>
/// Gets or sets the netflix id.
/// </summary>
public string Netflix { get; set; }
public string netflix { get; set; }
/// <summary>
/// Gets or sets the TMDb id.
/// </summary>
public string Tmdb { get; set; }
public string tmdb { get; set; }
}
}
@@ -8,6 +8,6 @@
/// <summary>
/// Gets or sets ids.
/// </summary>
public abstract SimklIds Ids { get; set; }
public abstract SimklIds ids { get; set; }
}
}
@@ -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);
WatchedAt = DateTime.UtcNow.ToString("yyyy-MM-dd HH\\:mm\\:ss", CultureInfo.InvariantCulture);
title = item.OriginalTitle;
year = item.ProductionYear;
ids = new SimklMovieIds(item.ProviderIds);
watched_at = DateTime.UtcNow.ToString("yyyy-MM-dd HH\\:mm\\:ss", CultureInfo.InvariantCulture);
}
/// <summary>
/// Gets or sets the movie title.
/// </summary>
public string Title { get; set; }
public string title { get; set; }
/// <summary>
/// Gets or sets the year.
/// </summary>
public int? Year { get; set; }
public int? year { get; set; }
/// <inheritdoc />
public override SimklIds Ids { get; set; }
public override SimklIds ids { get; set; }
/// <summary>
/// Gets watched at.
/// </summary>
public string WatchedAt { get; }
public string watched_at { get; }
}
}
@@ -19,31 +19,31 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets the tvdb id.
/// </summary>
public int? Tvdb { get; set; }
public int? tvdb { get; set; }
/// <summary>
/// Gets or sets the mal id.
/// </summary>
public int? Mal { get; set; }
public int? mal { get; set; }
/// <summary>
/// Gets or sets the anidb id.
/// </summary>
public int? Anidb { get; set; }
public int? anidb { get; set; }
/// <summary>
/// Gets or sets the hulu id.
/// </summary>
public int? Hulu { get; set; }
public int? hulu { get; set; }
/// <summary>
/// Gets or sets the crunchyroll id.
/// </summary>
public int? Crunchyroll { get; set; }
public int? crunchyroll { get; set; }
/// <summary>
/// Gets or sets the movie db id.
/// </summary>
public string Moviedb { get; set; }
public string moviedb { get; set; }
}
}
+11 -11
View File
@@ -13,19 +13,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 Season[]
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 +35,21 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets title.
/// </summary>
public string Title { get; set; }
public string title { get; set; }
/// <summary>
/// Gets or sets year.
/// </summary>
public int? Year { get; set; }
public int? year { get; set; }
/// <summary>
/// Gets or sets seasons.
/// </summary>
public Season[] Seasons { get; set; }
public Season[] seasons { get; set; }
/// <summary>
/// Gets or sets ids.
/// </summary>
public override SimklIds Ids { get; set; }
public override SimklIds ids { get; set; }
}
}
@@ -19,31 +19,31 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets tvdb.
/// </summary>
public int? Tvdb { get; set; }
public int? tvdb { get; set; }
/// <summary>
/// Gets or sets mal.
/// </summary>
public int? Mal { get; set; }
public int? mal { get; set; }
/// <summary>
/// Gets or sets anidb.
/// </summary>
public int? Anidb { get; set; }
public int? anidb { get; set; }
/// <summary>
/// Gets or sets hulu.
/// </summary>
public int? Hulu { get; set; }
public int? hulu { get; set; }
/// <summary>
/// Gets or sets crunchyroll.
/// </summary>
public int? Crunchyroll { get; set; }
public int? crunchyroll { get; set; }
/// <summary>
/// Gets or sets zap2it.
/// </summary>
public string Zap2It { get; set; }
public string zap2It { get; set; }
}
}
+2 -35
View File
@@ -1,6 +1,4 @@
using System;
using System.Text.Json.Serialization;
#pragma warning disable SA1300
#pragma warning disable SA1300
namespace Jellyfin.Plugin.Simkl.API.Objects
{
@@ -12,37 +10,6 @@ namespace Jellyfin.Plugin.Simkl.API.Objects
/// <summary>
/// Gets or sets name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets joined at.
/// </summary>
[JsonPropertyName("joined_at")]
public DateTime joined_at { get; set; }
/// <summary>
/// Gets or sets gender.
/// </summary>
public string Gender { get; set; }
/// <summary>
/// Gets or sets avatar.
/// </summary>
public string Avatar { get; set; }
/// <summary>
/// Gets or sets bio.
/// </summary>
public string Bio { get; set; }
/// <summary>
/// Gets or sets loc.
/// </summary>
public string Loc { get; set; }
/// <summary>
/// Gets or sets age.
/// </summary>
public string Age { get; set; }
public string name { get; set; }
}
}
@@ -8,16 +8,11 @@
/// <summary>
/// Gets or sets user.
/// </summary>
public User User { get; set; }
/// <summary>
/// Gets or sets account.
/// </summary>
public Account Account { get; set; }
public User user { get; set; }
/// <summary>
/// Gets or sets error.
/// </summary>
public string Error { get; set; }
public string error { get; set; }
}
}