Added shell parameters to MAL jobs
This commit is contained in:
@ -19,6 +19,11 @@ func main() {
|
||||
defer color.Green("Finished.")
|
||||
defer arn.Node.Close()
|
||||
|
||||
// Invoke via parameters
|
||||
if InvokeShellArgs() {
|
||||
return
|
||||
}
|
||||
|
||||
// Sync the most important ones first
|
||||
allAnime := arn.AllAnime()
|
||||
arn.SortAnimeByQuality(allAnime)
|
||||
|
36
jobs/mal-sync/shell.go
Normal file
36
jobs/mal-sync/shell.go
Normal file
@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
)
|
||||
|
||||
// Shell parameters
|
||||
var animeID string
|
||||
|
||||
// Shell flags
|
||||
func init() {
|
||||
flag.StringVar(&animeID, "id", "", "ID of the notify.moe anime you want to refresh")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
// InvokeShellArgs ...
|
||||
func InvokeShellArgs() bool {
|
||||
if animeID != "" {
|
||||
anime, err := arn.GetAnime(animeID)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if anime.GetMapping("myanimelist/anime") == "" {
|
||||
panic("No MAL ID")
|
||||
}
|
||||
|
||||
sync(anime, anime.GetMapping("myanimelist/anime"))
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user