mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 17:32:20 +00:00
привів усе до 1‑based сезонів
This commit is contained in:
parent
0b881bffbb
commit
3436520e4a
@ -98,10 +98,11 @@ namespace Makhno
|
|||||||
return OnError();
|
return OnError();
|
||||||
|
|
||||||
var selectedVoice = playerData.Voices[voiceIndex];
|
var selectedVoice = playerData.Voices[voiceIndex];
|
||||||
if (season < 0 || season >= selectedVoice.Seasons.Count)
|
int seasonIndex = season > 0 ? season - 1 : season;
|
||||||
|
if (seasonIndex < 0 || seasonIndex >= selectedVoice.Seasons.Count)
|
||||||
return OnError();
|
return OnError();
|
||||||
|
|
||||||
var selectedSeason = selectedVoice.Seasons[season];
|
var selectedSeason = selectedVoice.Seasons[seasonIndex];
|
||||||
foreach (var episode in selectedSeason.Episodes)
|
foreach (var episode in selectedSeason.Episodes)
|
||||||
{
|
{
|
||||||
if (episode.Id == episodeId && !string.IsNullOrEmpty(episode.File))
|
if (episode.Id == episodeId && !string.IsNullOrEmpty(episode.File))
|
||||||
@ -203,14 +204,16 @@ namespace Makhno
|
|||||||
{
|
{
|
||||||
var seasonItem = firstVoice.Seasons[i];
|
var seasonItem = firstVoice.Seasons[i];
|
||||||
string seasonName = seasonItem.Title ?? $"Сезон {i + 1}";
|
string seasonName = seasonItem.Title ?? $"Сезон {i + 1}";
|
||||||
string link = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season={i}";
|
int seasonNumber = i + 1;
|
||||||
season_tpl.Append(seasonName, link, i.ToString());
|
string link = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season={seasonNumber}";
|
||||||
|
season_tpl.Append(seasonName, link, seasonNumber.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return rjson ? Content(season_tpl.ToJson(), "application/json; charset=utf-8") : Content(season_tpl.ToHtml(), "text/html; charset=utf-8");
|
return rjson ? Content(season_tpl.ToJson(), "application/json; charset=utf-8") : Content(season_tpl.ToHtml(), "text/html; charset=utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (season < 0 || season >= playerData.Voices.First().Seasons.Count)
|
int seasonIndex = season > 0 ? season - 1 : season;
|
||||||
|
if (seasonIndex < 0 || seasonIndex >= playerData.Voices.First().Seasons.Count)
|
||||||
return OnError();
|
return OnError();
|
||||||
|
|
||||||
var voice_tpl = new VoiceTpl();
|
var voice_tpl = new VoiceTpl();
|
||||||
@ -226,7 +229,8 @@ namespace Makhno
|
|||||||
{
|
{
|
||||||
var voice = playerData.Voices[i];
|
var voice = playerData.Voices[i];
|
||||||
string voiceName = voice.Name ?? $"Озвучка {i + 1}";
|
string voiceName = voice.Name ?? $"Озвучка {i + 1}";
|
||||||
string voiceLink = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season={season}&t={i}";
|
int seasonNumber = seasonIndex + 1;
|
||||||
|
string voiceLink = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season={seasonNumber}&t={i}";
|
||||||
bool isActive = selectedVoice == i.ToString();
|
bool isActive = selectedVoice == i.ToString();
|
||||||
voice_tpl.Append(voiceName, isActive, voiceLink);
|
voice_tpl.Append(voiceName, isActive, voiceLink);
|
||||||
}
|
}
|
||||||
@ -234,9 +238,9 @@ namespace Makhno
|
|||||||
if (!string.IsNullOrEmpty(selectedVoice) && int.TryParse(selectedVoice, out int voiceIndex) && voiceIndex < playerData.Voices.Count)
|
if (!string.IsNullOrEmpty(selectedVoice) && int.TryParse(selectedVoice, out int voiceIndex) && voiceIndex < playerData.Voices.Count)
|
||||||
{
|
{
|
||||||
var selectedVoiceData = playerData.Voices[voiceIndex];
|
var selectedVoiceData = playerData.Voices[voiceIndex];
|
||||||
if (season < selectedVoiceData.Seasons.Count)
|
if (seasonIndex < selectedVoiceData.Seasons.Count)
|
||||||
{
|
{
|
||||||
var selectedSeason = selectedVoiceData.Seasons[season];
|
var selectedSeason = selectedVoiceData.Seasons[seasonIndex];
|
||||||
var sortedEpisodes = selectedSeason.Episodes.OrderBy(e => ExtractEpisodeNumber(e.Title)).ToList();
|
var sortedEpisodes = selectedSeason.Episodes.OrderBy(e => ExtractEpisodeNumber(e.Title)).ToList();
|
||||||
|
|
||||||
for (int i = 0; i < sortedEpisodes.Count; i++)
|
for (int i = 0; i < sortedEpisodes.Count; i++)
|
||||||
@ -245,7 +249,7 @@ namespace Makhno
|
|||||||
if (!string.IsNullOrEmpty(episode.File))
|
if (!string.IsNullOrEmpty(episode.File))
|
||||||
{
|
{
|
||||||
string streamUrl = BuildStreamUrl(init, episode.File);
|
string streamUrl = BuildStreamUrl(init, episode.File);
|
||||||
int seasonNumber = season + 1;
|
int seasonNumber = seasonIndex + 1;
|
||||||
episode_tpl.Append(
|
episode_tpl.Append(
|
||||||
episode.Title,
|
episode.Title,
|
||||||
title ?? original_title,
|
title ?? original_title,
|
||||||
|
|||||||
@ -113,8 +113,9 @@ namespace UaTUT
|
|||||||
{
|
{
|
||||||
var seasonItem = firstVoice.Seasons[i];
|
var seasonItem = firstVoice.Seasons[i];
|
||||||
string seasonName = seasonItem.Title ?? $"Сезон {i + 1}";
|
string seasonName = seasonItem.Title ?? $"Сезон {i + 1}";
|
||||||
string link = $"{host}/uatut?imdb_id={imdb_id}&kinopoisk_id={kinopoisk_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&s={s}&season={i}";
|
int seasonNumber = i + 1;
|
||||||
season_tpl.Append(seasonName, link, i.ToString());
|
string link = $"{host}/uatut?imdb_id={imdb_id}&kinopoisk_id={kinopoisk_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&s={s}&season={seasonNumber}";
|
||||||
|
season_tpl.Append(seasonName, link, seasonNumber.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
OnLog($"UaTUT: found {firstVoice.Seasons.Count} seasons");
|
OnLog($"UaTUT: found {firstVoice.Seasons.Count} seasons");
|
||||||
@ -137,8 +138,10 @@ namespace UaTUT
|
|||||||
if (playerData?.Voices == null || !playerData.Voices.Any())
|
if (playerData?.Voices == null || !playerData.Voices.Any())
|
||||||
return OnError();
|
return OnError();
|
||||||
|
|
||||||
|
int seasonIndex = season > 0 ? season - 1 : season;
|
||||||
|
|
||||||
// Перевіряємо чи існує вибраний сезон
|
// Перевіряємо чи існує вибраний сезон
|
||||||
if (season >= playerData.Voices.First().Seasons.Count)
|
if (seasonIndex >= playerData.Voices.First().Seasons.Count || seasonIndex < 0)
|
||||||
return OnError();
|
return OnError();
|
||||||
|
|
||||||
var voice_tpl = new VoiceTpl();
|
var voice_tpl = new VoiceTpl();
|
||||||
@ -156,7 +159,8 @@ namespace UaTUT
|
|||||||
{
|
{
|
||||||
var voice = playerData.Voices[i];
|
var voice = playerData.Voices[i];
|
||||||
string voiceName = voice.Name ?? $"Озвучка {i + 1}";
|
string voiceName = voice.Name ?? $"Озвучка {i + 1}";
|
||||||
string voiceLink = $"{host}/uatut?imdb_id={imdb_id}&kinopoisk_id={kinopoisk_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&s={s}&season={season}&t={i}";
|
int seasonNumber = seasonIndex + 1;
|
||||||
|
string voiceLink = $"{host}/uatut?imdb_id={imdb_id}&kinopoisk_id={kinopoisk_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&s={s}&season={seasonNumber}&t={i}";
|
||||||
bool isActive = selectedVoice == i.ToString();
|
bool isActive = selectedVoice == i.ToString();
|
||||||
voice_tpl.Append(voiceName, isActive, voiceLink);
|
voice_tpl.Append(voiceName, isActive, voiceLink);
|
||||||
}
|
}
|
||||||
@ -166,9 +170,9 @@ namespace UaTUT
|
|||||||
{
|
{
|
||||||
var selectedVoiceData = playerData.Voices[voiceIndex];
|
var selectedVoiceData = playerData.Voices[voiceIndex];
|
||||||
|
|
||||||
if (season < selectedVoiceData.Seasons.Count)
|
if (seasonIndex < selectedVoiceData.Seasons.Count)
|
||||||
{
|
{
|
||||||
var selectedSeason = selectedVoiceData.Seasons[season];
|
var selectedSeason = selectedVoiceData.Seasons[seasonIndex];
|
||||||
|
|
||||||
// Сортуємо епізоди та додаємо правильну нумерацію
|
// Сортуємо епізоди та додаємо правильну нумерацію
|
||||||
var sortedEpisodes = selectedSeason.Episodes.OrderBy(e => ExtractEpisodeNumber(e.Title)).ToList();
|
var sortedEpisodes = selectedSeason.Episodes.OrderBy(e => ExtractEpisodeNumber(e.Title)).ToList();
|
||||||
@ -182,10 +186,11 @@ namespace UaTUT
|
|||||||
if (!string.IsNullOrEmpty(episodeFile))
|
if (!string.IsNullOrEmpty(episodeFile))
|
||||||
{
|
{
|
||||||
string streamUrl = BuildStreamUrl(init, episodeFile);
|
string streamUrl = BuildStreamUrl(init, episodeFile);
|
||||||
|
int seasonNumber = seasonIndex + 1;
|
||||||
episode_tpl.Append(
|
episode_tpl.Append(
|
||||||
episodeName,
|
episodeName,
|
||||||
title ?? original_title,
|
title ?? original_title,
|
||||||
season.ToString(),
|
seasonNumber.ToString(),
|
||||||
(i + 1).ToString("D2"),
|
(i + 1).ToString("D2"),
|
||||||
streamUrl
|
streamUrl
|
||||||
);
|
);
|
||||||
@ -399,9 +404,10 @@ namespace UaTUT
|
|||||||
{
|
{
|
||||||
var selectedVoice = playerData.Voices[voiceIndex];
|
var selectedVoice = playerData.Voices[voiceIndex];
|
||||||
|
|
||||||
if (season >= 0 && season < selectedVoice.Seasons.Count)
|
int seasonIndex = season > 0 ? season - 1 : season;
|
||||||
|
if (seasonIndex >= 0 && seasonIndex < selectedVoice.Seasons.Count)
|
||||||
{
|
{
|
||||||
var selectedSeasonData = selectedVoice.Seasons[season];
|
var selectedSeasonData = selectedVoice.Seasons[seasonIndex];
|
||||||
|
|
||||||
foreach (var episode in selectedSeasonData.Episodes)
|
foreach (var episode in selectedSeasonData.Episodes)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user