aboutsummaryrefslogtreecommitdiff
path: root/mal/episodes.go
diff options
context:
space:
mode:
Diffstat (limited to 'mal/episodes.go')
-rw-r--r--mal/episodes.go22
1 files changed, 16 insertions, 6 deletions
diff --git a/mal/episodes.go b/mal/episodes.go
index 30fc5d2..255f8b0 100644
--- a/mal/episodes.go
+++ b/mal/episodes.go
@@ -19,30 +19,40 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package mal
import (
- "log"
+ "fmt"
+ "os"
"strconv"
)
func SetEpisodes(animeId int, ep string) {
epValue, err := strconv.Atoi(ep)
if err != nil {
- log.Fatal("Error while parsing episode input", err)
+ fmt.Println("Error while parsing episode input", err)
+ os.Exit(1)
}
sign := ep[0:1]
if sign == "+" || sign == "-" {
- log.Printf("Cannot increment/decrement watched episodes by %d\n. Currently that doesn't wokr", epValue)
- return
+ fmt.Printf("Cannot increment/decrement watched episodes by %d\n. Currently that doesn't wokr", epValue)
+ os.Exit(2)
}
userAnimeClient.SetWatchedEpisodes(animeId, epValue)
}
+
func SetChapters(mangaId int, ch string) {
chValue, err := strconv.Atoi(ch)
if err != nil {
- log.Fatal("Error while parsing chapter input", err)
+ fmt.Println("Error while parsing chapter input", err)
+ os.Exit(1)
+ }
+
+ sign := ch[0:1]
+ if sign == "+" || sign == "-" {
+ fmt.Printf("Cannot increment/decrement read chapters by %d\n. Currently that doesn't wokr", chValue)
+ os.Exit(2)
}
- log.Printf("peeepee%s%d", ch[0:1], chValue)
+ userMangaClient.SetChaptersRead(mangaId, chValue)
}