From 9ad27102fc14a0044fd2ded48453e831b3369655 Mon Sep 17 00:00:00 2001 From: bytedream Date: Wed, 12 Jul 2023 21:59:41 +0200 Subject: [PATCH] Fix missing identifier on newer simulcast titles (#227) --- crunchy-cli-core/src/utils/format.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crunchy-cli-core/src/utils/format.rs b/crunchy-cli-core/src/utils/format.rs index 0b0f46e..d975042 100644 --- a/crunchy-cli-core/src/utils/format.rs +++ b/crunchy-cli-core/src/utils/format.rs @@ -44,7 +44,18 @@ impl SingleFormat { relative_episode_number: Option, ) -> Self { Self { - identifier: episode.identifier.clone(), + identifier: if episode.identifier.is_empty() { + // crunchyroll sometimes leafs the identifier field empty so we have to build it + // ourself. it's not 100% save that the identifier which is built here is the same + // as if crunchyroll would deliver it (because the variables used here may also be + // wrong delivered by crunchy), but it's the best thing i can do at the moment + format!( + "{}|S{}|E{}", + episode.series_id, episode.season_number, episode.sequence_number + ) + } else { + episode.identifier.clone() + }, title: episode.title.clone(), description: episode.description.clone(), audio: episode.audio_locale.clone(),