Documentation ¶
Index ¶
- type Cache
- func (c Cache) CacheBackdrop(sourceUrl, key string) (hasToWait bool, err error)
- func (c Cache) CacheFile(sourceUrl string, filePath string) (hasToWait bool, err error)
- func (c Cache) CachePhoto(sourceUrl, key string) (hasToWait bool, err error)
- func (c Cache) CachePoster(sourceUrl, key string) (hasToWait bool, err error)
- func (c Cache) GetCachedPath(filePath string) string
- type Metadata
- type MetadataWrapper
- func (mw MetadataWrapper) CreateFilm(file string, volumeID primitive.ObjectID, subFiles []string) *model.Film
- func (mw MetadataWrapper) FetchFilmTMDBID(f *model.Film) error
- func (mw MetadataWrapper) GetBackdropLink(key string) string
- func (mw MetadataWrapper) GetPersonDetails(personID int64) *model.Person
- func (mw MetadataWrapper) GetPhotoLink(key string) string
- func (mw MetadataWrapper) GetPosterLink(key string) string
- func (mw MetadataWrapper) GetTMDBIDFromLink(inputUrl string) (tmdbID int, err error)
- func (mw MetadataWrapper) UpdateFilmDetails(film *model.Film)
- type MongoDB
- func (m *MongoDB) AddActors(actors []model.Person)
- func (m *MongoDB) AddFilm(film *model.Film) error
- func (m *MongoDB) AddPerson(person *model.Person)
- func (m *MongoDB) AddSubtitleToFilmPath(filmFilePath string, sub model.Subtitle) error
- func (m *MongoDB) AddVolume(volume *model.Volume) error
- func (m *MongoDB) AddVolumeSourceToFilm(film *model.Film) error
- func (m *MongoDB) Close() error
- func (m *MongoDB) CreateUser(user *model.User) error
- func (m *MongoDB) DeleteFilm(ID primitive.ObjectID) error
- func (m *MongoDB) DeleteFilmVolumeFile(path string) error
- func (m *MongoDB) DeleteUser(userId primitive.ObjectID) error
- func (m *MongoDB) DeleteVolume(volumeId primitive.ObjectID) error
- func (m *MongoDB) GetFilmCount() int64
- func (m *MongoDB) GetFilmFromExternalSubtitle(subtitlePath string) (model.Film, error)
- func (m *MongoDB) GetFilmFromID(id primitive.ObjectID) (*model.Film, error)
- func (m *MongoDB) GetFilmFromPath(filmPath string) (film *model.Film, err error)
- func (m *MongoDB) GetFilms() (films []model.Film, err error)
- func (m *MongoDB) GetFilmsFiltered(years []int, genre, country string) (films []model.Film)
- func (m *MongoDB) GetFilmsFromVolume(id primitive.ObjectID) (films []model.Film)
- func (m *MongoDB) GetFilmsRange(start, number int) (films []model.Film)
- func (m *MongoDB) GetFilmsWithActor(actorID int64) (films []model.Film)
- func (m *MongoDB) GetFilmsWithDirector(directorID int64) (films []model.Film)
- func (m *MongoDB) GetFilmsWithWriter(writerID int64) (films []model.Film)
- func (m *MongoDB) GetPeople() (people []model.Person, err error)
- func (m *MongoDB) GetPersonFromID(ID primitive.ObjectID) (*model.Person, error)
- func (m *MongoDB) GetPersonFromTMDBID(TMDBID int64) (*model.Person, error)
- func (m *MongoDB) GetTorrents(ctx context.Context, imdbid string, offset, limit int64) (torrents []model.RarbgTorrent, err error)
- func (m *MongoDB) GetUserFromID(id primitive.ObjectID) (*model.User, error)
- func (m *MongoDB) GetUserFromName(username string, user *model.User) error
- func (m *MongoDB) GetUserNb() (int64, error)
- func (m *MongoDB) GetUsers() (users []model.User, err error)
- func (m *MongoDB) GetVolumeFromID(id primitive.ObjectID) (*model.Volume, error)
- func (m *MongoDB) GetVolumes() (volumes []model.Volume, err error)
- func (m *MongoDB) InitRarbg(dbName string)
- func (m *MongoDB) IsFilmPathPresent(filmPath string) bool
- func (m *MongoDB) IsFilmPresent(film *model.Film) bool
- func (m *MongoDB) IsOwnerPresent() (bool, error)
- func (m *MongoDB) IsPersonPresent(personID int64) bool
- func (m *MongoDB) IsSubtitlePathPresent(subPath string) bool
- func (m *MongoDB) IsUsernameAvailable(username string) (bool, error)
- func (m *MongoDB) RemoveSubtitleFile(mediaPath, subtitlePath string) error
- func (m *MongoDB) SearchTorrents(ctx context.Context, search, category string, page uint) (torrents []model.RarbgTorrent, err error)
- func (m *MongoDB) SetUserPassword(userID primitive.ObjectID, newPassword string) error
- func (m *MongoDB) UpdateFilmVolumeFile(film *model.Film, oldPath string, newVolumeFile model.VolumeFile) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (Cache) CacheBackdrop ¶
CachePoster caches a backdrop from a source URL and the unique key for this backdrop
func (Cache) CacheFile ¶
CacheFile caches a file from a sourceUrl to the filePath in the cache folder Returns true if the URL returns a Status TooManyRequests (429) and will retry at a later moment Returns false if the file was immediately cached
func (Cache) CachePhoto ¶
CachePoster caches a photo from a source URL and the unique key for this photo
func (Cache) CachePoster ¶
CachePoster caches a poster from a source URL and the unique key for this poster
func (Cache) GetCachedPath ¶
GetCachedPath returns the full path from a filepath in the cache
type Metadata ¶
type Metadata interface { GetPosterLink(key string) string GetBackdropLink(key string) string GetPhotoLink(key string) string GetTMDBIDFromLink(inputUrl string) (tmdbID int, err error) GetPersonDetails(personID int64) *model.Person CreateFilm(file string, volumeID primitive.ObjectID, subFiles []string) *model.Film FetchFilmTMDBID(f *model.Film) error UpdateFilmDetails(film *model.Film) }
type MetadataWrapper ¶
type MetadataWrapper struct {
// contains filtered or unexported fields
}
func NewMetadataWrapper ¶
func NewMetadataWrapper(tmdbAPIKey string) (*MetadataWrapper, error)
NewMetadataWrapper initializes a MetadataWrapper
func (MetadataWrapper) CreateFilm ¶
func (MetadataWrapper) FetchFilmTMDBID ¶
func (mw MetadataWrapper) FetchFilmTMDBID(f *model.Film) error
FetchMediaID fetches media ID from TMDB and stores it
func (MetadataWrapper) GetBackdropLink ¶
func (mw MetadataWrapper) GetBackdropLink(key string) string
GetBackdropLink caches a backdrop from TMDB using its id
func (MetadataWrapper) GetPersonDetails ¶
func (mw MetadataWrapper) GetPersonDetails(personID int64) *model.Person
GetPersonDetails fetches details about a person from TMDB
func (MetadataWrapper) GetPhotoLink ¶
func (mw MetadataWrapper) GetPhotoLink(key string) string
GetPhotoLink caches a person's photo from TMDB using its id
func (MetadataWrapper) GetPosterLink ¶
func (mw MetadataWrapper) GetPosterLink(key string) string
GetPosterLink caches a poster from TMDB using its id
func (MetadataWrapper) GetTMDBIDFromLink ¶
func (mw MetadataWrapper) GetTMDBIDFromLink(inputUrl string) (tmdbID int, err error)
GetTMDBIDFromLink returns the TMDB ID from a TMDB, IMDb, or Letterboxd URL
func (MetadataWrapper) UpdateFilmDetails ¶
func (mw MetadataWrapper) UpdateFilmDetails(film *model.Film)
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
func NewMongoDB ¶
NewMongoDB initializes a mongo db client
func (*MongoDB) AddFilm ¶
AddFilm adds a given film to the DB If the film is already in the database, updates it
func (*MongoDB) AddSubtitleToFilmPath ¶
AddSubtitleToFilmPath adds the subtitle to a film given the film path
func (*MongoDB) AddVolumeSourceToFilm ¶
AddVolumeSourceToFilm adds the volume as a source to the given media
func (*MongoDB) CreateUser ¶
CreateUser adds a user to the database after checking parameter
func (*MongoDB) DeleteFilm ¶
DeleteFilm deletes a film
func (*MongoDB) DeleteFilmVolumeFile ¶
DeleteFilmVolumeFile removes a film from the database If the film has only 1 volume file, then the film is entirely deleted
func (*MongoDB) DeleteUser ¶
DeleteUser deletes the user from the DB
func (*MongoDB) DeleteVolume ¶
DeleteVolume deletes the volume from the DB and all the film which originated only from this volume
func (*MongoDB) GetFilmCount ¶
func (*MongoDB) GetFilmFromExternalSubtitle ¶
GetFilmFromExternalSubtitle returns a film from its external subtitle path
func (*MongoDB) GetFilmFromID ¶
GetFilmFromID returns a film from its TMDB ID
func (*MongoDB) GetFilmFromPath ¶
GetFilmFromPath retrieves a film from a path
func (*MongoDB) GetFilmsFiltered ¶
func (*MongoDB) GetFilmsFromVolume ¶
GetFilmsFromVolume retrieves all films from a specific volume ID
func (*MongoDB) GetFilmsRange ¶
GetFilmsRange returns a slice of Film from start to number
func (*MongoDB) GetFilmsWithActor ¶
GetFilmsWithActor returns a list of films starring desired actor ID
func (*MongoDB) GetFilmsWithDirector ¶
GetFilmsWithDirector returns a list of films directed by desired director ID
func (*MongoDB) GetFilmsWithWriter ¶
GetFilmsWithWriter returns a list of films written by desired writer ID
func (*MongoDB) GetPersonFromID ¶
GetPersonFromID returns the Person struct
func (*MongoDB) GetPersonFromTMDBID ¶
GetPersonFromTMDBID returns the Person struct
func (*MongoDB) GetTorrents ¶ added in v1.1.0
func (*MongoDB) GetUserFromID ¶
GetUserFromID gets user from its ID
func (*MongoDB) GetUserFromName ¶
GetUserFromName gets user from it name
func (*MongoDB) GetVolumeFromID ¶
GetVolumeFromID fetches volume from DB using specified ID and returns it via pointer
func (*MongoDB) GetVolumes ¶
GetVolumes returns the list of volumes in the DB
func (*MongoDB) IsFilmPathPresent ¶
IsFilmPathPresent checks if a film path is present in the database
func (*MongoDB) IsFilmPresent ¶
IsFilmPresent checks if a given film is already present in DB
func (*MongoDB) IsOwnerPresent ¶
IsOwnerPresent checks if there is an owner in the server
func (*MongoDB) IsPersonPresent ¶
IsPersonPresent checks if a person is already registered in the DB
func (*MongoDB) IsSubtitlePathPresent ¶
IsSubtitlePathPresent checks if a subtitle path is present in the database
func (*MongoDB) IsUsernameAvailable ¶
IsUsernameAvailable returns true if the username (case insensitive) is not in use yet
func (*MongoDB) RemoveSubtitleFile ¶
RemoveSubtitleFile removes a film subtitle from the database
func (*MongoDB) SearchTorrents ¶ added in v1.1.0
func (*MongoDB) SetUserPassword ¶
SetUserPassword set a new password for a specific user
func (*MongoDB) UpdateFilmVolumeFile ¶
func (m *MongoDB) UpdateFilmVolumeFile(film *model.Film, oldPath string, newVolumeFile model.VolumeFile) error
UpdateFilmVolumeFile updates the path to a film. film: Film struct that has its path changed oldPath: file path of the volumeFile that will be changed newVolumeFile: VolumeFile struct that replaces the previous one