mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-06-17 12:08:54 +00:00
fix(moon_decoder): handle season values as flexible json
This commit is contained in:
parent
7216ec8ec7
commit
45e4a8171b
@ -30,7 +30,30 @@ namespace LME.AnimeON.Models
|
|||||||
public string ImdbId { get; set; }
|
public string ImdbId { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("season")]
|
[JsonPropertyName("season")]
|
||||||
public int Season { get; set; }
|
public System.Text.Json.JsonElement? RawSeason { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public int Season
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (RawSeason == null)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
var element = RawSeason.Value;
|
||||||
|
if (element.ValueKind == JsonValueKind.Number && element.TryGetInt32(out int val))
|
||||||
|
return val;
|
||||||
|
|
||||||
|
if (element.ValueKind == JsonValueKind.String)
|
||||||
|
{
|
||||||
|
string str = element.GetString();
|
||||||
|
if (int.TryParse(str, out int val2))
|
||||||
|
return val2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FundubsResponseModel
|
public class FundubsResponseModel
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user