kaoriData

package module
Version: v0.2.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2021 License: MIT Imports: 23 Imported by: 1

README

KaoriData

Common data structures for multiple programs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeEpNumber added in v0.1.2

func NormalizeEpNumber(eps []float64) (name string)

Types

type Anime

type Anime struct {
	Id       int        `firestore:"-"`
	Name     string     `firestore:"name"`
	Episodes []*Episode `firestore:"episodes"`
}

func NewAnime

func NewAnime() *Anime

func (*Anime) AppendFile added in v0.1.3

func (a *Anime) AppendFile(filePath string) error

func (*Anime) CheckAnime added in v0.2.8

func (a *Anime) CheckAnime() error

func (*Anime) GetAnimeEpisodeDb added in v0.1.8

func (a *Anime) GetAnimeEpisodeDb(c *firestore.Client, ctx context.Context) error

func (*Anime) GetAnimeFromDb added in v0.1.7

func (a *Anime) GetAnimeFromDb(c *firestore.Client, ctx context.Context) error

func (*Anime) GetAnimeInfoFromDb added in v0.1.7

func (a *Anime) GetAnimeInfoFromDb(c *firestore.Client, ctx context.Context) error

func (*Anime) SendToDb

func (a *Anime) SendToDb(c *firestore.Client, ctx context.Context) error

func (*Anime) SendToDbRel added in v0.2.15

func (a *Anime) SendToDbRel(cl *sql.DB) error

func (*Anime) SendToKaori

func (a *Anime) SendToKaori(kaoriUrl, token string) error

type Badge added in v0.2.18

type Badge struct {
	IdBadge      string
	Name         string
	Category     string
	Requirements string
	LinkImage    string
}

type Chapter added in v0.2.6

type Chapter struct {
	Number string
	Title  string
	Pages  []*Page
}

type Episode

type Episode struct {
	Number int `firestore:"number"`
	Title  string
	Videos []*Video
}

func NewEpisode

func NewEpisode() *Episode

func (*Episode) CheckEpisode added in v0.2.8

func (ep *Episode) CheckEpisode() error

func (*Episode) SendToDbRel added in v0.2.15

func (ep *Episode) SendToDbRel(cl *sql.DB, IdAnime int) (int, error)

type GraphicSettings added in v0.2.18

type GraphicSettings struct {
	Background    string `json:"background,omitempty"`
	OnBackground  string `json:"onBackground,omitempty"`
	Surface1      string `json:"surface1,omitempty"`
	Surface2      string `json:"surface2,omitempty"`
	Surface3      string `json:"surface3,omitempty"`
	Surface4      string `json:"surface4,omitempty"`
	Surface6      string `json:"surface6,omitempty"`
	Surface8      string `json:"surface8,omitempty"`
	Surface12     string `json:"surface12,omitempty"`
	Surface16     string `json:"surface16,omitempty"`
	Surface24     string `json:"surface24,omitempty"`
	OnSurface     string `json:"onSurface,omitempty"`
	Primary       string `json:"primary,omitempty"`
	PrimaryDark   string `json:"primaryDark,omitempty"`
	OnPrimary     string `json:"onPrimary,omitempty"`
	Secondary     string `json:"secondary,omitempty"`
	SecondaryDark string `json:"secondaryDark,omitempty"`
	OnSecondary   string `json:"onSecondary,omitempty"`
	Error         string `json:"error,omitempty"`
	OnError       string `json:"onError,omitempty"`
}

GraphicSettings è una struttura con tutte le preferenze grafiche dell'utente.

func (*GraphicSettings) IsValid added in v0.2.18

func (gs *GraphicSettings) IsValid() error

IsValid verifica che i dati delle preferenze grafiche inviati dall'utente siano corretti.

type InfoQuality added in v0.0.22

type InfoQuality struct {
	Width  int `firestore:"width"`
	Height int `firestore:"height"`
}

type Manga added in v0.2.6

type Manga struct {
	Id             string
	Name           string
	ChaptersNumber int
	Chapters       []*Chapter
}

func (*Manga) AppendFile added in v0.2.6

func (m *Manga) AppendFile(filePath string) error

func (*Manga) SendToDatabase added in v0.2.7

func (m *Manga) SendToDatabase(c *firestore.Client, ctx context.Context) error

func (*Manga) SendToKaori added in v0.2.6

func (m *Manga) SendToKaori(kaoriServer, token string) error

type Music added in v0.2.15

type Music struct {
	OP         []Track
	ED         []Track
	SoundTrack []Track
}

Music struct

type MusicData added in v0.2.15

type MusicData struct {
	IdAnilist int    `json:"idAnilist"`
	AnimeName string `json:"-"`
	Type      string `json:"type"`
	NumSong   int    `json:"numSong"`
	IsFull    bool   `json:"isFull"`
	Artist    string `json:"artist,omitempty"`
	NameSong  string `json:"nameSong,omitempty"`
	Cover     string `json:"cover"`
	Track     string `json:"track"`
	// contains filtered or unexported fields
}

