From 93e848b2aae70e1df7ac3fc2b799c58b583a6775 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 8 Mar 2018 19:09:35 +0100 Subject: [PATCH] Patches cleanup --- patches/add-episodes/add-episodes.go | 26 -- .../add-user-notifications.go | 23 -- patches/character-patch/character-patch.go | 23 -- patches/export-aero-db/export-aero-db.go | 275 ------------------ .../add-theme.go => fix-theme/fix-theme.go} | 4 +- 5 files changed, 1 insertion(+), 350 deletions(-) delete mode 100644 patches/add-episodes/add-episodes.go delete mode 100644 patches/add-user-notifications/add-user-notifications.go delete mode 100644 patches/character-patch/character-patch.go delete mode 100644 patches/export-aero-db/export-aero-db.go rename patches/{add-theme/add-theme.go => fix-theme/fix-theme.go} (79%) diff --git a/patches/add-episodes/add-episodes.go b/patches/add-episodes/add-episodes.go deleted file mode 100644 index fd31aa89..00000000 --- a/patches/add-episodes/add-episodes.go +++ /dev/null @@ -1,26 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/animenotifier/arn" -) - -func main() { - defer arn.Node.Close() - - for anime := range arn.StreamAnime() { - if anime.Episodes() != nil { - continue - } - - fmt.Println(anime) - - episodes := &arn.AnimeEpisodes{ - AnimeID: anime.ID, - Items: []*arn.AnimeEpisode{}, - } - - arn.DB.Set("AnimeEpisodes", anime.ID, episodes) - } -} diff --git a/patches/add-user-notifications/add-user-notifications.go b/patches/add-user-notifications/add-user-notifications.go deleted file mode 100644 index 93b08d14..00000000 --- a/patches/add-user-notifications/add-user-notifications.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/animenotifier/arn" - "github.com/fatih/color" -) - -func main() { - defer arn.Node.Close() - - for user := range arn.StreamUsers() { - obj := user.Notifications() - - if obj == nil { - fmt.Println(user.Nick) - arn.NewUserNotifications(user.ID).Save() - } - } - - color.Green("Finished.") -} diff --git a/patches/character-patch/character-patch.go b/patches/character-patch/character-patch.go deleted file mode 100644 index 7002f3fe..00000000 --- a/patches/character-patch/character-patch.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import ( - "github.com/animenotifier/arn" -) - -// Character ... -type Character struct { - ID string `json:"id"` - Name string `json:"name"` - Image string `json:"image"` - Description string `json:"description"` - Attributes []*arn.CharacterAttribute `json:"attributes"` -} - -func main() { - defer arn.Node.Close() - - // Overwrite existing type - arn.DB.RegisterTypes((*Character)(nil)) - - // characters := arn.AllCharacters() -} diff --git a/patches/export-aero-db/export-aero-db.go b/patches/export-aero-db/export-aero-db.go deleted file mode 100644 index cb464a0d..00000000 --- a/patches/export-aero-db/export-aero-db.go +++ /dev/null @@ -1,275 +0,0 @@ -package main - -func main() {} - -// import ( -// "time" - -// "github.com/aerogo/nano" -// "github.com/animenotifier/arn" -// "github.com/fatih/color" -// ) - -// func main() { -// arn.DB.SetScanPriority("high") - -// aeroDB := nano.New(5000).Namespace("arn", arn.DBTypes...) -// defer aeroDB.Close() - -// for typeName := range arn.DB.Types() { -// count := 0 - -// switch typeName { -// case "Anime": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Anime) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "AnimeEpisodes": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.AnimeEpisodes) { -// aeroDB.Set(typeName, obj.AnimeID, obj) -// count++ -// } - -// case "AnimeList": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.AnimeList) { -// aeroDB.Set(typeName, obj.UserID, obj) -// count++ -// } - -// case "AnimeCharacters": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.AnimeCharacters) { -// aeroDB.Set(typeName, obj.AnimeID, obj) -// count++ -// } - -// case "AnimeRelations": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.AnimeRelations) { -// aeroDB.Set(typeName, obj.AnimeID, obj) -// count++ -// } - -// case "Character": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Character) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "Purchase": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Purchase) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "PushSubscriptions": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.PushSubscriptions) { -// aeroDB.Set(typeName, obj.UserID, obj) -// count++ -// } - -// case "User": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.User) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "Post": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Post) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "Thread": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Thread) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "Analytics": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Analytics) { -// aeroDB.Set(typeName, obj.UserID, obj) -// count++ -// } - -// case "SoundTrack": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.SoundTrack) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "Item": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Item) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "Inventory": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Inventory) { -// aeroDB.Set(typeName, obj.UserID, obj) -// count++ -// } - -// case "Settings": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.Settings) { -// aeroDB.Set(typeName, obj.UserID, obj) -// count++ -// } - -// case "UserFollows": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.UserFollows) { -// aeroDB.Set(typeName, obj.UserID, obj) -// count++ -// } - -// case "PayPalPayment": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.PayPalPayment) { -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "AniListToAnime": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.AniListToAnime) { -// aeroDB.Set(typeName, obj.ServiceID, obj) -// count++ -// } - -// case "MyAnimeListToAnime": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.MyAnimeListToAnime) { -// aeroDB.Set(typeName, obj.ServiceID, obj) -// count++ -// } - -// case "SearchIndex": -// anime, _ := arn.DB.Get(typeName, "Anime") -// aeroDB.Set(typeName, "Anime", anime) - -// users, _ := arn.DB.Get(typeName, "User") -// aeroDB.Set(typeName, "User", users) - -// posts, _ := arn.DB.Get(typeName, "Post") -// aeroDB.Set(typeName, "Post", posts) - -// threads, _ := arn.DB.Get(typeName, "Thread") -// aeroDB.Set(typeName, "Thread", threads) - -// count += 4 - -// case "DraftIndex": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.DraftIndex) { -// aeroDB.Set(typeName, obj.UserID, obj) -// count++ -// } - -// case "EmailToUser": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.EmailToUser) { -// if obj.Email == "" { -// continue -// } - -// aeroDB.Set(typeName, obj.Email, obj) -// count++ -// } - -// case "FacebookToUser": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.FacebookToUser) { -// if obj.ID == "" { -// continue -// } - -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "GoogleToUser": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.GoogleToUser) { -// if obj.ID == "" { -// continue -// } - -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "TwitterToUser": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.TwitterToUser) { -// if obj.ID == "" { -// continue -// } - -// aeroDB.Set(typeName, obj.ID, obj) -// count++ -// } - -// case "NickToUser": -// channel, _ := arn.DB.All(typeName) - -// for obj := range channel.(chan *arn.NickToUser) { -// if obj.Nick == "" { -// continue -// } - -// aeroDB.Set(typeName, obj.Nick, obj) -// count++ -// } - -// default: -// color.Yellow("Skipping %s", typeName) -// continue -// } - -// color.Green("Export %d %s", count, typeName) -// } - -// time.Sleep(1 * time.Second) -// } diff --git a/patches/add-theme/add-theme.go b/patches/fix-theme/fix-theme.go similarity index 79% rename from patches/add-theme/add-theme.go rename to patches/fix-theme/fix-theme.go index 9f58ccb1..d8d1c0d1 100644 --- a/patches/add-theme/add-theme.go +++ b/patches/fix-theme/fix-theme.go @@ -10,9 +10,7 @@ func main() { for user := range arn.StreamUsers() { settings := user.Settings() - if user.IsPro() { - settings.Theme = "dark" - } else { + if !user.IsPro() { settings.Theme = "light" }