repository

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MediaTypeMovie   MediaType = "Movie"
	MediaTypeTvShow  MediaType = "TvShow"
	MediaTypeEpisode MediaType = "Episode"

	VideoCodecH264 VideoCodec = "H264"
	VideoCodecH265 VideoCodec = "H265"
	VideoCodecHEVC VideoCodec = "HEVC"

	AudioCodecAAC    AudioCodec = "AAC"
	AudioCodecAC3    AudioCodec = "AC3"
	AudioCodecEAC3   AudioCodec = "EAC3"
	AudioCodecMP3    AudioCodec = "MP3"
	AudioCodecDTS    AudioCodec = "DTS"
	AudioCodecVorbis AudioCodec = "Vorbis"

	SubtitleCodecSRT    SubtitleCodec = "SRT"
	SubtitleCodecSUBRIP SubtitleCodec = "SUBRIP"
	SubtitleCodecASS    SubtitleCodec = "ASS"
)

Variables

This section is empty.

Functions

func Migrate

func Migrate(db *gorm.DB) error

Types

type Audio

type Audio struct {
	Model
	Codec       AudioCodec
	Language    string
	Bitrate     float64
	MediaFileID string    `gorm:"type:uuid;not null"`
	MediaFile   MediaFile `gorm:"reference:MediaFileID"`
}

type AudioCodec

type AudioCodec string

type Category

type Category struct {
	Model
	Name   string  `gorm:"uniqueIndex"`
	Medias []Media `gorm:"many2many:category_media"`
}

type CategoryMedia

type CategoryMedia struct {
	MediaID    string   `gorm:"type:uuid;primaryKey"`
	Media      Media    `gorm:"reference:MediaID;constraint:OnDelete:CASCADE;"`
	CategoryID string   `gorm:"type:uuid;primaryKey"`
	Category   Category `gorm:"reference:CategoryID;constraint:OnDelete:CASCADE;"`
}

type Episode

type Episode struct {
	Model
	Name        string
	NbEpisode   int
	NbSeason    int
	MediaID     string    `gorm:"type:uuid;not null"`
	Media       Media     `gorm:"reference:MediaID"`
	TvShowID    string    `gorm:"type:uuid;not null"`
	TvShow      TvShow    `gorm:"reference:TvShowID"`
	MediaFileID string    `gorm:"type:uuid;not null"`
	MediaFile   MediaFile `gorm:"reference:MediaFileID;constraint:OnDelete:CASCADE;"`
}

type Media

type Media struct {
	Model
	MediaType   MediaType  `gorm:"index"`
	TmdbID      int        `gorm:"uniqueIndex"`
	ReleaseDate time.Time  `gorm:"type:date"`
	TvShows     []TvShow   `gorm:"foreignKey:MediaID;constraint:OnDelete:CASCADE;"`
	Movies      []Movie    `gorm:"foreignKey:MediaID;constraint:OnDelete:CASCADE;"`
	Episodes    []Episode  `gorm:"foreignKey:MediaID;constraint:OnDelete:CASCADE;"`
	Categories  []Category `gorm:"many2many:category_media;constraint:OnDelete:CASCADE;"`
}

type MediaFile

type MediaFile struct {
	Model
	Filename  string
	Size      float64
	Duration  float64
	Codec     VideoCodec
	Mimetype  string
	Audio     []Audio    `gorm:"foreignKey:MediaFileID;constraint:OnDelete:CASCADE;"`
	Subtitles []Subtitle `gorm:"foreignKey:MediaFileID;constraint:OnDelete:CASCADE;"`
}

type MediaType

type MediaType string

type Model

type Model struct {
	ID        string `gorm:"type:uuid;primaryKey;default:uuid_generate_v4()"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type Movie

type Movie struct {
	Model
	Name        string
	MediaID     string    `gorm:"type:uuid;not null"`
	Media       Media     `gorm:"reference:MediaID"`
	MediaFileID string    `gorm:"type:uuid;not null"`
	MediaFile   MediaFile `gorm:"reference:MediaFileID;constraint:OnDelete:CASCADE;"`
}

type Rating

type Rating struct {
	UserID  string `gorm:"type:uuid;primaryKey"`
	MediaID string `gorm:"type:uuid;primaryKey"`
	Media   Media  `gorm:"reference:MediaID;constraint:OnDelete:CASCADE;"`
	Rating  int
}

type Subtitle

type Subtitle struct {
	Model
	Codec       SubtitleCodec
	Language    string
	MediaFileID string    `gorm:"type:uuid;not null"`
	MediaFile   MediaFile `gorm:"reference:MediaFileID"`
}

type SubtitleCodec

type SubtitleCodec string

type TvShow

type TvShow struct {
	Model
	Name     string
	MediaID  string    `gorm:"type:uuid;not null"`
	Media    Media     `gorm:"reference:MediaID"`
	Episodes []Episode `gorm:"foreignKey:TvShowID;constraint:OnDelete:CASCADE;"`
}

type VideoCodec

type VideoCodec string

Jump to

Keyboard shortcuts

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