MusicData struct

func (*MusicData) AddDataToTmpDatabase added in v0.2.15

func (md *MusicData) AddDataToTmpDatabase(db *kaoriDatabase.NoSqlDb) error

Aggiunge il dato al database

func (*MusicData) CheckError added in v0.2.15

func (md *MusicData) CheckError() (err error)

CheckError esegue tutti i controlli per verificare che non siano stati inviati al server dati errati.

func (*MusicData) CheckImage added in v0.2.15

func (md *MusicData) CheckImage() (err error)

CheckImage controlla se è un'immagine e se è nei formati gestibili dal server

func (*MusicData) CheckTrack added in v0.2.15

func (md *MusicData) CheckTrack() (err error)

CheckTrack controlla se è un file mp3.

func (*MusicData) GetNameAnime added in v0.2.15

func (md *MusicData) GetNameAnime()

GetNameAnime setta mediante l'id di anilist il nome dell'anime

func (*MusicData) NormalizeName added in v0.2.15

func (md *MusicData) NormalizeName(musicNameTemplate string) error

NormalizeName genera il nome del file audio.

func (*MusicData) UploadTemporaryFile added in v0.2.15

func (md *MusicData) UploadTemporaryFile() error

UploadTemporaryFile carica un file temporaneo su "littlebox" che scade dopo 3 giorni.

type Notification added in v0.2.18

type Notification struct {
	IdNotification string `json:"id_notification"`
	Time           int64  `json:"time"`
	Description    string `json:"description"`
	Icon           string `json:"icon"`
}

type Notifications added in v0.2.18

type Notifications struct {
	Viewed    Notification `json:"viewed"`
	NotViewed Notification `json:"not_viewed"`
}

type Page added in v0.2.6

type Page struct {
	Number   string
	Language string
	Server   string
	Link     string
}

type Settings added in v0.2.18

type Settings struct {
	Graphics      GraphicSettings `json:"graphics,omitempty"`
	ShowBadge     bool            `json:"showBadge,omitempty"`
	IsPervert     bool            `json:"isPervert,omitempty"`
	ShowListAnime bool            `json:"showListAnime,omitempty"`
	ShowListManga bool            `json:"showListManga,omitempty"`
}

Settings è una struttura con tutte le preferenze dell'utente.

func (*Settings) IsValid added in v0.2.18

func (s *Settings) IsValid() error

IsValid verifica che i dati delle preferenze inviati dall'utente siano corretti.

type StreamLink struct {
	Link     string  `firestore:"link"`
	Fansub   string  `firestore:"fansub"`
	Duration float64 `firestore:"duration"`
	Bitrate  int     `firestore:"bitrate"`
}

type Track added in v0.2.15

type Track struct {
	Name         string
	Artist       string
	IdSoundCloud int
	Links        string
}

Track struct

type User added in v0.2.18

type User struct {
	Email          string           `json:"email"`
	Username       string           `json:"username"`
	Password       string           `json:"-"`
	ProfilePicture string           `json:"profilePicture"`
	Permission     string           `json:"permission"` //[u]ser,[c]reator,[t]ester,[a]admin
	IsDonator      bool             `json:"isDonator"`
	IsActive       bool             `json:"isActive"`
	AnilistId      int              `json:"anilistId"` //-1 se anilist non è stato collegato.
	DateSignUp     int64            `json:"dateSignUp"`
	ItemAdded      int              `json:"itemAdded" ` //Numero di item aggiunti al database
	Credits        int              `json:"credits"`    //Punti utili per guardare anime. Si guadagnano guardando pubblicità, donando o aggiungendo item al database.
	Level          int              `json:"level"`      //Si incrementa in base ai minuti passati sull'applicazione.
	Badges         []Badge          `json:"badges"`
	Settings       Settings         `json:"settings"`
	Notifications  Notifications    `json:"notifications"`
	RefreshToken   map[string]int64 `json:"-"`
}

User è una struttura con tutti i dati dell'utente.

func (*User) AddNewUser added in v0.2.18

func (u *User) AddNewUser(db *kaoriDatabase.NoSqlDb) error

AddNewUser aggiunge un nuovo utente al database.

func (*User) IsValid added in v0.2.18

func (u *User) IsValid() error

IsValid verifica che i dati utente inviati dal client in fase di registrazione siano corretti.

func (*User) NewUser added in v0.2.18

func (u *User) NewUser()

NewUser è il costruttore dell'oggetto User.

type Video added in v0.1.0

type Video struct {
	Language   string
	Modality   string
	Quality    *InfoQuality
	Server     string
	StreamLink *StreamLink
}

func NewVideo added in v0.1.0

func NewVideo() *Video

func (*Video) CheckVideo added in v0.2.8

func (v *Video) CheckVideo() error

func (*Video) GetQuality added in v0.1.0

func (v *Video) GetQuality(link string) error

func (*Video) SendToDbRel added in v0.2.15

func (v *Video) SendToDbRel(cl *sql.DB, episodeID int) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL