This commit is contained in:
crobibero
2020-09-08 15:10:57 -06:00
commit d4debbbb18
40 changed files with 2984 additions and 0 deletions
@@ -0,0 +1,18 @@
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; }
}
}
@@ -0,0 +1,13 @@
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; }
}
}
@@ -0,0 +1,18 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Season.
/// </summary>
public class Season
{
/// <summary>
/// Gets or sets the season number.
/// </summary>
public int? Number { get; set; }
/// <summary>
/// Gets or sets the episodes.
/// </summary>
public ShowEpisode[] Episodes { get; set; }
}
}
@@ -0,0 +1,14 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Show episode.
/// </summary>
public class ShowEpisode
{
/// <summary>
/// Gets or sets episode number.
/// </summary>
public int? Number { get; set; }
// TODO: watched_at
}
}
@@ -0,0 +1,41 @@
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl episode container.
/// </summary>
public class SimklEpisode : SimklMediaObject
{
/// <summary>
/// Gets or sets watched at.
/// </summary>
[JsonPropertyName("watched_at")]
public string WatchedAt { get; set; }
/// <summary>
/// Gets or sets ids.
/// </summary>
public override SimklIds Ids { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Gets or sets the season.
/// </summary>
public int Season { get; set; }
/// <summary>
/// Gets or sets the episode.
/// </summary>
public int Episode { get; set; }
/// <summary>
/// Gets or sets multipart.
/// </summary>
public bool? Multipart { get; set; }
}
}
@@ -0,0 +1,23 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl File.
/// </summary>
public class SimklFile
{
/// <summary>
/// Gets or sets the file.
/// </summary>
public string File { get; set; }
/// <summary>
/// Gets or sets the part.
/// </summary>
public int? Part { get; set; }
/// <summary>
/// Gets or sets the hash.
/// </summary>
public string Hash { get; set; }
}
}
@@ -0,0 +1,37 @@
#pragma warning disable CA2227
using System.Collections.Generic;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl history container.
/// </summary>
public class SimklHistory
{
/// <summary>
/// Initializes a new instance of the <see cref="SimklHistory"/> class.
/// </summary>
public SimklHistory()
{
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; }
/// <summary>
/// Gets or sets the list of shows.
/// </summary>
public List<SimklShow> Shows { get; set; }
/// <summary>
/// Gets or sets the list of episodes.
/// </summary>
public List<SimklEpisode> Episodes { get; set; }
}
}
@@ -0,0 +1,57 @@
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl Ids.
/// </summary>
public class SimklIds
{
/// <summary>
/// Initializes a new instance of the <see cref="SimklIds"/> class.
/// </summary>
/// <param name="providerIds">The provider ids.</param>
public SimklIds(Dictionary<string, string> providerIds)
{
foreach (var (key, value) in providerIds)
{
var prop = GetType().GetProperty(key, BindingFlags.IgnoreCase);
if (prop.PropertyType == typeof(int?))
{
prop.SetValue(this, int.Parse(value, NumberStyles.Any, CultureInfo.InvariantCulture));
}
else if (prop.PropertyType == typeof(string))
{
prop.SetValue(this, value);
}
}
}
/// <summary>
/// Gets or sets simkl.
/// </summary>
public int? Simkl { get; set; }
/// <summary>
/// Gets or sets the imdb id.
/// </summary>
public string Imdb { get; set; }
/// <summary>
/// Gets or sets the slug.
/// </summary>
public string Slug { get; set; }
/// <summary>
/// Gets or sets the netflix id.
/// </summary>
public string Netflix { get; set; }
/// <summary>
/// Gets or sets the TMDb id.
/// </summary>
public string Tmdb { get; set; }
}
}
@@ -0,0 +1,13 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl media object.
/// </summary>
public abstract class SimklMediaObject
{
/// <summary>
/// Gets or sets ids.
/// </summary>
public abstract SimklIds Ids { get; set; }
}
}
@@ -0,0 +1,42 @@
using System;
using System.Globalization;
using MediaBrowser.Model.Dto;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl movie.
/// </summary>
public class SimklMovie : SimklMediaObject
{
/// <summary>
/// Initializes a new instance of the <see cref="SimklMovie"/> class.
/// </summary>
/// <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);
}
/// <summary>
/// Gets or sets the movie title.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Gets or sets the year.
/// </summary>
public int? Year { get; set; }
/// <inheritdoc />
public override SimklIds Ids { get; set; }
/// <summary>
/// Gets watched at.
/// </summary>
public string WatchedAt { get; }
}
}
@@ -0,0 +1,49 @@
using System.Collections.Generic;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl movie ids.
/// </summary>
public class SimklMovieIds : SimklIds
{
/// <summary>
/// Initializes a new instance of the <see cref="SimklMovieIds"/> class.
/// </summary>
/// <param name="providerMovieIds">the provider movie ids.</param>
public SimklMovieIds(Dictionary<string, string> providerMovieIds)
: base(providerMovieIds)
{
}
/// <summary>
/// Gets or sets the tvdb id.
/// </summary>
public int? Tvdb { get; set; }
/// <summary>
/// Gets or sets the mal id.
/// </summary>
public int? Mal { get; set; }
/// <summary>
/// Gets or sets the anidb id.
/// </summary>
public int? Anidb { get; set; }
/// <summary>
/// Gets or sets the hulu id.
/// </summary>
public int? Hulu { get; set; }
/// <summary>
/// Gets or sets the crunchyroll id.
/// </summary>
public int? Crunchyroll { get; set; }
/// <summary>
/// Gets or sets the movie db id.
/// </summary>
public string Moviedb { get; set; }
}
}
@@ -0,0 +1,55 @@
using MediaBrowser.Model.Dto;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl show.
/// </summary>
public class SimklShow : SimklMediaObject
{
/// <summary>
/// Initializes a new instance of the <see cref="SimklShow"/> class.
/// </summary>
/// <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[]
{
new Season
{
Number = mediaInfo.ParentIndexNumber,
Episodes = new[]
{
new ShowEpisode
{
Number = mediaInfo.IndexNumber
}
}
}
};
}
/// <summary>
/// Gets or sets title.
/// </summary>
public string Title { get; set; }
/// <summary>
/// Gets or sets year.
/// </summary>
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; }
}
}
@@ -0,0 +1,49 @@
using System.Collections.Generic;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// Simkl show ids.
/// </summary>
public class SimklShowIds : SimklIds
{
/// <summary>
/// Initializes a new instance of the <see cref="SimklShowIds"/> class.
/// </summary>
/// <param name="providerMovieIds">The provider movie ids.</param>
public SimklShowIds(Dictionary<string, string> providerMovieIds)
: base(providerMovieIds)
{
}
/// <summary>
/// Gets or sets tvdb.
/// </summary>
public int? Tvdb { get; set; }
/// <summary>
/// Gets or sets mal.
/// </summary>
public int? Mal { get; set; }
/// <summary>
/// Gets or sets anidb.
/// </summary>
public int? Anidb { get; set; }
/// <summary>
/// Gets or sets hulu.
/// </summary>
public int? Hulu { get; set; }
/// <summary>
/// Gets or sets crunchyroll.
/// </summary>
public int? Crunchyroll { get; set; }
/// <summary>
/// Gets or sets zap2it.
/// </summary>
public string Zap2It { get; set; }
}
}
+47
View File
@@ -0,0 +1,47 @@
using System;
using System.Text.Json.Serialization;
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// User.
/// </summary>
public class User
{
/// <summary>
/// Gets or sets name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets joined at.
/// </summary>
[JsonPropertyName("joined_at")]
public DateTime JoinedAt { 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; }
}
}
@@ -0,0 +1,23 @@
namespace Jellyfin.Plugin.Simkl.API.Objects
{
/// <summary>
/// User settings.
/// </summary>
public class UserSettings
{
/// <summary>
/// Gets or sets user.
/// </summary>
public User User { get; set; }
/// <summary>
/// Gets or sets account.
/// </summary>
public Account Account { get; set; }
/// <summary>
/// Gets or sets error.
/// </summary>
public string Error { get; set; }
}
}