Commit cd949d7fec

cd949d7fec580d613e84dbc400db39737f479723

parent: f8fc9b1120

Unsigned

Wraient <wraient.911@gmail.com> · 2025-04-04 13:32 UTC

Add: start next episode function

Layout: unified · split

internal/curd.go +23
@@ -1243,3 +1243,26 @@ func NextEpisodePrompt(userCurdConfig *CurdConfig) {
12431243 }
12441244 // If yes or any other case, continue with the next episode
12451245}
1246
1247// StartNextEpisode handles the logic for starting the next episode
1248// It updates the episode number, resets necessary flags, and handles database updates
1249func StartNextEpisode(anime *Anime, userCurdConfig *CurdConfig, databaseFile string) {
1250 // Increment episode number
1251 anime.Ep.Number++
1252
1253 // Reset episode flags
1254 anime.Ep.Started = false
1255 anime.Ep.IsCompleted = true
1256
1257 // Log the transition
1258 Log("Completed episode, starting next.")
1259
1260 // Update local database
1261 err := LocalUpdateAnime(databaseFile, anime.AnilistId, anime.AllanimeId, anime.Ep.Number, 0, 0, GetAnimeName(*anime))
1262 if err != nil {
1263 Log("Error updating local database: " + err.Error())
1264 }
1265
1266 // Output message to user
1267 CurdOut(fmt.Sprint("Starting next episode: ", anime.Ep.Number))
1268}