data

package
v0.0.0-...-f7fb3ed Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 11 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(rootDir string, 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) GetAllMovieTitles

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

GetAllMovieTitles returns a list of all the movie title in the database. Used when adding new movies.

func (*Database) GetGenres

func (d *Database) GetGenres() ([]Genre, error)

GetGenres returns all genres

func (*Database) InsertIgnorePath

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

InsertIgnorePath inserts a path to be ignored.

func (*Database) InsertMovie

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

InsertMovie adds a new movie to the database.

func (*Database) InsertMovieGenre

func (d *Database) InsertMovieGenre(movie *Movie, Genre *Genre) error

InsertMovieGenre inserts a movie Genre into the database.

func (*Database) RemoveMovieGenre

func (d *Database) RemoveMovieGenre(movie *Movie, genre *Genre) error

RemoveMovieGenre removes a movie genre from the database.

func (*Database) SearchMovies

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

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

func (*Database) UpdateImage

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

UpdateImage replaces an image in the database.

func (*Database) UpdateMovie

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

UpdateMovie update a movie.

type Genre

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

Genre represents a movie genre.

func (*Genre) TableName

func (t *Genre) TableName() string

TableName returns the genre table name.

type GenreCache

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

func NewGenreCache

func NewGenreCache() *GenreCache

func (*GenreCache) GetByName

func (t *GenreCache) GetByName(name string) *Genre

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 ImageCache

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

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

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"`
	Genres     []Genre `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"`
	NeedsSubtitle bool   `gorm:"column:needsSubtitle"`
}

Movie represents a movie in the database.

func (*Movie) TableName

func (m *Movie) TableName() string

TableName returns the name of the table.

type MovieGenre

type MovieGenre struct {
	MovieId int `gorm:"column:movie_id;primary_key;"`
	GenreId int `gorm:"column:genre_id;primary_key;"`
}

MovieGenre represents a Genre and a movie.

func (*MovieGenre) TableName

func (m *MovieGenre) TableName() string

TableName returns the movie_Genre table name.

Jump to

Keyboard shortcuts

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