aboutsummaryrefslogtreecommitdiff
path: root/ui/episodes.go
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-30 17:51:53 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-06-30 17:51:53 +0530
commit2c79256de81f06465092ad2a9b94da679e6ec95a (patch)
treea065526fbb9888c933d60b69d5b5756763c5d12a /ui/episodes.go
parente9355deabb849a123670e6678427cf33007d01f1 (diff)
added episode increment/decrement functionality
Diffstat (limited to 'ui/episodes.go')
-rw-r--r--ui/episodes.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/episodes.go b/ui/episodes.go
index 277d52f..748482b 100644
--- a/ui/episodes.go
+++ b/ui/episodes.go
@@ -29,6 +29,12 @@ import (
p "github.com/manifoldco/promptui"
)
+// very short name I know
+func CreateEpisodeUpdateConfirmationMessage(title string, prevEpNum, epNum int) string {
+ return fmt.Sprintf("Set Episodes Watched for \x1b[35m%s\x1b[0m from \x1b[1;36m%d\x1b[0m to \x1b[1;33m%d\x1b[0m.", title, prevEpNum, epNum)
+}
+
+
func EpisodeInput(anime a.Anime) {
// fetch number of total episodes, number of watched episodes from the API
animeData := mal.GetAnimeData(anime.Id, []string{"num_episodes", "my_list_status"})
@@ -60,8 +66,8 @@ func EpisodeInput(anime a.Anime) {
os.Exit(1)
}
- // TODO: read resp and show confirmation message
- mal.SetEpisodes(anime.Id, res)
+ resp := mal.SetEpisodes(anime.Id, epWatchedNum, res)
+ fmt.Println(CreateEpisodeUpdateConfirmationMessage(anime.Title, epWatchedNum, resp.EpWatched))
}
func ChapterInput(manga m.Manga) {
@@ -96,5 +102,5 @@ func ChapterInput(manga m.Manga) {
}
// TODO: read resp and show confirmation message
- mal.SetChapters(manga.Id, res)
+ mal.SetChapters(manga.Id, chReadNum, res)
}