Documentation ¶
Overview ¶
MPC DB Storage Saves Videos Information in a boltdb database
Index ¶
- func HashPassword(password string) string
- type Storage
- func (storage *Storage) GetActorByID(actorID int) (actor mpclibrary.Actor, err error)
- func (storage *Storage) GetActorByName(actorName string) (actor mpclibrary.Actor, err error)
- func (storage *Storage) GetAllVideos() error
- func (storage *Storage) GetCategoryByID(categoryID int) (category mpclibrary.Category, err error)
- func (storage *Storage) GetCategoryByName(categoryName string) (category mpclibrary.Category, err error)
- func (storage *Storage) GetSettings() (settings mpclibrary.Settings, err error)
- func (storage *Storage) GetUsers() (users []mpcusers.User, err error)
- func (storage *Storage) GetVideoByFileName(fileName string) (video mpclibrary.Video, err error)
- func (storage *Storage) GetVideoByID(videoMd5 string) (video mpclibrary.Video, err error)
- func (storage *Storage) GetVideoByOriginalName(name string) (video mpclibrary.Video, err error)
- func (storage *Storage) GetVideos(offset int, view int, sortBy string, filter VideoFilter, seed int64) VideoResults
- func (storage *Storage) InitDb() error
- func (storage *Storage) InsertUser(user mpcusers.User) (id string, err error)
- func (storage *Storage) InsertVideos(videos []mpclibrary.Video) error
- func (storage *Storage) SaveSettings(settings mpclibrary.Settings) (err error)
- type Video
- type VideoFilter
- type VideoResults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶
HashPassword generates sha256 has of password
Types ¶
type Storage ¶
type Storage struct { Db *bolt.DB Path string Videos map[string]Video Categories map[int]mpclibrary.Category Actors map[int]mpclibrary.Actor }
func (*Storage) GetActorByID ¶
GetActorByID gets an actor from the list by ID
func (*Storage) GetActorByName ¶
GetActorByName gets an actor from the list by name
func (*Storage) GetAllVideos ¶
GetAllVideos gets all the videos from the DB
func (*Storage) GetCategoryByID ¶
GetCategoryByName gets category from the list by ID
func (*Storage) GetCategoryByName ¶
func (storage *Storage) GetCategoryByName(categoryName string) (category mpclibrary.Category, err error)
GetCategoryByName gets category from the list by Name
func (*Storage) GetSettings ¶
GetSettings gets settings from the DB
func (*Storage) GetVideoByFileName ¶
GetVideoByFileName searchs a video in the DB, it Gets the video ID by using the MD5 sum of its name
func (*Storage) GetVideoByID ¶
GetVideoByID searchs a video in the DB using the video ID. The Video ID can be the MD5 sum of its name for normal videos or the MD5 sum of the video file for encrypted files
func (*Storage) GetVideoByOriginalName ¶
GetVideoByOriginalName searchs a video in the DB using the file name when it was imported.
func (*Storage) GetVideos ¶
func (storage *Storage) GetVideos(offset int, view int, sortBy string, filter VideoFilter, seed int64) VideoResults
Get Videos
Get videos that meets the search criteria
func (*Storage) InitDb ¶
Initialize DB
Creates folder to save DB, Creates DB file and DB buckets, it also loads all the DB data
func (*Storage) InsertUser ¶
InsertUser inserts new user in the DB.
func (*Storage) InsertVideos ¶
InsertVideos inserts new videos in the DB. A list of videos should be provided
func (*Storage) SaveSettings ¶
Save Settings
type Video ¶
type Video struct { ID string `json:"id"` Title string `json:"title"` ThumbURL string `json:"thumbURL"` ImgURL string `json:"imgURL"` VideoURL string `json:"videoURL"` Description string `json:"description"` PubDate time.Time `json:"pubDate"` SubtitlesURL string `json:"subtitlesURL"` Categories []int `json:"categories"` Actors []int `json:"actors"` Extension string `json:"extension"` Width int `json:"width"` Height int `json:"height"` Duration int `json:"duration"` Step int `json:"step"` File string `json:"file"` OrigFile string `json:"orig_file"` Path string `json:"path"` Md5Sum string `json:"md5sum"` Encrypted bool `json:"encrypted"` }