Updated MAL tools
This commit is contained in:
parent
c5d05726fe
commit
83926804fc
@ -28,6 +28,10 @@ var headers = map[string]string{
|
|||||||
func main() {
|
func main() {
|
||||||
defer color.Green("Finished.")
|
defer color.Green("Finished.")
|
||||||
|
|
||||||
|
// Create directories in case they're missing
|
||||||
|
os.Mkdir(animeDirectory, 0777)
|
||||||
|
os.Mkdir(characterDirectory, 0777)
|
||||||
|
|
||||||
// Called with arguments?
|
// Called with arguments?
|
||||||
if InvokeShellArgs() {
|
if InvokeShellArgs() {
|
||||||
return
|
return
|
||||||
@ -45,9 +49,6 @@ func main() {
|
|||||||
|
|
||||||
// Sort so that we download the most important ones first
|
// Sort so that we download the most important ones first
|
||||||
arn.SortAnimeByQuality(animes)
|
arn.SortAnimeByQuality(animes)
|
||||||
|
|
||||||
// Create anime directory if it's missing
|
|
||||||
os.Mkdir(animeDirectory, 0777)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter characters with MAL ID
|
// Filter characters with MAL ID
|
||||||
@ -62,9 +63,6 @@ func main() {
|
|||||||
|
|
||||||
// Sort so that we download the most important ones first
|
// Sort so that we download the most important ones first
|
||||||
arn.SortCharactersByLikes(characters)
|
arn.SortCharactersByLikes(characters)
|
||||||
|
|
||||||
// Create character directory if it's missing
|
|
||||||
os.Mkdir(characterDirectory, 0777)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't need the database anymore
|
// We don't need the database anymore
|
||||||
|
@ -59,7 +59,7 @@ func readAnimeFile(name string) error {
|
|||||||
file, err := os.Open(name)
|
file, err := os.Open(name)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
color.Red(err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,14 +68,14 @@ func readAnimeFile(name string) error {
|
|||||||
reader, err := gzip.NewReader(file)
|
reader, err := gzip.NewReader(file)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
color.Red(err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
anime, characters, err := malparser.ParseAnime(reader)
|
anime, characters, err := malparser.ParseAnime(reader)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
color.Red(err.Error())
|
||||||
return err
|
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)
|
arn.MAL.Set("Anime", anime.ID, anime)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ func readCharacterFile(name string) error {
|
|||||||
file, err := os.Open(name)
|
file, err := os.Open(name)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
color.Red(err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,14 +127,14 @@ func readCharacterFile(name string) error {
|
|||||||
reader, err := gzip.NewReader(file)
|
reader, err := gzip.NewReader(file)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
color.Red(err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
character, err := malparser.ParseCharacter(reader)
|
character, err := malparser.ParseCharacter(reader)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
color.Red(err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ func readCharacterFile(name string) error {
|
|||||||
return errors.New("Empty ID")
|
return errors.New("Empty ID")
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(character.ID, character.Name)
|
// fmt.Println(character.ID, character.Name)
|
||||||
arn.MAL.Set("Character", character.ID, character)
|
arn.MAL.Set("Character", character.ID, character)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user