compareID/qc.go

49 lines
970 B
Go
Raw Normal View History

2018-01-20 00:43:28 +01:00
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"bytes"
"bufio"
"os"
"strings"
)
type CompareAni struct {
AnidbTitle string `json:"AnidbTitle"`
MeikanTitle string `json:"MeikanTitle"`
AnidbID int `json:"AnidbID"`
MeikanID int `json:"MeikanID"`
QCMatched bool
}
type resAnimes []CompareAni
func check(e error) {
if e != nil {
panic(e)
}
}
func main() {
var animes resAnimes
var err error
dat, err := ioutil.ReadFile("./result.json")
check(err)
err = json.NewDecoder(bytes.NewReader(dat)).Decode(&animes)
check(err)
for i := 0; i < len(animes); i++ {
anime := animes[i]
reader := bufio.NewReader(os.Stdin)
fmt.Printf("%s (Anidb %d)\n%s (Meikan %d)\nAre they the same? (Y/N)", anime.AnidbTitle, anime.AnidbID, anime.MeikanTitle, anime.MeikanID)
text, _ := reader.ReadString('\n')
text = strings.ToLower(text)
if (text == "y") {
anime.QCMatched = true
} else {
anime.QCMatched = false
}
}
fmt.Println(animes[0])
}