Documentation
¶
Index ¶
- type Controller
- func (mc *Controller) GetArtistsByName(c *fiber.Ctx) error
- func (mc *Controller) GetCastByMediaID(c *fiber.Ctx) error
- func (mc *Controller) GetCreatorByID(c *fiber.Ctx) error
- func (mc *Controller) GetGenre(c *fiber.Ctx) error
- func (mc *Controller) GetGenres(c *fiber.Ctx) error
- func (mc *Controller) GetImagePaths(c *fiber.Ctx) error
- func (mc *Controller) GetImportSources(c *fiber.Ctx) error
- func (mc *Controller) GetMedia(c *fiber.Ctx) error
- func (mc *Controller) GetRandom(c *fiber.Ctx) error
- func (mc *Controller) ImportWeb(c *fiber.Ctx) error
- type IController
- type ImportSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶ added in v0.8.11
type Controller struct {
// contains filtered or unexported fields
}
Controller is the controller for media endpoints The methods which are the receivers of this struct are a bridge between the fiber layer and the storage layer
func NewController ¶
func NewController(storage models.MediaStorage, conf *cfg.Config) *Controller
func (*Controller) GetArtistsByName ¶ added in v0.8.18
func (mc *Controller) GetArtistsByName(c *fiber.Ctx) error
GetArtistsByName is a POST endpoint that takes the list of artists aa a multipart form data and returns the artists with their IDs as a response
func (*Controller) GetCastByMediaID ¶ added in v0.8.11
func (mc *Controller) GetCastByMediaID(c *fiber.Ctx) error
func (*Controller) GetCreatorByID ¶ added in v0.8.11
func (mc *Controller) GetCreatorByID(c *fiber.Ctx) error
func (*Controller) GetGenre ¶ added in v0.8.14
func (mc *Controller) GetGenre(c *fiber.Ctx) error
func (*Controller) GetGenres ¶ added in v0.8.14
func (mc *Controller) GetGenres(c *fiber.Ctx) error
func (*Controller) GetImagePaths ¶ added in v0.8.11
func (mc *Controller) GetImagePaths(c *fiber.Ctx) error
TODO: when upload form is implemented, flush the redis cache, since the response might change
func (*Controller) GetImportSources ¶ added in v0.8.18
func (mc *Controller) GetImportSources(c *fiber.Ctx) error
func (*Controller) GetMedia ¶ added in v0.8.11
func (mc *Controller) GetMedia(c *fiber.Ctx) error
GetMedia retrieves media information based on the media ID media ID is a UUID (binary, but passed from the fronetend as a string, since typescript doesn't support binary)
func (*Controller) GetRandom ¶ added in v0.8.11
func (mc *Controller) GetRandom(c *fiber.Ctx) error
GetRandom fetches up to 5 random media items to be displayed in a carousel on the home page
func (*Controller) ImportWeb ¶ added in v0.8.18
func (mc *Controller) ImportWeb(c *fiber.Ctx) error
ImportWeb handles the import of media from 3rd party sources Importing from the local filesystem is handled by the client since 1. Uploading music files to the server would unnecessarily overload the server 2. Although processing ID3 tags may be faster on the server, one has to consider the round-trip time of the request, which would be much slower than processing the tags on the client
type IController ¶ added in v0.8.11
type IController interface { GetMedia(c *fiber.Ctx) error GetRandom(c *fiber.Ctx) error AddMedia(c *fiber.Ctx) error }
IController is the interface for the media controller It defines the methods that the media controller must implement This is useful for mocking the media controller in unit tests