ID usage fixes
This commit is contained in:
@ -83,7 +83,7 @@ func work(anime *arn.Anime) error {
|
|||||||
qualityBonusMedium := 10
|
qualityBonusMedium := 10
|
||||||
qualityBonusSmall := 10
|
qualityBonusSmall := 10
|
||||||
|
|
||||||
kitsuOriginal := fmt.Sprintf("https://media.kitsu.io/anime/poster_images/%s/original", anime.ID)
|
kitsuOriginal := fmt.Sprintf("https://media.kitsu.io/anime/poster_images/%s/original", anime.GetMapping("kitsu/anime"))
|
||||||
|
|
||||||
// Define the input sources
|
// Define the input sources
|
||||||
sources := []ipo.Input{}
|
sources := []ipo.Input{}
|
||||||
|
@ -13,10 +13,10 @@ import (
|
|||||||
// NewKitsuAnime ...
|
// NewKitsuAnime ...
|
||||||
func NewKitsuAnime(ctx *aero.Context) string {
|
func NewKitsuAnime(ctx *aero.Context) string {
|
||||||
user := utils.GetUser(ctx)
|
user := utils.GetUser(ctx)
|
||||||
|
allAnime := arn.AllAnime()
|
||||||
|
|
||||||
animes := arn.FilterKitsuAnime(func(anime *kitsu.Anime) bool {
|
animes := arn.FilterKitsuAnime(func(anime *kitsu.Anime) bool {
|
||||||
_, err := arn.GetAnime(anime.ID)
|
return arn.FindKitsuAnime(anime.ID, allAnime) != nil
|
||||||
return err != nil
|
|
||||||
})
|
})
|
||||||
|
|
||||||
sort.Slice(animes, func(i, j int) bool {
|
sort.Slice(animes, func(i, j int) bool {
|
||||||
|
@ -16,7 +16,9 @@ func main() {
|
|||||||
defer color.Green("Finished")
|
defer color.Green("Finished")
|
||||||
defer arn.Node.Close()
|
defer arn.Node.Close()
|
||||||
|
|
||||||
allAnime := arn.AllAnime()
|
allAnime := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||||
|
return len(anime.ID) < len("hw5heOmiR")
|
||||||
|
})
|
||||||
|
|
||||||
sort.Slice(allAnime, func(i, j int) bool {
|
sort.Slice(allAnime, func(i, j int) bool {
|
||||||
aID, _ := strconv.Atoi(allAnime[i].ID)
|
aID, _ := strconv.Atoi(allAnime[i].ID)
|
||||||
|
@ -1,93 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
func main() {}
|
|
||||||
|
|
||||||
// import (
|
|
||||||
// "fmt"
|
|
||||||
// "strings"
|
|
||||||
|
|
||||||
// "github.com/animenotifier/arn"
|
|
||||||
// "github.com/animenotifier/jikan"
|
|
||||||
// "github.com/fatih/color"
|
|
||||||
// )
|
|
||||||
|
|
||||||
// var jikanDB = arn.Node.Namespace("jikan")
|
|
||||||
|
|
||||||
// func main() {
|
|
||||||
// color.Yellow("Importing jikan characters...")
|
|
||||||
// defer arn.Node.Close()
|
|
||||||
|
|
||||||
// for characterObj := range jikanDB.All("Character") {
|
|
||||||
// jikanCharacter := characterObj.(*jikan.Character)
|
|
||||||
|
|
||||||
// if jikanCharacter.Name != "Slaine Troyard" {
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
|
|
||||||
// character := &arn.Character{
|
|
||||||
// ID: arn.GenerateID("Character"),
|
|
||||||
// Description: jikanCharacter.About,
|
|
||||||
// Name: &arn.CharacterName{
|
|
||||||
// Romaji: jikanCharacter.Name,
|
|
||||||
// Japanese: jikanCharacter.NameJapanese,
|
|
||||||
// },
|
|
||||||
// Image: jikanCharacter.Image,
|
|
||||||
// // Mappings: []*arn.Mapping{
|
|
||||||
// // &arn.Mapping{
|
|
||||||
// // Service: "myanimelist/character",
|
|
||||||
// // ServiceID: jikanCharacter.
|
|
||||||
// // }
|
|
||||||
// // },
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if strings.HasPrefix(character.Name.Japanese, "(") {
|
|
||||||
// character.Name.Japanese = strings.TrimPrefix(character.Name.Japanese, "(")
|
|
||||||
// character.Name.Japanese = strings.TrimSuffix(character.Name.Japanese, ")")
|
|
||||||
// }
|
|
||||||
|
|
||||||
// lines := strings.Split(character.Description, "\n")
|
|
||||||
// finalLines := make([]string, 0, len(lines))
|
|
||||||
|
|
||||||
// for _, line := range lines {
|
|
||||||
// line = strings.TrimSpace(line)
|
|
||||||
// originalLine := line
|
|
||||||
|
|
||||||
// if strings.HasPrefix(line, "(") {
|
|
||||||
// line = strings.TrimPrefix(line, "(")
|
|
||||||
// line = strings.TrimSuffix(line, ")")
|
|
||||||
// }
|
|
||||||
|
|
||||||
// line = strings.TrimSpace(line)
|
|
||||||
|
|
||||||
// colonPos := strings.Index(line, ":")
|
|
||||||
|
|
||||||
// if colonPos == -1 || colonPos < 2 || colonPos > 25 {
|
|
||||||
// finalLines = append(finalLines, originalLine)
|
|
||||||
// continue
|
|
||||||
// }
|
|
||||||
|
|
||||||
// key := line[:colonPos]
|
|
||||||
// value := line[colonPos+1:]
|
|
||||||
|
|
||||||
// value = strings.TrimSpace(value)
|
|
||||||
|
|
||||||
// if key == "source" {
|
|
||||||
// key = "Source"
|
|
||||||
// }
|
|
||||||
|
|
||||||
// character.Attributes = append(character.Attributes, &arn.CharacterAttribute{
|
|
||||||
// Name: key,
|
|
||||||
// Value: value,
|
|
||||||
// })
|
|
||||||
|
|
||||||
// fmt.Println(color.CyanString(key), color.YellowString(value))
|
|
||||||
// }
|
|
||||||
|
|
||||||
// character.Description = strings.Join(finalLines, "\n")
|
|
||||||
// character.Description = strings.TrimSpace(character.Description)
|
|
||||||
|
|
||||||
// arn.PrettyPrint(character)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// color.Green("Finished.")
|
|
||||||
// }
|
|
@ -13,6 +13,8 @@ func main() {
|
|||||||
defer color.Green("Finished.")
|
defer color.Green("Finished.")
|
||||||
defer arn.Node.Close()
|
defer arn.Node.Close()
|
||||||
|
|
||||||
|
allAnime := arn.AllAnime()
|
||||||
|
|
||||||
for mapping := range arn.StreamKitsuMappings() {
|
for mapping := range arn.StreamKitsuMappings() {
|
||||||
if mapping.Relationships.Item.Data.Type != "anime" {
|
if mapping.Relationships.Item.Data.Type != "anime" {
|
||||||
continue
|
continue
|
||||||
@ -22,7 +24,7 @@ func main() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
anime, _ := arn.GetAnime(mapping.Relationships.Item.Data.ID)
|
anime := arn.FindKitsuAnime(mapping.Relationships.Item.Data.ID, allAnime)
|
||||||
|
|
||||||
if anime == nil {
|
if anime == nil {
|
||||||
continue
|
continue
|
||||||
|
@ -16,6 +16,8 @@ func main() {
|
|||||||
added := 0
|
added := 0
|
||||||
conflicted := 0
|
conflicted := 0
|
||||||
|
|
||||||
|
allAnime := arn.AllAnime()
|
||||||
|
|
||||||
for mapping := range arn.StreamKitsuMappings() {
|
for mapping := range arn.StreamKitsuMappings() {
|
||||||
if mapping.Relationships.Item.Data.Type != "anime" {
|
if mapping.Relationships.Item.Data.Type != "anime" {
|
||||||
continue
|
continue
|
||||||
@ -31,7 +33,7 @@ func main() {
|
|||||||
externalID = externalID[len("anime/"):]
|
externalID = externalID[len("anime/"):]
|
||||||
}
|
}
|
||||||
|
|
||||||
anime, _ := arn.GetAnime(mapping.Relationships.Item.Data.ID)
|
anime := arn.FindKitsuAnime(mapping.Relationships.Item.Data.ID, allAnime)
|
||||||
|
|
||||||
if anime == nil {
|
if anime == nil {
|
||||||
continue
|
continue
|
||||||
|
@ -12,7 +12,7 @@ func main() {
|
|||||||
|
|
||||||
for mapping := range arn.StreamKitsuMappings() {
|
for mapping := range arn.StreamKitsuMappings() {
|
||||||
fmt.Printf(
|
fmt.Printf(
|
||||||
"Anime %s: %s mapped to %s\n",
|
"Kitsu Anime %s: %s mapped to %s\n",
|
||||||
mapping.Relationships.Item.Data.ID,
|
mapping.Relationships.Item.Data.ID,
|
||||||
color.YellowString(mapping.Attributes.ExternalSite),
|
color.YellowString(mapping.Attributes.ExternalSite),
|
||||||
color.GreenString(mapping.Attributes.ExternalID),
|
color.GreenString(mapping.Attributes.ExternalID),
|
||||||
|
Reference in New Issue
Block a user