models

package
v0.0.0-...-fd3d004 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID        primitive.ObjectID   `json:"_id,omitempty" bson:"_id,omitempty"`
	Name      string               `json:"name,omitempty" bson:"name,omitempty"`
	Artist    primitive.ObjectID   `json:"artist" bson:"artist,omitempty"`
	Artists   []primitive.ObjectID `json:"artists" bson:"artists,omitempty"`
	Picture   string               `json:"picture,omitempty" bson:"picture,omitempty"`
	Year      int                  `json:"year,omitempty" bson:"year,omitempty"`
	CreatedAt time.Time            `json:"created_at,omitempty" bson:"created_at,omitempty"`
}

Album - Album of songs

func (*Album) FindOrCreate

func (*Album) FindOrCreate(
	data AlbumSearchData,
	col *mongo.Collection,
	host, artPath string,
	spotifyClient, spotifySecret string,
) (album Album, err error)

FindOrCreate - Find or create an album

type AlbumSearchData

type AlbumSearchData struct {
	Album   string   `json:"album,omitempty" bson:"album,omitempty"`
	Artist  Artist   `json:"artist,omitempty" bson:"artist,omitempty"`
	Artists []Artist `json:"artists,omitempty" bson:"artists,omitempty"`
	Year    int      `json:"year,omitempty" bson:"year,omitempty"`
	Picture []byte   `json:"picture,omitempty" bson:"picture,omitempty"`
}

AlbumSearchData - Search data structure for the findOrCreate function

type Artist

type Artist struct {
	ID        primitive.ObjectID `json:"_id" bson:"_id"`
	Name      string             `json:"name" bson:"name"`
	Picture   string             `json:"picture" bson:"picture"`
	CreatedAt time.Time          `json:"created_at" bson:"created_at"`
}

Artist - an artist of music stored in the DB

func (*Artist) FindOrCreate

func (*Artist) FindOrCreate(
	db *mongo.Database,
	names []string,
	spotifyClient, spotifySecret string,
) (artists []Artist, err error)

FindOrCreate - Find or create an artist document

type Genre

type Genre struct {
	ID   primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Name string             `json:"name" bson:"name"`
}

Genre - Genre model

type Info

type Info struct {
	ID       primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Start    time.Time          `json:"start,omitempty" bson:"start,omitempty"`
	End      time.Time          `json:"end,omitempty" bson:"end,omitempty"`
	LastScan time.Time          `json:"last_scan,omitempty" bson:"last_scan,omitempty"`
	Seconds  int                `json:"seconds,omitempty" bson:"seconds,omitempty"`
	Tracks   int                `json:"tracks,omitempty" bson:"tracks,omitempty"`
	Albums   int                `json:"albums,omitempty" bson:"albums,omitempty"`
	Artists  int                `json:"artists,omitempty" bson:"artists,omitempty"`
	Size     int                `json:"size,omitempty" bson:"size,omitempty"`
	Mount    string             `json:"mount,omitempty" bson:"mount,omitempty"`
}

Info - information

type Playlist

type Playlist struct {
	ID        primitive.ObjectID `json:"_id" bson:"_id"`
	Name      string             `json:"name" bson:"name"`
	UpdatedAt time.Time          `json:"updated_at" bson:"updated_at"`
	CreatedAt time.Time          `json:"created_at" bson:"created_at"`
	Tracks    []Track            `json:"tracks" bson:"tracks"`
}

Playlist - A list of songs grouped together

type PlaylistBasic

type PlaylistBasic struct {
	ID        primitive.ObjectID   `json:"_id" bson:"_id"`
	Name      string               `json:"name" bson:"name"`
	UpdatedAt time.Time            `json:"updated_at" bson:"updated_at"`
	CreatedAt time.Time            `json:"created_at" bson:"created_at"`
	Tracks    []primitive.ObjectID `json:"tracks" bson:"tracks"`
}

type PlaylistExtended

type PlaylistExtended struct {
	ID        string    `json:"_id" bson:"_id"`
	UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
	CreatedAt time.Time `json:"created_at" bson:"created_at"`
	Name      string    `json:"name" bson:"name"`
	Tracks    int64     `json:"tracks"`
	Pictures  []string  `json:"pictures"`
	ReadOnly  bool      `json:"readonly"`
}

type PlaylistPopulated

type PlaylistPopulated struct {
	ID        primitive.ObjectID `json:"_id" bson:"_id"`
	Name      string             `json:"name" bson:"name"`
	UpdatedAt time.Time          `json:"updated_at" bson:"updated_at"`
	CreatedAt time.Time          `json:"created_at" bson:"created_at"`
	Tracks    []TrackExtended    `json:"tracks" bson:"tracks"`
}

type Track

type Track struct {
	ID         primitive.ObjectID   `json:"_id,omitempty" bson:"_id,omitempty"`
	Album      primitive.ObjectID   `json:"album,omitempty" bson:"album,omitempty"`
	Artist     string               `json:"artist" bson:"artist"`
	Artists    []primitive.ObjectID `json:"artists,omitempty" bson:"artists,omitempty"`
	CreatedAt  time.Time            `json:"created_at,omitempty" bson:"created_at,omitempty"`
	Duration   int                  `json:"duration" bson:"duration"`
	Favourited bool                 `json:"favourited" bson:"favourited"`
	Genre      primitive.ObjectID   `json:"genre,omitempty" bson:"genre,omitempty"`
	LastPlay   time.Time            `json:"last_play,omitempty" bson:"last_play,omitempty"`
	Lossless   bool                 `json:"lossless" bson:"lossless"`
	Name       string               `json:"name" bson:"name"`
	Path       string               `json:"path,omitempty" bson:"path,omitempty"`
	Plays      int                  `json:"plays" bson:"plays"`
	UpdatedAt  time.Time            `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
	Year       int                  `json:"year,omitempty" bson:"year,omitempty"`
}

Track - a single track able to be played

type TrackExtended

type TrackExtended struct {
	ID         primitive.ObjectID `json:"_id,omitempty" bson:"_id,omitempty"`
	Album      Album              `json:"album,omitempty" bson:"album,omitempty"`
	Artist     string             `json:"artist" bson:"artist"`
	Artists    []Artist           `json:"artists,omitempty" bson:"artists,omitempty"`
	CreatedAt  time.Time          `json:"created_at,omitempty" bson:"created_at,omitempty"`
	Duration   int                `json:"duration" bson:"duration"`
	Favourited bool               `json:"favourited" bson:"favourited"`
	Genre      Genre              `json:"genre,omitempty" bson:"genre,omitempty"`
	LastPlay   time.Time          `json:"last_play,omitempty" bson:"last_play,omitempty"`
	Lossless   bool               `json:"lossless" bson:"lossless"`
	Name       string             `json:"name" bson:"name"`
	Path       string             `json:"path,omitempty" bson:"path,omitempty"`
	Plays      int                `json:"plays" bson:"plays"`
	UpdatedAt  time.Time          `json:"updated_at,omitempty" bson:"updated_at,omitempty"`
	Year       int                `json:"year,omitempty" bson:"year,omitempty"`
}

Jump to

Keyboard shortcuts

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