Documentation ¶
Index ¶
- type FileStorer
- type FileWatcher
- type FileWatcherFilmManager
- type FilmCacher
- type FilmFilterer
- type FilmManager
- func (fm FilmManager) AddFilm(film *model.Film, update bool) error
- func (fm FilmManager) CacheFilms()
- func (fm FilmManager) EditFilmWithLink(filmID, inputUrl string) error
- func (fm FilmManager) GetFilm(filmHexID string) (*model.Film, error)
- func (fm FilmManager) GetFilmPath(filmHexID, filmIndex string) (string, error)
- func (fm FilmManager) GetFilmSubtitlePath(filmHexID, filmIndex, subtitleIndex string) (string, error)
- func (fm FilmManager) GetFilms() []model.Film
- func (fm FilmManager) GetFilmsFiltered(years []int, genre, country, search string) []model.Film
- func (fm FilmManager) GetFilmsWithActor(actorID int64) (films []model.Film)
- func (fm FilmManager) GetFilmsWithDirector(directorID int64) (films []model.Film)
- func (fm FilmManager) GetFilmsWithWriter(writerID int64) (films []model.Film)
- type FilmMetadataGetter
- type FilmStorer
- type Filterer
- func (f *Filterer) AddFilm(film *model.Film)
- func (f *Filterer) AddFilms(films []model.Film)
- func (f *Filterer) GetCountries() []string
- func (f *Filterer) GetCountryName(code string) string
- func (f *Filterer) GetDecades() []model.Decade
- func (f *Filterer) GetGenres() []string
- func (f *Filterer) ParseParamsFilters(params string) (yearFilter string, years []int, genre, country string, page int, err error)
- type Paginater
- type PersonManager
- type PersonStorer
- type UserManager
- func (um UserManager) CheckLogin(username, password string) (user *model.User, err error)
- func (um UserManager) CreateOwner(username, password1, password2 string) (*model.User, error)
- func (um UserManager) CreateUser(username, password1, password2 string, isAdmin, isOwner bool) (*model.User, error)
- func (um UserManager) DeleteUser(userHexID string) error
- func (um UserManager) GetUser(userHexID string) (*model.User, error)
- func (um UserManager) GetUserNb() (int64, error)
- func (um UserManager) GetUsers() ([]model.User, error)
- func (um UserManager) SetUserPassword(username, oldPassword, password1, password2 string) error
- type UserStorer
- type VolumeFilmManager
- type VolumeManager
- type VolumeMetadataGetter
- type VolumeStorer
- type WatcherMetadataGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStorer ¶
type FileStorer interface { GetVolumes() ([]model.Volume, error) AddSubtitleToFilmPath(filmFilePath string, sub model.Subtitle) error RemoveSubtitleFile(mediaPath, subtitlePath string) error GetFilmFromPath(filmPath string) (film *model.Film, err error) UpdateFilmVolumeFile(film *model.Film, oldPath string, newVolumeFile model.VolumeFile) error DeleteFilmVolumeFile(path string) error IsFilmPathPresent(filmPath string) bool IsSubtitlePathPresent(subPath string) bool GetFilmsFromVolume(id primitive.ObjectID) (films []model.Film) }
type FileWatcher ¶
type FileWatcher struct { FileStorer FileWatcherFilmManager WatcherMetadataGetter // contains filtered or unexported fields }
func NewFileWatcher ¶
func NewFileWatcher(fs FileStorer, fm FileWatcherFilmManager, wmg WatcherMetadataGetter) *FileWatcher
func (*FileWatcher) AddVolume ¶
func (fw *FileWatcher) AddVolume(v *model.Volume)
func (*FileWatcher) Run ¶
func (fw *FileWatcher) Run() error
func (*FileWatcher) Stop ¶
func (fw *FileWatcher) Stop()
type FileWatcherFilmManager ¶ added in v1.1.0
type FilmCacher ¶
type FilmFilterer ¶ added in v1.1.0
FilmFilterer holds the different filters that can be applied
type FilmManager ¶
type FilmManager struct { FilmStorer FilmCacher FilmMetadataGetter FilmFilterer // contains filtered or unexported fields }
func NewFilmManager ¶ added in v1.1.0
func NewFilmManager(fs FilmStorer, fc FilmCacher, fdg FilmMetadataGetter, ff *Filterer) *FilmManager
func (FilmManager) CacheFilms ¶
func (fm FilmManager) CacheFilms()
func (FilmManager) EditFilmWithLink ¶
func (fm FilmManager) EditFilmWithLink(filmID, inputUrl string) error
func (FilmManager) GetFilm ¶
func (fm FilmManager) GetFilm(filmHexID string) (*model.Film, error)
GetFilm returns a Film from its hexadecimal ID
func (FilmManager) GetFilmPath ¶
func (fm FilmManager) GetFilmPath(filmHexID, filmIndex string) (string, error)
GetFilmPath returns the filepath to a film given its hexadecimal ID and its index in the volume file slice
func (FilmManager) GetFilmSubtitlePath ¶
func (fm FilmManager) GetFilmSubtitlePath(filmHexID, filmIndex, subtitleIndex string) (string, error)
GetFilmSubtitlePath returns the filepath to a subtitle for a film given the film's hexadecimal ID, the film's index in the volume file slice, and the subtitle's index in the external subtitle slice
func (FilmManager) GetFilms ¶
func (fm FilmManager) GetFilms() []model.Film
GetFilms returns the full slice of films in the database
func (FilmManager) GetFilmsFiltered ¶
func (fm FilmManager) GetFilmsFiltered(years []int, genre, country, search string) []model.Film
GetFilmsFiltered returns a slice of films, filtered with years of release date, genre, country, and search terms
func (FilmManager) GetFilmsWithActor ¶
func (fm FilmManager) GetFilmsWithActor(actorID int64) (films []model.Film)
func (FilmManager) GetFilmsWithDirector ¶
func (fm FilmManager) GetFilmsWithDirector(directorID int64) (films []model.Film)
func (FilmManager) GetFilmsWithWriter ¶
func (fm FilmManager) GetFilmsWithWriter(writerID int64) (films []model.Film)
type FilmMetadataGetter ¶
type FilmStorer ¶
type FilmStorer interface { GetFilms() ([]model.Film, error) GetFilmsFiltered(years []int, genre, country string) (films []model.Film) GetFilmsWithActor(actorID int64) (films []model.Film) GetFilmsWithDirector(directorID int64) (films []model.Film) GetFilmsWithWriter(writerID int64) (films []model.Film) GetFilmFromID(primitive.ObjectID) (*model.Film, error) GetPersonFromTMDBID(int64) (*model.Person, error) IsFilmPresent(film *model.Film) bool AddFilm(film *model.Film) error AddVolumeSourceToFilm(film *model.Film) error IsPersonPresent(personID int64) bool AddPerson(person *model.Person) }
type Filterer ¶
type Filterer struct { Decades []model.Decade Genres []string Countries []string // contains filtered or unexported fields }
func NewFilterer ¶ added in v1.1.0
func NewFilterer() *Filterer
func (*Filterer) AddFilm ¶
AddFilm adds release year if new min or max, and missing genres to the filter
func (*Filterer) AddFilms ¶
AddFilms adds release year if new min or max, and missing genres to the filter
func (*Filterer) GetCountries ¶
func (*Filterer) GetCountryName ¶
func (*Filterer) GetDecades ¶
type Paginater ¶ added in v1.1.0
type Paginater[T any] struct { // contains filtered or unexported fields }
Paginater implements the GetPagination method
func NewPaginater ¶ added in v1.1.0
NewPaginater instantiates a new Paginater
func (*Paginater[T]) GetPagination ¶ added in v1.1.0
func (p *Paginater[T]) GetPagination(currentPage int64, items []T) ([]T, []model.Pagination)
GetPagination creates a slice of the input elements and Pagination slice
type PersonManager ¶
type PersonManager struct {
PersonStorer
}
func NewPersonManager ¶ added in v1.1.0
func NewPersonManager(ps PersonStorer) *PersonManager
func (PersonManager) GetFilmStaff ¶
func (pm PersonManager) GetFilmStaff(film *model.Film) (cast []model.Cast, directors []model.Person, writers []model.Person, err error)
GetFilmStaff returns slices of cast, directors, and writers who worked on the film
func (PersonManager) GetPeople ¶
func (pm PersonManager) GetPeople() []model.Person
type PersonStorer ¶
type UserManager ¶
type UserManager struct {
UserStorer
}
func NewUserManager ¶ added in v1.1.0
func NewUserManager(us UserStorer) *UserManager
NewUserManager creates a new UserManager
func (UserManager) CheckLogin ¶
func (um UserManager) CheckLogin(username, password string) (user *model.User, err error)
CheckLogin checks that the login is correct and returns the user it corresponds to
func (UserManager) CreateOwner ¶
func (um UserManager) CreateOwner(username, password1, password2 string) (*model.User, error)
func (UserManager) CreateUser ¶
func (um UserManager) CreateUser(username, password1, password2 string, isAdmin, isOwner bool) (*model.User, error)
CreateUser checks that the user and password follow specific rules and adds it to the database
func (UserManager) DeleteUser ¶
func (um UserManager) DeleteUser(userHexID string) error
func (UserManager) GetUserNb ¶
func (um UserManager) GetUserNb() (int64, error)
func (UserManager) SetUserPassword ¶
func (um UserManager) SetUserPassword(username, oldPassword, password1, password2 string) error
SetUserPassword checks that the password change follows specific rules and updates it in the database
type UserStorer ¶
type UserStorer interface { IsOwnerPresent() (bool, error) IsUsernameAvailable(username string) (bool, error) GetUserFromName(username string, user *model.User) error GetUserFromID(id primitive.ObjectID) (*model.User, error) GetUserNb() (int64, error) GetUsers() ([]model.User, error) CreateUser(user *model.User) error DeleteUser(userId primitive.ObjectID) error SetUserPassword(userID primitive.ObjectID, newPassword string) error }
type VolumeFilmManager ¶ added in v1.1.0
type VolumeManager ¶
type VolumeManager struct { VolumeStorer VolumeMetadataGetter VolumeFilmManager *FileWatcher }
func NewVolumeManager ¶ added in v1.1.0
func NewVolumeManager(vs VolumeStorer, fw *FileWatcher, fm VolumeFilmManager, m VolumeMetadataGetter) *VolumeManager
NewVolumeManager instantiates a new VolumeManager
func (VolumeManager) CreateVolume ¶
func (vm VolumeManager) CreateVolume(name, path string, isRecursive bool, mediaType string) error
func (VolumeManager) DeleteVolume ¶
func (vm VolumeManager) DeleteVolume(volumeHexID string) error
func (VolumeManager) GetVolume ¶
func (vm VolumeManager) GetVolume(volumeHexID string) (*model.Volume, error)
func (VolumeManager) GetVolumes ¶
func (vm VolumeManager) GetVolumes() ([]model.Volume, error)