model

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityEpisode

type ActivityEpisode struct {
	Date    time.Time
	Episode Episode
}

type ActivityMovie

type ActivityMovie struct {
	Date  time.Time
	Movie Movie
}

type ActivityPlaylist

type ActivityPlaylist struct {
	gorm.Model
	User    string    `gorm:"index:idx_playlist_user" json:"-"`
	Title   string    // Album title, Station name, etc.
	Creator string    // Artist name, Podcast author
	Image   string    //
	Ref     string    //
	Date    time.Time `gorm:"uniqueIndex:idx_playlist_date"`
}

album, playlist or podcast listening event.

type ActivityRelease

type ActivityRelease struct {
	Date    time.Time
	Release Release
}

type ActivityTrack

type ActivityTrack struct {
	Date  time.Time
	Track Track
}

type Artist

type Artist struct {
	gorm.Model
	Name           string `gorm:"uniqueIndex:idx_artist_name"`
	SortName       string
	ARID           string `gorm:"uniqueIndex:idx_artist_arid"`
	Disambiguation string
	Country        string
	Area           string
	Date           time.Time
	EndDate        time.Time
	Genre          string
}

Artist info from MusicBrainz.

type ArtistBackground

type ArtistBackground struct {
	gorm.Model
	Artist string `gorm:"uniqueIndex:idx_artist_bg"`
	URL    string `gorm:"uniqueIndex:idx_artist_bg"`
	Source string `gorm:"uniqueIndex:idx_artist_bg"`
	Rank   int
}

type ArtistImage

type ArtistImage struct {
	gorm.Model
	Artist string `gorm:"uniqueIndex:idx_artist_img"`
	URL    string `gorm:"uniqueIndex:idx_artist_img"`
	Source string `gorm:"uniqueIndex:idx_artist_img"`
	Rank   int
}

type ArtistTag

type ArtistTag struct {
	gorm.Model
	Artist string `gorm:"uniqueIndex:idx_tag"`
	Tag    string `gorm:"uniqueIndex:idx_tag"`
	Count  int
}

Artist tags from MusicBrainz.

type Cast

type Cast struct {
	gorm.Model
	TMID      int64 `gorm:"index:idx_cast_tmid"`
	PEID      int64 `gorm:"index:idx_cast_peid"`
	Character string
	Rank      int
	Person    Person `gorm:"-"`
}

func (Cast) TableName

func (Cast) TableName() string

type Collection

type Collection struct {
	gorm.Model
	Name     string
	SortName string
	TMID     int64
}

type Crew

type Crew struct {
	gorm.Model
	TMID       int64
	PEID       int64
	Department string
	Job        string
	Person     Person `gorm:"-"`
}

func (Crew) TableName

func (Crew) TableName() string

type Episode

type Episode struct {
	gorm.Model
	SID         string // series ID
	EID         string `gorm:"uniqueIndex:idx_episode"` // GUID
	Title       string
	Author      string
	Link        string
	Description string
	ContentType string
	Size        int64
	URL         string
	Date        time.Time // publish time
	Image       string
}

type EpisodeEvent

type EpisodeEvent struct {
	gorm.Model
	User string    `gorm:"index:idx_episode_user" json:"-"`
	Date time.Time `gorm:"uniqueIndex:idx_episode_date"`
	EID  string
}

type Events

type Events struct {
	MovieEvents   []MovieEvent
	ReleaseEvents []ReleaseEvent
	EpisodeEvents []EpisodeEvent
	TrackEvents   []TrackEvent
}

type Genre

type Genre struct {
	gorm.Model
	TMID int64
	Name string
}

type Keyword

type Keyword struct {
	gorm.Model
	TMID int64
	Name string
}

type Media

type Media struct {
	gorm.Model
	REID       string `gorm:"uniqueIndex:idx_media"`
	Name       string `gorm:"uniqueIndex:idx_media"`
	Position   int    `gorm:"uniqueIndex:idx_media"`
	Format     string
	TrackCount int
}

Release Media from MusicBrainz.

type Movie

