server

package
v0.18.3 Latest Latest
Warning

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

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

Documentation

Overview

Package server Takeout API

This is the service API for the Takeout media server.

Terms Of Service:

TOS is TBD

Schemes: https Host: yourhost.com BasePath: /api Version: 0.0.1 License: AGPLv3 https://www.gnu.org/licenses/agpl-3.0.en.html Contact: defsub@defsub.com SecurityDefinitions:

Cookie:
 type: apiKey
 name: Cookie
 description: send Cookie Takeout={token}
 in: header
Bearer:
 type: apiKey
 name: Authorization
 description: send Authorization Bearer {token}
 scheme: bearer
 in: header

Security:

  • Bearer:
  • Cookie:

Consumes: - application/json Produces: - application/json

swagger:meta

Package server is the Takeout server.

Index

Constants

View Source
const (
	ApplicationJson = "application/json"

	ParamID   = "id"
	ParamRes  = "res"
	ParamName = "name"
	ParamEID  = "eid"
	ParamUUID = "uuid"

	QuerySearch = "q"
	QueryStart  = "start"
	QueryEnd    = "end"
	QueryToken  = "token"
)
View Source
const (
	AllowCookie bits = 1 << iota
	AllowAccessToken
	AllowMediaToken

	BearerAuthorization = "Bearer"
)
View Source
const (
	IntentAuth = "TAKEOUT_AUTH"
	IntentPlay = "TAKEOUT_PLAY"
	IntentNew  = "TAKEOUT_NEW"

	UserParamCookie = "cookie"
)
View Source
const (
	CoverArtArchivePrefix = "http://coverartarchive.org"
	TMDBPrefix            = "https://image.tmdb.org"
	FanArtPrefix          = "https://assets.fanart.tv/fanart"
)
View Source
const (
	LoginPage = "/static/login.html"
	LinkPage  = "/static/link.html"

	SuccessRedirect = "/"
	LinkRedirect    = LinkPage
	LoginRedirect   = LoginPage

	FormUser     = "user"
	FormPass     = "pass"
	FormCode     = "code"
	FormPassCode = "passcode"
)

Variables

View Source
var (
	ErrNoMedia            = errors.New("media not available")
	ErrInvalidMethod      = errors.New("invalid request method")
	ErrUnauthorized       = errors.New("unauthorized")
	ErrInvalidCode        = errors.New("invalid code")
	ErrNotFound           = errors.New("not found")
	ErrInvalidOffset      = errors.New("invalid offset")
	ErrAccessDenied       = errors.New("access denied")
	ErrMissingToken       = errors.New("missing token")
	ErrMissingAccessToken = errors.New("missing access token")
	ErrMissingMediaToken  = errors.New("missing media token")
	ErrMissingFileToken   = errors.New("missing file token")
	ErrMissingCookie      = errors.New("missing cookie")
	ErrInvalidSession     = errors.New("invalid session")
	ErrInvalidUUID        = errors.New("invalid uuid")
	ErrInvalidContent     = errors.New("invalid content")
	ErrMissingTitle       = errors.New("missing title")
)

Functions

func ActivityMoviesView

func ActivityMoviesView(ctx Context, start, end time.Time) *ActivityMovies

func ActivityPopularTracksView

func ActivityPopularTracksView(ctx Context, start, end time.Time) *ActivityTracks

func ActivityReleasesView

func ActivityReleasesView(ctx Context, start, end time.Time) *ActivityReleases

func ActivityTracksView

func ActivityTracksView(ctx Context, start, end time.Time) *ActivityTracks

func ActivityView

func ActivityView(ctx Context) *Activity

func ArtistView

func ArtistView(ctx Context, artist model.Artist) *Artist

func ArtistsView

func ArtistsView(ctx Context) *Artists

func EpisodeView

func EpisodeView(ctx Context, e model.Episode) *Episode

func GenreView

func GenreView(ctx Context, name string) *Genre

func HomeView

func HomeView(ctx Context) *Home

func IndexView

func IndexView(ctx Context) *Index

func Job

func Job(config *config.Config, name string) error

func KeywordView

func KeywordView(ctx Context, name string) *Keyword

func MovieView

func MovieView(ctx Context, m model.Movie) *Movie

func MoviesView

func MoviesView(ctx Context) *Movies

func OffsetView

func OffsetView(ctx Context, offset model.Offset) *Offset

func PlaylistView added in v0.17.0

func PlaylistView(ctx Context, playlist model.Playlist) *Playlist

func PlaylistsView added in v0.17.0

func PlaylistsView(ctx Context, playlists []*model.Playlist) *Playlists

func PodcastsSubscribedView added in v0.11.8

func PodcastsSubscribedView(ctx Context) *Podcasts

func PodcastsView

