data

package
v0.0.0-...-15c58b5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	UseTestDatabase bool
	// contains filtered or unexported fields
}

Database represents a connection to the SoftIMDB database.

func DatabaseNew

func DatabaseNew(useTestDB bool, config *config.Config) *Database

DatabaseNew creates a new SoftIMDB Database object.

func (*Database) CloseDatabase

func (d *Database) CloseDatabase()

CloseDatabase closes the database.

func (*Database) DeleteIgnorePath

func (d *Database) DeleteIgnorePath(ignorePath *IgnoredPath) error

DeleteIgnorePath deletes a path from the ignored paths

func (*Database) DeleteMovie

func (d *Database) DeleteMovie(movie *Movie) error

DeleteMovie removes a movie from the database.

func (*Database) GetAllIgnoredPaths

func (d *Database) GetAllIgnoredPaths() ([]*IgnoredPath, error)

GetAllIgnoredPaths returns all ignored paths.

func (*Database) GetAllMoviePaths

func (d *Database) GetAllMoviePaths() (*[]string, error)

GetAllMoviePaths returns a list of all the movie paths in the database. Used when adding new movies.

func (*Database) GetAllMovies

func (d *Database) GetAllMovies(currentView string, searchFor string, categoryId int, orderBy string) ([]*Movie, error)

GetAllMovies returns all movies in the database that matches the search criteria.

func (*Database) GetImage

func (d *Database) GetImage(id int) (*Image, error)

GetImage returns an image from the database.

func (*Database) GetMovie

func (d *Database) GetMovie(id int) (*Movie, error)

GetMovie returns a movie from the database.

func (*Database) GetOrInsertTag

func (d *Database) GetOrInsertTag(tag *Tag) (*Tag, error)

GetOrInsertTag either returns an existing tag or inserts a new tag and returns it.

func (*Database) GetSettings

func (d *Database) GetSettings() (*Setting, error)

GetSettings returns the settings.

func (*Database) GetTagByName

func (d *Database) GetTagByName(name string) (*Tag, error)

GetTagByName returns a tag by name.

func (*Database) GetTags

func (d *Database) GetTags() ([]Tag, error)

GetTags returns all tags

func (*Database) GetTagsForMovie

func (d *Database) GetTagsForMovie(movie *Movie) ([]Tag, error)

GetTagsForMovie returns a list of tags connected to the given movie.

func (*Database) InsertIgnorePath

func (d *Database) InsertIgnorePath(ignorePath *IgnoredPath) error

InsertIgnorePath inserts a path to be ignored.

func (*Database) InsertImage

func (d *Database) InsertImage(image *Image) error

InsertImage inserts an image into the database.

func (*Database) InsertMovie

func (d *Database) InsertMovie(movie *Movie) error

InsertMovie adds a new movie to the database.

func (*Database) InsertMovieTag

func (d *Database) InsertMovieTag(movie *Movie, tag *Tag) error

InsertMovieTag inserts a movie tag into the database.

func (*Database) RemoveMovieTag

func (d *Database) RemoveMovieTag(movie *Movie, tag *Tag) error

RemoveMovieTag removes a movie tag from the database.

func (*Database) UpdateImage

func (d *Database) UpdateImage(movie *Movie, imageData []byte) error

UpdateImage removes an image from the database.

func (*Database) UpdateMovie

func (d *Database) UpdateMovie(movie *Movie, updateTags bool) error

UpdateMovie update a movie.

type IgnoredPath

type IgnoredPath struct {
	Id               int    `gorm:"column:id;primary_key"`
	Path             string `gorm:"column:path;size:1024"`
	IgnoreCompletely bool   `gorm:"column:ignore_completely;"`
}

IgnoredPath represents the table IgnoredPath.

func (*IgnoredPath) TableName

func (i *IgnoredPath) TableName() string

TableName returns the table name.

type Image

type Image struct {
	Id   int    `gorm:"column:id;primary_key"`
	Data []byte `gorm:"column:image;"`
}

Image represents a movie image.

func (*Image) TableName

func (i *Image) TableName() string

TableName returns the name of the table.

type ImageCache

type ImageCache struct {
	// contains filtered or unexported fields
}

ImageCache represents an image cache that loads the images from the local filesystem.

func ImageCacheNew

func ImageCacheNew() *ImageCache

ImageCacheNew creates a new ImageCache.

func (*ImageCache) Load

func (i *ImageCache) Load(index int) []byte

Load loads the image from the cache.

func (*ImageCache) Save

func (i *ImageCache) Save(index int, image []byte)

Save saves the image to the cache.

type Movie

type Movie struct {
	Id         int     `gorm:"column:id;primary_key"`
	Title      string  `gorm:"column:title;size:100"`
	SubTitle   string  `gorm:"column:sub_title;size:100"`
	Year       int     `gorm:"column:year;"`
	ImdbRating float32 `gorm:"column:imdb_rating;"`
	MyRating   int     `gorm:"column:my_rating;"`
	ImdbUrl    string  `gorm:"column:imdb_url;size:1024"`
	ImdbID     string  `gorm:"column:imdb_id;size:9"`
	StoryLine  string  `gorm:"column:story_line;size:65535"`
	MoviePath  string  `gorm:"column:path;size:1024"`
	Runtime    int     `gorm:"column:length"`
	Tags       []Tag   `gorm:"-"`

	HasImage  bool   `gorm:"-"`
	Image     []byte `gorm:"-"`
	ImageId   int    `gorm:"column:image_id;"`
	ImagePath string `gorm:"column:image_path;size:1024"` // Not used yet
	ToWatch   bool   `gorm:"column:to_watch"`
	Pack      string `gorm:"column:pack"`
}

Movie represents a movie in the database.

func (*Movie) TableName

func (m *Movie) TableName() string

TableName returns the name of the table.

type MovieTag

type MovieTag struct {
	MovieId int `gorm:"column:movie_id;primary_key;"`
	TagId   int `gorm:"column:tag_id;primary_key;"`
}

MovieTag represents a tag and a movie.

func (*MovieTag) TableName

func (m *MovieTag) TableName() string

TableName returns the movie_tag table name.

type Setting

type Setting struct {
	Id       int    `gorm:"column:id;primary_key"`
	BasePath string `gorm:"column:base_path;size:1024"`
	IsSamba  bool   `gorm:"column:is_samba;"`
}

Setting represents SoftIMDB settings table.

func (*Setting) TableName

func (s *Setting) TableName() string

TableName returns the name of the table.

type Tag

type Tag struct {
	Id        int     `gorm:"column:id;primary_key"`
	Name      string  `gorm:"column:name;size:255"`
	IsPrivate bool    `gorm:"column:is_private;"`
	Movies    []Movie `gorm:"-"`
}

Tag represents a movie tag.

func (*Tag) TableName

func (t *Tag) TableName() string

TableName returns the tag table name.

type TagCache

type TagCache struct {
	// contains filtered or unexported fields
}

func NewTagCache

func NewTagCache() *TagCache

func (*TagCache) Add

func (t *TagCache) Add(tag *Tag)

func (*TagCache) GetById

func (t *TagCache) GetById(id int) *Tag

func (*TagCache) GetByName

func (t *TagCache) GetByName(name string) *Tag

Jump to

Keyboard shortcuts

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