type Movie struct {
	gorm.Model
	UUID             string `gorm:"index:idx_movie_uuid" json:"-"`
	TMID             int64  `gorm:"uniqueIndex:idx_movie_tmid"`
	IMID             string
	Title            string
	Date             time.Time
	Rating           string
	Tagline          string
	OriginalTitle    string
	OriginalLanguage string
	Overview         string
	Budget           int64
	Revenue          int64
	Runtime          int
	VoteAverage      float32
	VoteCount        int
	BackdropPath     string
	PosterPath       string
	SortTitle        string
	Key              string
	Size             int64
	ETag             string
	LastModified     time.Time
}

func (*Movie) BeforeCreate

func (m *Movie) BeforeCreate(tx *g.DB) (err error)

type MovieEvent

type MovieEvent struct {
	gorm.Model
	User string    `gorm:"index:idx_movie_user" json:"-"`
	Date time.Time `gorm:"uniqueIndex:idx_movie_date"`
	TMID string
	IMID string
	ETag string `gorm:"-"`
}

type Offset

type Offset struct {
	gorm.Model
	User     string    `gorm:"index:idx_offset_user" json:"-"`
	ETag     string    `gorm:"uniqueIndex:idx_offset_etag;uniqueIndex:idx_offset_date"`
	Offset   int       `gorm:"default:0"`
	Duration int       `gorm:"default:0"`
	Date     time.Time `gorm:"uniqueIndex:idx_offset_date"`
}

func (Offset) Valid

func (o Offset) Valid() bool

type Offsets

type Offsets struct {
	Offsets []Offset
}

type Person

type Person struct {
	gorm.Model
	PEID        int64 `gorm:"uniqueIndex:idx_person_peid"`
	IMID        string
	Name        string
	ProfilePath string
	Bio         string
	Birthplace  string
	Birthday    time.Time
	Deathday    time.Time
}

func (Person) TableName

func (Person) TableName() string

type Playlist

type Playlist struct {
	gorm.Model
	User       string `gorm:"uniqueIndex:idx_playlist"`
	Name       string `gorm:"uniqueIndex:idx_playlist"`
	Playlist   []byte
	TrackCount int
}
type Popular struct {
	gorm.Model
	Artist string `gorm:"uniqueIndex:idx_popular"`
	Title  string `gorm:"uniqueIndex:idx_popular"`
	Rank   int
}

Popular tracks for an artist from Last.fm.

func (Popular) TableName

func (Popular) TableName() string

type Recommend

type Recommend struct {
	Name   string
	Movies []Movie
}

type Release

type Release struct {
	gorm.Model
	Artist         string `gorm:"uniqueIndex:idx_release;index:idx_release_artist"`
	Name           string `gorm:"uniqueIndex:idx_release;index:idx_release_name" sql:"collate:nocase"`
	RGID           string `gorm:"index:idx_release_rgid"`
	REID           string `gorm:"uniqueIndex:idx_release;index:idx_release_reid"`
	Disambiguation string
	Asin           string
	Country        string
	Type           string `gorm:"index:idx_release_type"`
	SecondaryType  string
	Date           time.Time `gorm:"index:idx_release_rgdate"` // rg first release
	ReleaseDate    time.Time `gorm:"index:idx_release_redate"` // re release date
	Status         string
	TrackCount     int
	DiscCount      int
	Artwork        bool
	FrontArtwork   bool
	BackArtwork    bool
	OtherArtwork   string
	GroupArtwork   bool
	Media          []Media `gorm:"-"`
	SingleName     string  `gorm:"index:idx_release_single_name"`
}

Release info from MusicBrainz.

func (Release) Official

func (r Release) Official() bool

type ReleaseEvent

type ReleaseEvent struct {
	gorm.Model
	User string    `gorm:"index:idx_release_user" json:"-"`
	Date time.Time `gorm:"uniqueIndex:idx_release_date"`
	RGID string
	REID string
}

type Scrobble

type Scrobble struct {
	Artist      string    `json:""` // Required
	Track       string    `json:""` // Required
	Timestamp   time.Time `json:""` // Required
	Album       string    `json:""` // Optional
	AlbumArtist string    `json:""` // Optional
	TrackNumber int       `json:""` // Optional
	Duration    int       `json:""` // Optional - Length of track in seconds
	MBID        string    `json:""` // Optional - recording (or track?) MBID
}