func PodcastsView(ctx Context) *Podcasts

func PopularView

func PopularView(ctx Context, artist model.Artist) *Popular

func ProfileView

func ProfileView(ctx Context, p model.Person) *Profile

func ProgressView

func ProgressView(ctx Context) *Progress

func RadioView

func RadioView(ctx Context) *Radio

func RefreshStation

func RefreshStation(ctx Context, s *model.Station) *spiff.Playlist

func ReleaseView

func ReleaseView(ctx Context, release model.Release) *Release

func Resolve

func Resolve(ctx Context, plist *spiff.Playlist) (err error)

func ResolveActivityTracksPlaylist

func ResolveActivityTracksPlaylist(ctx Context, v *view.ActivityTracks, res, path string) *spiff.Playlist

func ResolveArtistPlaylist

func ResolveArtistPlaylist(ctx Context, v *view.Artist, path, nref string) *spiff.Playlist

func ResolveMoviePlaylist

func ResolveMoviePlaylist(ctx Context, v *view.Movie, path string) *spiff.Playlist

func ResolveReleasePlaylist

func ResolveReleasePlaylist(ctx Context, v *view.Release, path string) *spiff.Playlist

func ResolveSeriesEpisodePlaylist

func ResolveSeriesEpisodePlaylist(ctx Context, series *view.Series,
	v *view.Episode, path string) *spiff.Playlist

func ResolveSeriesPlaylist

func ResolveSeriesPlaylist(ctx Context, v *view.Series, path string) *spiff.Playlist

func ResolveTrackPlaylist added in v0.18.1

func ResolveTrackPlaylist(ctx Context, track model.Track, path string) *spiff.Playlist

func SearchView

func SearchView(ctx Context, query string) *Search

func SeriesView

func SeriesView(ctx Context, s model.Series) *Series

func Serve

func Serve(config *config.Config) error

Serve configures and starts the Takeout web, websocket, and API services.

func SinglesView

func SinglesView(ctx Context, artist model.Artist) *Singles

func WantListView

func WantListView(ctx Context, artist model.Artist) *WantList

func WatchView

func WatchView(ctx Context, m model.Movie) *Watch

Types

type ArtistResponse

type ArtistResponse struct {
	// in: body
	Body struct {
		view.Artist
	}
}

swagger:response

type ArtistsResponse

type ArtistsResponse struct {
	// in: body
	Body struct {
		view.Artists
	}
}

swagger:response

type Context

type Context interface {
	Activity() *activity.Activity
	Auth() *auth.Auth
	Config() *config.Config
	Music() *music.Music
	Podcast() *podcast.Podcast
	Progress() *progress.Progress
	Template() *template.Template
	User() *auth.User
	Session() *auth.Session
	Video() *video.Video
	ImageClient() client.Getter

	LocateTrack(model.Track) string
	LocateMovie(model.Movie) string
	LocateEpisode(model.Episode) string

	FindArtist(string) (model.Artist, error)
	FindRelease(string) (model.Release, error)
	FindReleaseTracks(model.Release) []model.Track
	FindTrack(string) (model.Track, error)
	FindStation(string) (model.Station, error)
	FindPlaylist(string) (model.Playlist, error)
	FindMovie(string) (model.Movie, error)
	FindSeries(string) (model.Series, error)
	FindSeriesEpisodes(model.Series) []model.Episode
	FindEpisode(string) (model.Episode, error)

	TrackImage(model.Track) string
	ArtistImage(model.Artist) string
	ArtistBackground(model.Artist) string
	MovieImage(model.Movie) string
	EpisodeImage(model.Episode) string
}

type EpisodeResponse

type EpisodeResponse struct {
	// in: body
	Body struct {
		view.Episode
	}
}

swagger:response

type GenreResponse

type GenreResponse struct {
	// in: body
	Body struct {
		view.Genre
	}
}

swagger:response

type HomeResponse

type HomeResponse struct {
	// in: body
	Body struct {
		view.Home
	}
}

swagger:response

type IndexResponse

type IndexResponse struct {
	// in: body
	Body struct {
		view.Index
	}
}

swagger:response

type KeywordResponse

type KeywordResponse struct {
	// in: body
	Body struct {
		view.Keyword
	}
}

swagger:response

type LoginParam

type LoginParam struct {
	// in: body
	Body struct {
		// contains filtered or unexported fields
	}
}

swagger:parameters Login

type Media

type Media struct {
	// contains filtered or unexported fields
}

func (Media) Config

func (m Media) Config() *config.Config

func (Media) Music

func (m Media) Music() *music.Music

func (Media) Podcast

func (m Media) Podcast() *podcast.Podcast

func (Media) Video

func (m Media) Video() *video.Video

type MovieResponse

type MovieResponse struct {
	// in: body
	Body struct {
		view.Movie
	}
}

