simkl only likes snake_case
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
// Wontfix: Custom status codes
|
||||
// "You don't get to pick your response code" - Luke (System Architect of Emby)
|
||||
// https://emby.media/community/index.php?/topic/61889-wiki-issue-resultfactorythrowerror/
|
||||
return new UserSettings { Error = "user_token_failed" };
|
||||
return new UserSettings { error = "user_token_failed" };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
var history = CreateHistoryFromItem(item);
|
||||
var r = await SyncHistoryAsync(history, userToken).ConfigureAwait(false);
|
||||
_logger.LogDebug("Response: " + _json.SerializeToString(r));
|
||||
if (history.Movies.Count == r.Added.Movies && history.Shows.Count == r.Added.Shows)
|
||||
if (history.movies.Count == r.Added.Movies && history.shows.Count == r.Added.Shows)
|
||||
{
|
||||
return (true, item);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
r = await SyncHistoryAsync(history, userToken).ConfigureAwait(false);
|
||||
_logger.LogDebug("Response: " + _json.SerializeToString(r));
|
||||
|
||||
return (history.Movies.Count == r.Added.Movies && history.Shows.Count == r.Added.Shows, item);
|
||||
return (history.movies.Count == r.Added.Movies && history.shows.Count == r.Added.Shows, item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -139,10 +139,10 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
/// <returns>Search file response.</returns>
|
||||
private async Task<SearchFileResponse> GetFromFile(string filename)
|
||||
{
|
||||
var f = new SimklFile { File = filename };
|
||||
var f = new SimklFile { file = filename };
|
||||
_logger.LogInformation("Posting: " + _json.SerializeToString(f));
|
||||
using var r = new StreamReader(await Post("/search/file/", null, f).ConfigureAwait(false));
|
||||
var t = r.ReadToEnd();
|
||||
var t = await r.ReadToEndAsync().ConfigureAwait(false);
|
||||
_logger.LogDebug("Response: " + t);
|
||||
return _json.DeserializeFromString<SearchFileResponse>(t);
|
||||
}
|
||||
@@ -166,9 +166,9 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
throw new InvalidDataException("type != movie (" + mo.Type + ")");
|
||||
}
|
||||
|
||||
item.Name = mo.Movie.Title;
|
||||
item.ProductionYear = mo.Movie.Year;
|
||||
history.Movies.Add(mo.Movie);
|
||||
item.Name = mo.Movie.title;
|
||||
item.ProductionYear = mo.Movie.year;
|
||||
history.movies.Add(mo.Movie);
|
||||
}
|
||||
else if (item.IsSeries == true || item.Type == "Episode")
|
||||
{
|
||||
@@ -177,12 +177,12 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
throw new InvalidDataException("type != episode (" + mo.Type + ")");
|
||||
}
|
||||
|
||||
item.Name = mo.Episode.Title;
|
||||
item.SeriesName = mo.Show.Title;
|
||||
item.IndexNumber = mo.Episode.Episode;
|
||||
item.ParentIndexNumber = mo.Episode.Season;
|
||||
item.ProductionYear = mo.Show.Year;
|
||||
history.Episodes.Add(mo.Episode);
|
||||
item.Name = mo.Episode.title;
|
||||
item.SeriesName = mo.Show.title;
|
||||
item.IndexNumber = mo.Episode.episode;
|
||||
item.ParentIndexNumber = mo.Episode.season;
|
||||
item.ProductionYear = mo.Show.year;
|
||||
history.episodes.Add(mo.Episode);
|
||||
}
|
||||
|
||||
return (history, item);
|
||||
@@ -212,12 +212,12 @@ namespace Jellyfin.Plugin.Simkl.API
|
||||
|
||||
if (item.IsMovie == true || item.Type == "Movie")
|
||||
{
|
||||
history.Movies.Add(new SimklMovie(item));
|
||||
history.movies.Add(new SimklMovie(item));
|
||||
}
|
||||
else if (item.IsSeries == true || item.Type == "Episode")
|
||||
{
|
||||
// TODO: TV Shows scrobbling (WIP)
|
||||
history.Shows.Add(new SimklShow(item));
|
||||
history.shows.Add(new SimklShow(item));
|
||||
}
|
||||
|
||||
return history;
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
ApiClient.updatePluginConfiguration(this.guid, this.configCache).then(Dashboard.processPluginConfigurationUpdateResult);
|
||||
},
|
||||
populateOptionsContainer : async function(userConfig) {
|
||||
$("#simklName").html(SimklAPI.getUserSettings(userConfig.Id).User.Name);
|
||||
$("#simklName").html(SimklAPI.getUserSettings(userConfig.Id).user.name);
|
||||
|
||||
for (var key in userConfig) {
|
||||
console.log(key, userConfig[key]);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<NoWarn>CA1707;CA1819</NoWarn>
|
||||
<NoWarn>CA1707;CA1819;SA1300</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user