Improved shoboi sync

This commit is contained in:
Eduard Urbach 2017-06-29 07:09:29 +02:00
parent 2b8503f255
commit 524cc4311d

View File

@ -64,17 +64,30 @@ func sync(anime *arn.Anime) bool {
// Search for a specific title // Search for a specific title
func search(anime *arn.Anime, title string) { func search(anime *arn.Anime, title string) {
tid, err := shoboi.SearchAnime(title) shoboi, err := shoboi.SearchAnime(title)
if err != nil { if err != nil {
color.Red(err.Error()) color.Red(err.Error())
return return
} }
if tid == "" { if shoboi == nil {
return return
} }
// This will start a goroutine that saves the anime // Copy titles
anime.AddMapping("shoboi/anime", tid, "") if shoboi.TitleJapanese != "" {
anime.Title.Japanese = shoboi.TitleJapanese
}
if shoboi.TitleHiragana != "" {
anime.Title.Hiragana = shoboi.TitleHiragana
}
if shoboi.FirstChannel != "" {
anime.FirstChannel = shoboi.FirstChannel
}
// This will start a goroutine that saves the anime
anime.AddMapping("shoboi/anime", shoboi.TID, "")
} }