swagger:response

type MoviesResponse

type MoviesResponse struct {
	// in: body
	Body struct {
		view.Movies
	}
}

swagger:response

type OffsetResponse

type OffsetResponse struct {
	// in: body
	Body struct {
		view.Offset
	}
}

swagger:response

type PlaylistResponse

type PlaylistResponse struct {
	// in: body
	Body struct {
		spiff.Playlist
	}
}

swagger:response

type PodcastsResponse

type PodcastsResponse struct {
	// in: body
	Body struct {
		view.Podcasts
	}
}

swagger:response

type PopularResponse

type PopularResponse struct {
	// in: body
	Body struct {
		view.Popular
	}
}

swagger:response

type ProfileResponse

type ProfileResponse struct {
	// in: body
	Body struct {
		view.Profile
	}
}

swagger:response

type ProgressResponse

type ProgressResponse struct {
	// in: body
	Body struct {
		view.Progress
	}
}

swagger:response

type RadioResponse

type RadioResponse struct {
	// in: body
	Body struct {
		view.Radio
	}
}

swagger:response

type ReleaseResponse

type ReleaseResponse struct {
	// in: body
	Body struct {
		view.Release
	}
}

swagger:response

type RequestContext

type RequestContext struct {
	// contains filtered or unexported fields
}

func (RequestContext) Activity

func (ctx RequestContext) Activity() *activity.Activity

func (RequestContext) ArtistBackground

func (ctx RequestContext) ArtistBackground(a model.Artist) string

func (RequestContext) ArtistImage

func (ctx RequestContext) ArtistImage(a model.Artist) string

func (RequestContext) Auth

func (ctx RequestContext) Auth() *auth.Auth

func (RequestContext) Config

func (ctx RequestContext) Config() *config.Config

func (RequestContext) EpisodeImage

func (ctx RequestContext) EpisodeImage(e model.Episode) string

func (RequestContext) FindArtist

func (ctx RequestContext) FindArtist(id string) (model.Artist, error)

func (RequestContext) FindEpisode

func (ctx RequestContext) FindEpisode(id string) (model.Episode, error)

func (RequestContext) FindMovie

func (ctx RequestContext) FindMovie(id string) (model.Movie, error)

func (RequestContext) FindPlaylist added in v0.17.0

func (ctx RequestContext) FindPlaylist(id string) (model.Playlist, error)

func (RequestContext) FindRelease

func (ctx RequestContext) FindRelease(id string) (model.Release, error)

func (RequestContext) FindReleaseTracks added in v0.14.0

func (ctx RequestContext) FindReleaseTracks(release model.Release) []model.Track

func (RequestContext) FindSeries

func (ctx RequestContext) FindSeries(id string) (model.Series, error)

func (RequestContext) FindSeriesEpisodes added in v0.14.0

func (ctx RequestContext) FindSeriesEpisodes(series model.Series) []model.Episode

func (RequestContext) FindStation

func (ctx RequestContext) FindStation(id string) (model.Station, error)

func (RequestContext) FindTrack

func (ctx RequestContext) FindTrack(id string) (model.Track, error)

func (RequestContext) ImageClient

func (ctx RequestContext) ImageClient() client.Getter

func (RequestContext) LocateEpisode

func (RequestContext) LocateEpisode(e model.Episode) string

func (RequestContext) LocateMovie

func (RequestContext) LocateMovie(v model.Movie) string

func (RequestContext) LocateTrack

func (RequestContext) LocateTrack(t model.Track) string

func (RequestContext) MovieImage

func (ctx RequestContext) MovieImage(m model.Movie) string

func (RequestContext) Music

func (ctx RequestContext) Music() *music.Music

func (RequestContext) Podcast

func (ctx RequestContext) Podcast() *podcast.Podcast

func (RequestContext) Progress

func (ctx RequestContext) Progress() *progress.Progress

func (RequestContext) Session

func (ctx RequestContext) Session() *auth.Session

func (RequestContext) Template

func (ctx RequestContext) Template() *template.Template

func (RequestContext) TrackImage

func (ctx RequestContext) TrackImage(t model.Track) string

func (RequestContext) User

func (ctx RequestContext) User() *auth.User

func (RequestContext) Video

func (ctx RequestContext) Video() *video.Video

type SearchResponse

type SearchResponse struct {
	// in: body
	Body struct {
		view.Search
	}
}

swagger:response

type SeriesResponse

type SeriesResponse struct {
	// in: body
	Body struct {
		view.Series
	}
}

swagger:response

type SinglesResponse

type SinglesResponse struct {
	// in: body
	Body struct {
		view.Singles
	}
}

swagger:response

type StatusResponse

type StatusResponse struct {
}

swagger:response

Jump to

Keyboard shortcuts

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