2017-07-07 16:28:25 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"flag"
|
|
|
|
|
|
|
|
"github.com/animenotifier/kitsu"
|
2019-06-07 01:03:16 +00:00
|
|
|
"github.com/animenotifier/notify.moe/arn/stringutils"
|
2017-07-07 16:28:25 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Shell parameters
|
|
|
|
var animeID string
|
|
|
|
var verbose bool
|
|
|
|
|
|
|
|
// Shell flags
|
|
|
|
func init() {
|
|
|
|
flag.StringVar(&animeID, "id", "", "ID of the anime that you want to refresh")
|
|
|
|
flag.BoolVar(&verbose, "v", false, "Verbose output")
|
|
|
|
flag.Parse()
|
|
|
|
}
|
|
|
|
|
|
|
|
// InvokeShellArgs ...
|
|
|
|
func InvokeShellArgs() bool {
|
|
|
|
if animeID != "" {
|
|
|
|
kitsuAnime, err := kitsu.GetAnime(animeID)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if kitsuAnime.ID != animeID {
|
|
|
|
panic(errors.New("Anime ID is not the same"))
|
|
|
|
}
|
|
|
|
|
2018-03-17 00:24:06 +00:00
|
|
|
sync(kitsuAnime)
|
2017-07-07 16:28:25 +00:00
|
|
|
|
|
|
|
if verbose {
|
2018-04-19 20:15:05 +00:00
|
|
|
stringutils.PrettyPrint(kitsuAnime)
|
2017-07-07 16:28:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|