media

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

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 media.Storage, 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 as a multipart form data and returns the artists with their IDs as a response @Summary Retrieve artists @Description Retrieve the artists with the given names @Tags media,artists,bulk operations @Param names formData []string true "Artist names" @Accept multipart/form-data @Produce json @Success 200 {object} h.ResponseHTTP{data=media.GroupedArtists} @Failure 400 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /artists/by-name [post]

func (*Controller) GetCastByMediaID added in v0.8.11

func (mc *Controller) GetCastByMediaID(c *fiber.Ctx) error

@Summary Get the cast of the media with given ID @Description Get the full cast and crew involved with the creation of the media with given ID @Tags media,artists,bulk operations,films,television,anime @Accept json @Produce json @Param media_id path string true "The UUID of the media to get the cast of" @Success 200 {object} h.ResponseHTTP{data=media.Cast} @Failure 400 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /media/{media_id}/cast [get]

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

GetGenre retrieves a single genre @Summary Retrieve genre @Description Retrieve the genre with the given name and type @Tags media,genres @Param kind path string true "Genre kind" Enums(film, tv, music, book, game) @Param genre path string true "Genre name (snake_lowercase)" @Param lang query string false "ISO-639-1 language code" Enums(en, de) @Accept json @Produce json @Success 200 {object} h.ResponseHTTP{data=media.Genre} @Failure 400 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /genre/{kind}/{genre} [get] "Note the singular genre, not genres"

func (*Controller) GetGenres added in v0.8.14

func (mc *Controller) GetGenres(c *fiber.Ctx) error

GetGenres retrieves the genres for the given genre kind @Summary Retrieve genres @Description Retrieve the list of genres of the specified type @Tags media,genres,bulk operations @Param kind path string true "Genre kind" Enums(film, tv, music, book, game) @Param names_only query bool false "Return only genre names. Usually used for populating dropdowns" @Param as_links query bool false "Return the genre names as links" @Param all query bool false "Return all genres, not only the ones without a parent genre (e.g. Twee Pop and Jangle Pop instead of just Pop)" @Param columns query []string false "Return only the specified columns" Enums(name, id, kinds, parent, children) @default names @example kind=film&names_only=true&as_links=true&all=true&columns=name,id,kinds,parent,children @Accept json @Produce json @Success 200 {object} h.ResponseHTTP{data=[]string} "If names_only or as_links=true" @Success 200 {object} h.ResponseHTTP{data=[]media.Genre} "If names_only=false and as_links=false" @Failure 400 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /genres/{kind} [get]

func (*Controller) GetImagePaths added in v0.8.11

func (mc *Controller) GetImagePaths(c *fiber.Ctx) error

GetImagePaths retrieves the image paths for the media with the given ID @Summary Retrieve image paths @Description Retrieve the image paths for the media with the given ID @Tags media,metadata,images @Param media_id path string true "Media UUID" @Accept json text/plain @Produce text/plain @Param media_id path string true "Media UUID" @Success 200 {string} string "Image path" @Failure 400 {object} h.ResponseHTTP{} @Failure 404 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /media/{media_id}/images [get]

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 frontend as a string) This might be changed in the future, most likely to uint8array TODO: modify the response to utilize generics instead of interface{} @Summary Retrieve media information @Description Retrieve complete media information for the given media ID @Tags media,metadata @Param id path string true "Media UUID" @Accept json @Produce json @Success 200 {object} h.ResponseHTTP{data=any} @Failure 400 {object} h.ResponseHTTP{} @Failure 500 {object} h.ResponseHTTP{} @Router /media/{id} [get]

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

type ImportSource added in v0.8.18

type ImportSource struct {
	Name string `json:"name" validate:"required"`
	URI  string `json:"uri" validate:"required"`
}

Jump to

Keyboard shortcuts

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