2017-07-07 16:28:25 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"flag"
|
|
|
|
|
2019-06-03 09:32:43 +00:00
|
|
|
"github.com/animenotifier/notify.moe/arn/stringutils"
|
2017-07-07 16:28:25 +00:00
|
|
|
"github.com/animenotifier/kitsu"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|