Cleanup
This commit is contained in:
64
arn/Anime.go
64
arn/Anime.go
@ -8,7 +8,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aerogo/api"
|
||||
"github.com/aerogo/nano"
|
||||
"github.com/akyoto/color"
|
||||
"github.com/animenotifier/kitsu"
|
||||
@ -17,59 +16,6 @@ import (
|
||||
"github.com/animenotifier/twist"
|
||||
)
|
||||
|
||||
// AnimeDateFormat describes the anime date format for the date conversion.
|
||||
const AnimeDateFormat = validate.DateFormat
|
||||
|
||||
// AnimeSourceHumanReadable maps the anime source to a human readable version.
|
||||
var AnimeSourceHumanReadable = map[string]string{}
|
||||
|
||||
// Register a list of supported anime status and source types.
|
||||
func init() {
|
||||
DataLists["anime-types"] = []*Option{
|
||||
{"tv", "TV"},
|
||||
{"movie", "Movie"},
|
||||
{"ova", "OVA"},
|
||||
{"ona", "ONA"},
|
||||
{"special", "Special"},
|
||||
{"music", "Music"},
|
||||
}
|
||||
|
||||
DataLists["anime-status"] = []*Option{
|
||||
{"current", "Current"},
|
||||
{"finished", "Finished"},
|
||||
{"upcoming", "Upcoming"},
|
||||
{"tba", "To be announced"},
|
||||
}
|
||||
|
||||
DataLists["anime-sources"] = []*Option{
|
||||
{"", "Unknown"},
|
||||
{"original", "Original"},
|
||||
{"manga", "Manga"},
|
||||
{"novel", "Novel"},
|
||||
{"light novel", "Light novel"},
|
||||
{"visual novel", "Visual novel"},
|
||||
{"game", "Game"},
|
||||
{"book", "Book"},
|
||||
{"4-koma manga", "4-koma Manga"},
|
||||
{"music", "Music"},
|
||||
{"picture book", "Picture book"},
|
||||
{"web manga", "Web manga"},
|
||||
{"other", "Other"},
|
||||
}
|
||||
|
||||
for _, option := range DataLists["anime-sources"] {
|
||||
AnimeSourceHumanReadable[option.Value] = option.Label
|
||||
}
|
||||
|
||||
API.RegisterActions("Anime", []*api.Action{
|
||||
// Publish
|
||||
PublishAction(),
|
||||
|
||||
// Unpublish
|
||||
UnpublishAction(),
|
||||
})
|
||||
}
|
||||
|
||||
// AnimeID represents an anime ID.
|
||||
type AnimeID = ID
|
||||
|
||||
@ -112,7 +58,7 @@ type Anime struct {
|
||||
|
||||
// NewAnime creates a new anime.
|
||||
func NewAnime() *Anime {
|
||||
anime := Anime{}
|
||||
anime := &Anime{}
|
||||
return anime.init()
|
||||
}
|
||||
|
||||
@ -355,10 +301,10 @@ func (anime *Anime) Link() string {
|
||||
|
||||
// StartDateTime returns the start date as a time object.
|
||||
func (anime *Anime) StartDateTime() time.Time {
|
||||
format := AnimeDateFormat
|
||||
format := validate.DateFormat
|
||||
|
||||
switch {
|
||||
case len(anime.StartDate) >= len(AnimeDateFormat):
|
||||
case len(anime.StartDate) >= len(validate.DateFormat):
|
||||
// ...
|
||||
case len(anime.StartDate) >= len("2006-01"):
|
||||
format = "2006-01"
|
||||
@ -372,10 +318,10 @@ func (anime *Anime) StartDateTime() time.Time {
|
||||
|
||||
// EndDateTime returns the end date as a time object.
|
||||
func (anime *Anime) EndDateTime() time.Time {
|
||||
format := AnimeDateFormat
|
||||
format := validate.DateFormat
|
||||
|
||||
switch {
|
||||
case len(anime.EndDate) >= len(AnimeDateFormat):
|
||||
case len(anime.EndDate) >= len(validate.DateFormat):
|
||||
// ...
|
||||
case len(anime.EndDate) >= len("2006-01"):
|
||||
format = "2006-01"
|
||||
|
Reference in New Issue
Block a user