Updated MAL tools

This commit is contained in:
Eduard Urbach 2018-11-01 00:04:47 +09:00
parent c5d05726fe
commit 83926804fc
2 changed files with 12 additions and 14 deletions

View File

@ -28,6 +28,10 @@ var headers = map[string]string{
func main() {
defer color.Green("Finished.")
// Create directories in case they're missing
os.Mkdir(animeDirectory, 0777)
os.Mkdir(characterDirectory, 0777)
// Called with arguments?
if InvokeShellArgs() {
return
@ -45,9 +49,6 @@ func main() {
// Sort so that we download the most important ones first
arn.SortAnimeByQuality(animes)
// Create anime directory if it's missing
os.Mkdir(animeDirectory, 0777)
}
// Filter characters with MAL ID
@ -62,9 +63,6 @@ func main() {
// Sort so that we download the most important ones first
arn.SortCharactersByLikes(characters)
// Create character directory if it's missing
os.Mkdir(characterDirectory, 0777)
}
// We don't need the database anymore

View File

@ -59,7 +59,7 @@ func readAnimeFile(name string) error {
file, err := os.Open(name)
if err != nil {
fmt.Println(err)
color.Red(err.Error())
return err
}
@ -68,14 +68,14 @@ func readAnimeFile(name string) error {
reader, err := gzip.NewReader(file)
if err != nil {
fmt.Println(err)
color.Red(err.Error())
return err
}
anime, characters, err := malparser.ParseAnime(reader)
if err != nil {
fmt.Println(err)
color.Red(err.Error())
return err
}
@ -109,7 +109,7 @@ func readAnimeFile(name string) error {
}
}
fmt.Println(anime.ID, anime.Title)
// fmt.Println(anime.ID, anime.Title)
arn.MAL.Set("Anime", anime.ID, anime)
return nil
}
@ -118,7 +118,7 @@ func readCharacterFile(name string) error {
file, err := os.Open(name)
if err != nil {
fmt.Println(err)
color.Red(err.Error())
return err
}
@ -127,14 +127,14 @@ func readCharacterFile(name string) error {
reader, err := gzip.NewReader(file)
if err != nil {
fmt.Println(err)
color.Red(err.Error())
return err
}
character, err := malparser.ParseCharacter(reader)
if err != nil {
fmt.Println(err)
color.Red(err.Error())
return err
}
@ -142,7 +142,7 @@ func readCharacterFile(name string) error {
return errors.New("Empty ID")
}
fmt.Println(character.ID, character.Name)
// fmt.Println(character.ID, character.Name)
arn.MAL.Set("Character", character.ID, character)
return nil
}