mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 17:32:20 +00:00
feat: Update fundub response models to use translations and add new fields, adapting parsing logic in invoke and controller.
This commit is contained in:
parent
f3e94e4c41
commit
d07e90cf33
@ -93,7 +93,20 @@ namespace AnimeON
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
var fundubsResponse = JsonSerializer.Deserialize<FundubsResponseModel>(fundubsJson);
|
var fundubsResponse = JsonSerializer.Deserialize<FundubsResponseModel>(fundubsJson);
|
||||||
return fundubsResponse?.FunDubs;
|
if (fundubsResponse?.Translations == null || fundubsResponse.Translations.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var fundubs = new List<FundubModel>();
|
||||||
|
foreach (var translation in fundubsResponse.Translations)
|
||||||
|
{
|
||||||
|
var fundubModel = new FundubModel
|
||||||
|
{
|
||||||
|
Fundub = translation.Translation,
|
||||||
|
Player = translation.Player
|
||||||
|
};
|
||||||
|
fundubs.Add(fundubModel);
|
||||||
|
}
|
||||||
|
return fundubs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<EpisodeModel> GetEpisodes(int animeId, int playerId, int fundubId)
|
public async Task<EpisodeModel> GetEpisodes(int animeId, int playerId, int fundubId)
|
||||||
|
|||||||
@ -187,7 +187,20 @@ namespace AnimeON.Controllers
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
var fundubsResponse = JsonSerializer.Deserialize<FundubsResponseModel>(fundubsJson);
|
var fundubsResponse = JsonSerializer.Deserialize<FundubsResponseModel>(fundubsJson);
|
||||||
return fundubsResponse?.FunDubs;
|
if (fundubsResponse?.Translations == null || fundubsResponse.Translations.Count == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var fundubs = new List<FundubModel>();
|
||||||
|
foreach (var translation in fundubsResponse.Translations)
|
||||||
|
{
|
||||||
|
var fundubModel = new FundubModel
|
||||||
|
{
|
||||||
|
Fundub = translation.Translation,
|
||||||
|
Player = translation.Player
|
||||||
|
};
|
||||||
|
fundubs.Add(fundubModel);
|
||||||
|
}
|
||||||
|
return fundubs;
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<EpisodeModel> GetEpisodes(OnlinesSettings init, int animeId, int playerId, int fundubId)
|
async Task<EpisodeModel> GetEpisodes(OnlinesSettings init, int animeId, int playerId, int fundubId)
|
||||||
|
|||||||
@ -35,14 +35,14 @@ namespace AnimeON.Models
|
|||||||
|
|
||||||
public class FundubsResponseModel
|
public class FundubsResponseModel
|
||||||
{
|
{
|
||||||
[JsonPropertyName("funDubs")]
|
[JsonPropertyName("translations")]
|
||||||
public List<FundubModel> FunDubs { get; set; }
|
public List<TranslationModel> Translations { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FundubModel
|
public class TranslationModel
|
||||||
{
|
{
|
||||||
[JsonPropertyName("fundub")]
|
[JsonPropertyName("translation")]
|
||||||
public Fundub Fundub { get; set; }
|
public Fundub Translation { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("player")]
|
[JsonPropertyName("player")]
|
||||||
public List<Player> Player { get; set; }
|
public List<Player> Player { get; set; }
|
||||||
@ -55,6 +55,57 @@ namespace AnimeON.Models
|
|||||||
|
|
||||||
[JsonPropertyName("name")]
|
[JsonPropertyName("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("isSub")]
|
||||||
|
public bool IsSub { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("synonyms")]
|
||||||
|
public List<string> Synonyms { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("studios")]
|
||||||
|
public List<Studio> Studios { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Studio
|
||||||
|
{
|
||||||
|
[JsonPropertyName("slug")]
|
||||||
|
public string Slug { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("description")]
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("team")]
|
||||||
|
public string Team { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("telegram")]
|
||||||
|
public string Telegram { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("youtube")]
|
||||||
|
public string Youtube { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("patreon")]
|
||||||
|
public string Patreon { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("buymeacoffee")]
|
||||||
|
public string BuyMeACoffee { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("avatar")]
|
||||||
|
public Avatar Avatar { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Avatar
|
||||||
|
{
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("original")]
|
||||||
|
public string Original { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("preview")]
|
||||||
|
public string Preview { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Player
|
public class Player
|
||||||
@ -64,6 +115,15 @@ namespace AnimeON.Models
|
|||||||
|
|
||||||
[JsonPropertyName("id")]
|
[JsonPropertyName("id")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("episodesCount")]
|
||||||
|
public int EpisodesCount { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FundubModel
|
||||||
|
{
|
||||||
|
public Fundub Fundub { get; set; }
|
||||||
|
public List<Player> Player { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EpisodeModel
|
public class EpisodeModel
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user