Scrobble is a track listening event.

Spec location: https://www.last.fm/api/show/track.scrobble not using: context, streamId, chosenByUser

func (Scrobble) PreferredArtist

func (s Scrobble) PreferredArtist() string

type Series

type Series struct {
	gorm.Model
	SID         string `gorm:"uniqueIndex:idx_series"` // hash of link
	Title       string
	Description string
	Author      string
	Link        string
	Image       string
	Copyright   string
	Date        time.Time // last build date
	TTL         int
}

func (Series) TableName

func (Series) TableName() string

type Similar

type Similar struct {
	gorm.Model
	Artist string `gorm:"uniqueIndex:idx_similar"`
	ARID   string `gorm:"uniqueIndex:idx_similar"`
	Rank   int
}

Similar artist info from Last.fm

func (Similar) TableName

func (Similar) TableName() string

type Station

type Station struct {
	gorm.Model
	User        string `gorm:"uniqueIndex:idx_station" json:"-"`
	Name        string `gorm:"uniqueIndex:idx_station"`
	Creator     string
	Ref         string `json:"-"`
	Shared      bool   `json:"-"`
	Type        string
	Image       string
	Description string
	Playlist    []byte `json:"-"`
}

func (*Station) Visible

func (s *Station) Visible(user string) bool

type Subscription added in v0.11.8

type Subscription struct {
	gorm.Model
	SID  string `gorm:"primaryKey"`
	User string `gorm:"primaryKey"`
}

type TVEpisode

type TVEpisode struct {
	gorm.Model
	EPID         int64 `gorm:"uniqueIndex:idx_episode_epid"`
	TVID         int64
	Name         string
	Overview     string
	Date         string
	StillPath    string
	Season       int
	Episode      int
	VoteAverage  float32
	VoteCount    int
	Key          string
	Size         int64
	ETag         string
	LastModified time.Time
}

type TVShow

type TVShow struct {
	gorm.Model
	TVID             int64 `gorm:"uniqueIndex:idx_tvshow_tvid"`
	Name             string
	SortName         string
	Date             time.Time
	EndDate          time.Time
	Tagline          string
	OriginalName     string
	OriginalLanguage string
	Overview         string
	BackdropPath     string
	PosterPath       string
	SeasonCount      int
	EpisodeCount     int
	VoteAverage      float32
	VoteCount        int
}

type Track

type Track struct {
	gorm.Model
	UUID         string `gorm:"index:idx_track_uuid"`
	Artist       string `spiff:"creator" gorm:"index:idx_track_artist"`
	Release      string `gorm:"index:idx_track_release"`
	Date         string `gorm:"index:idx_track_date"`
	TrackNum     int    `spiff:"tracknum"`
	DiscNum      int
	Title        string `spiff:"title" gorm:"index:idx_track_title"`
	Key          string // TODO - unique constraint
	Size         int64
	ETag         string
	LastModified time.Time
	TrackCount   int
	DiscCount    int
	REID         string `gorm:"index:idx_track_reid"`
	RGID         string `gorm:"index:idx_track_rgid"`
	RID          string `gorm:"index:idx_track_rid"`  // recording id
	ARID         string `gorm:"index:idx_track_arid"` // TODO only for local right now
	MediaTitle   string
	ReleaseTitle string `spiff:"album"`
	TrackArtist  string // artist with featured artists
	ReleaseDate  time.Time
	Artwork      bool
	FrontArtwork bool
	BackArtwork  bool
	OtherArtwork string
	GroupArtwork bool
}

Tracks from S3 bucket object names. Naming is adjusted based on data from MusicBrainz.

func (*Track) BeforeCreate

func (t *Track) BeforeCreate(tx *g.DB) (err error)

func (Track) PreferredArtist

func (t Track) PreferredArtist() string

Prefer A feat. B instead of just A.

type TrackEvent

type TrackEvent struct {
	gorm.Model
	User string    `gorm:"index:idx_track_user" json:"-"`
	Date time.Time `gorm:"uniqueIndex:idx_track_date"` // TODO dup index name w/ music
	RID  string
	RGID string
	ETag string `gorm:"-"`
}

Jump to

Keyboard shortcuts

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