Documentation
¶
Overview ¶
SPDX-License-Identifier: AGPL-3.0-or-later Copyright (C) 2026 WittyWilla and contributors
Package library owns libraries, media items, scanning and metadata.
Index ¶
- Constants
- Variables
- func AgeFor(rating string) *int
- func ArtPaths(it *Item) (poster, backdrop, nfo string)
- func BoardAge(board, value string) *int
- func BrandKey(name string) string
- func CDTrackNumber(path string) (image string, n int, ok bool)
- func ChannelBrandName(name string) string
- func CleanComment(body string) string
- func CleanPicture(b []byte) (out []byte, ext string, err error)
- func CleanRadioText(s string, limit int) string
- func CleanViewQuery(q url.Values) url.Values
- func ClipName(name string) (title string, year *int)
- func ComicPageWeb(name string) bool
- func ComicPages(zr *zip.Reader) []string
- func CommonsCredits(ctx context.Context, w *Wikidata, addresses []string) map[string]CommonsPicture
- func CommonsFileOf(raw string) string
- func ConfidenceFor(t *Title, libType string) (int, []string)
- func CreateInLibrary(root, dir, name string) (*os.File, string, error)
- func DateFromName(name string) (int64, bool)
- func DayNumber(t time.Time) int
- func DepartmentKeys() []string
- func DepartmentOf(department, job string) string
- func DiscMainTitle(d *dvd.Disc, info *DiscInfo) *dvd.TitleSummary
- func DjvuPageList(p string) []string
- func FeedSeed(userID int64) int64
- func FetchFeed(ctx context.Context, feedURL string) (*rssFeed, error)
- func FieldLabel(f string) string
- func FileKind(name string) string
- func ForgetsDetails(typ string) bool
- func FreeLogoLicense(license string) bool
- func GuessDiscContent(libType, title, label string) string
- func HLSKeyProtection(line string) string
- func HasDjVu() bool
- func HueOf(title string) int
- func ID3Title(b []byte) string
- func IsAudioLibrary(t string) bool
- func IsConvertedCopy(name string) bool
- func IsCreatorLibrary(t string) bool
- func IsDiscKind(kind string) bool
- func IsGalleryLibrary(t string) bool
- func IsLogoPreview(raw string) bool
- func IsMadePoster(v string) bool
- func IsPhotoFile(name string) bool
- func IsRatingBoard(name string) bool
- func IsVideoFile(name string) bool
- func IsZipComic(p string) bool
- func ListChange(cur string, add, remove []string) string
- func LooksLikeTVDisc(title string) bool
- func MediaKind(kind string, episode bool) string
- func MercX(lon float64) float64
- func MercY(lat float64) float64
- func NewBatch() string
- func OwnScan(kind string) bool
- func ParseEmbeddedMotion(m string) (off, length int64, ok bool)
- func ParseEntries(format string, b []byte) []string
- func ParseName(name string) (title string, year *int)
- func ParseStreamTitle(block []byte) (string, bool)
- func PersonKey(name string) string
- func PersonSortName(name string) string
- func PictureExt(b []byte) string
- func PlaysDirect(it *Item) bool
- func RadioAudioType(ct string) bool
- func RemoteArtPath(imagesDir, u string) string
- func ReservedName(name string) bool
- func ResetRadioDirectoryCache()
- func RewriteHLS(body []byte, base *url.URL, link func(abs string) string) (out []byte, title string, err error)
- func RigPath(rigID int64, appID int) string
- func SVGFile(path string) ([]byte, error)
- func SafeFileName(name string) string
- func SafeTransport() *http.Transport
- func SanitizeSVG(src []byte) ([]byte, error)
- func SavePicture(imagesDir string, b []byte, ext string) (string, error)
- func SeasonName(n int) string
- func SegmentTitle(head []byte) string
- func SetPhotoEngine(e PhotoEngine)
- func SharesFolder(dir, path string) bool
- func SnapThumbWidth(w int) int
- func SniffMedia(b []byte) bool
- func SortTitle(t string) string
- func SourceLabel(src string) string
- func SourceURL(src, id string) string
- func StackedParts(path string) []string
- func StopListings()
- func StopSuggesting()
- func TitleAlike(a, b string) float64
- func ValidDirectoryID(id string) bool
- func ValidLogoKind(kind string) bool
- func ValidStreamURL(raw string) bool
- func WebSafeImage(name string) bool
- func WikidataPoster(ctx context.Context, w *Wikidata, id string) string
- func WithoutAddress(err error) error
- func WordCounts(zr *zip.Reader, spine []string) []int
- type Access
- func (a *Access) AllowsItem(it *Item, show *Show) bool
- func (a *Access) AllowsLibrary(id int64) bool
- func (a *Access) AllowsOutside(kind, contentRating string, genres []string) bool
- func (a *Access) AllowsShow(sh *Show) bool
- func (a *Access) Can(feature string) bool
- func (a *Access) CanWatchChannels(kind string) bool
- func (a *Access) ForKind(kind string)
- func (a *Access) ItemClause() (string, []any)
- func (a *Access) Limited() bool
- func (a *Access) Resolved() bool
- func (a *Access) ShowClause() (string, []any)
- type Agent
- type AgentResult
- type Album
- type AlbumFilter
- type AniList
- type Annotation
- type ArtCandidate
- type Artist
- type Baseline
- type BookGroup
- type Brand
- type BrowseFilter
- type BrowseResult
- type BrowseRow
- type CDInfo
- type CDMatch
- type CDTrackName
- type Category
- type CategoryArt
- type CategoryChange
- type Collection
- type CollectionRule
- type Comment
- type CommonsArt
- type CommonsPicture
- type ConversionItem
- type Creator
- type CreatorQuery
- type Credit
- type CreditIn
- type Credits
- type CrewGroup
- type Department
- type DirectoryCount
- type DirectoryFacets
- type DirectoryQuery
- type DirectoryStation
- type DiscCandidate
- type DiscChoice
- type DiscEpisode
- type DiscFeature
- type DiscInfo
- type DiscIssue
- type DiscRank
- type DiscSecondOpinion
- type DiscTitle
- type DiscVersion
- type EPUBInfo
- type EpisodeListing
- type EpisodeMapResult
- type EpisodeMeta
- type EpisodeNumber
- type EpisodePreview
- type EpisodeRef
- type EpisodeRow
- type ErrBadInput
- type ExportResult
- type Facet
- type Facets
- type FactsProgress
- type FieldChange
- type FileChange
- type FilmGroup
- type FilmTitle
- type Filmography
- type FolderApply
- type FolderFieldChange
- type FolderPreview
- type FolderResult
- type ForgetOptions
- type ForgetResult
- type FoundPerson
- type HLSAttr
- type HistoryEntry
- type IcyReader
- type Item
- type ItemFacet
- type ItemFacets
- type ItemLink
- type ItemQuery
- type ItemTitles
- type KindLimit
- type Library
- type LibraryCollection
- type ListingPlatform
- type ListingStatus
- type Logo
- type LogoCandidate
- type LogoRef
- type LogoSource
- type Logos
- func (l *Logos) Candidates(ctx context.Context, g *Logo, query string) ([]LogoCandidate, error)
- func (l *Logos) CopyFrom(ctx context.Context, g *Logo, fromID int64) (*Logo, error)
- func (l *Logos) Downloaded(ctx context.Context, kind string, except int64) ([]Logo, error)
- func (l *Logos) ForgetDownloaded(ctx context.Context) (int, error)
- func (l *Logos) ForgetDownloadedKind(ctx context.Context, kind string) (int, error)
- func (l *Logos) ImagePath(g *Logo, variant string) string
- func (l *Logos) Kick()
- func (l *Logos) LookupLogos(ctx context.Context, refs []LogoRef, create bool) ([]Logo, error)
- func (l *Logos) Pick(ctx context.Context, g *Logo, query, sourceID string) (*Logo, error)
- func (l *Logos) SearchAllowed(ctx context.Context, kind string) bool
- func (l *Logos) SetLogoConsent(ctx context.Context, accepted, removeDownloaded bool) error
- func (l *Logos) SetLogoStatus(ctx context.Context, g *Logo, status string) (*Logo, error)
- func (l *Logos) Upload(ctx context.Context, g *Logo, b []byte) (*Logo, error)
- type MatchCandidate
- type MatchDetails
- type MatchPreview
- type MatchRef
- type MatchRule
- type MatchSource
- type MoveFromInfo
- type MoveInfo
- type MoveOption
- type MusicQuery
- type Network
- type NowPlaying
- type Person
- type PersonDetails
- type PersonIDs
- type Photo
- type PhotoBounds
- type PhotoCluster
- type PhotoDetail
- type PhotoEngine
- type PhotoFolder
- type PhotoInfo
- type PhotoMonth
- type PhotoQuery
- type PlayedGame
- type PlaylistSummary
- type Podcast
- type Progress
- type QueueResult
- type QueueRow
- type RadioMeta
- type RadioStation
- type Recommendation
- type RemovedTitle
- type ReviewEntry
- type RuleResult
- type RuleTry
- type SavedView
- type ScanMode
- type ScanModule
- type ScanModules
- type ScanProgress
- type ScanRun
- type Scanner
- func (s *Scanner) ApplyAgents(ctx context.Context, it *Item, libType string)
- func (s *Scanner) ApplyCDMatch(ctx context.Context, lib *Library, it *Item, d *wittycd.Disc, m *CDMatch) error
- func (s *Scanner) ApplyItemFields(ctx context.Context, module string, f wittymodule.ItemFields) error
- func (s *Scanner) ApplyMatch(ctx context.Context, t *Title, source, id string, only map[string]bool, ...) (string, error)
- func (s *Scanner) ArtworkFor(ctx context.Context, t *Title, kind string) ([]ArtCandidate, []string)
- func (s *Scanner) BookEPUB(it *Item) (string, error)
- func (s *Scanner) CDCoverPreview(ctx context.Context, release string) ([]byte, error)
- func (s *Scanner) CDLookup(ctx context.Context, d *wittycd.Disc) ([]CDMatch, error)
- func (s *Scanner) CDRelease(ctx context.Context, d *wittycd.Disc, release string) (*CDMatch, error)
- func (s *Scanner) Cancel(libraryID int64)
- func (s *Scanner) ComicPageFile(ctx context.Context, p string, pages []string, n int) (string, error)
- func (s *Scanner) ComicPageImage(ctx context.Context, archive, name string, read func() (io.ReadCloser, error)) (string, error)
- func (s *Scanner) ComicPageList(p string) ([]string, error)
- func (s *Scanner) DescribeItems(ctx context.Context, libraryID int64, ids []int64, refresh bool) error
- func (s *Scanner) DescribesKind(kind string) (ScanModule, bool)
- func (s *Scanner) DjvuPageFile(ctx context.Context, it *Item, page int) (string, error)
- func (s *Scanner) Download(ctx context.Context, it *Item) error
- func (s *Scanner) EpisodeMap(ctx context.Context, showID int64) (*EpisodeMapResult, error)
- func (s *Scanner) FileReplaced(ctx context.Context, id int64, path string) error
- func (s *Scanner) FillNetworkFacts() bool
- func (s *Scanner) ForgetCDMatch(ctx context.Context, lib *Library, it *Item, d *wittycd.Disc) error
- func (s *Scanner) Frame(ctx context.Context, it *Item) (string, error)
- func (s *Scanner) HoldScans(ctx context.Context) (release func(), err error)
- func (s *Scanner) IndexUploaded(ctx context.Context, lib *Library, path string) (*Item, error)
- func (s *Scanner) KickListings()
- func (s *Scanner) ListingStatus(ctx context.Context) ListingStatus
- func (s *Scanner) LoadImage(ctx context.Context, ref string) ([]byte, error)
- func (s *Scanner) LookUpPerson(ctx context.Context, p *Person) (bool, error)
- func (s *Scanner) MIDIAudio(ctx context.Context, it *Item) (string, error)
- func (s *Scanner) MakeTitlePoster(p TitlePoster) (string, error)
- func (s *Scanner) MatchQueue(ctx context.Context, libraryID int64, state, search string, limit, offset int) (*QueueResult, error)
- func (s *Scanner) ModuleReport(module string, libraryID int64, done, total int64) bool
- func (s *Scanner) Persist(ctx context.Context, t *Title)
- func (s *Scanner) PosterThumb(ctx context.Context, src string, width int) string
- func (s *Scanner) PreviewMatch(ctx context.Context, t *Title, source, id string) (*MatchPreview, error)
- func (s *Scanner) PreviewRefresh(ctx context.Context, t *Title) (*MatchPreview, error)
- func (s *Scanner) RecheckListings()
- func (s *Scanner) RefreshPodcast(ctx context.Context, p *Podcast) error
- func (s *Scanner) RefreshPodcasts(ctx context.Context)
- func (s *Scanner) RefreshRadio(ctx context.Context)
- func (s *Scanner) RefreshShow(ctx context.Context, showID int64, tvdbID string) (*Show, error)
- func (s *Scanner) RefreshTitle(ctx context.Context, t *Title, only map[string]bool, user string) (string, error)
- func (s *Scanner) RemapEpisodes(ctx context.Context, showID int64, list []EpisodeNumber, user string) (string, error)
- func (s *Scanner) RemoveMatch(ctx context.Context, t *Title, user string) (string, error)
- func (s *Scanner) ResumeScans(ctx context.Context) int
- func (s *Scanner) RunOf(ctx context.Context, libraryID int64) (ScanRun, bool)
- func (s *Scanner) Running(id int64) bool
- func (s *Scanner) SaveItemMetadata(ctx context.Context, it *Item) error
- func (s *Scanner) SaveShowMetadata(ctx context.Context, sh *Show) error
- func (s *Scanner) ScanHold(ctx context.Context) (func(), error)
- func (s *Scanner) SearchMatches(ctx context.Context, t *Title, query string, year *int) (*SearchResult, error)
- func (s *Scanner) SetListings(ctx context.Context, on bool, region string, accepted []string) error
- func (s *Scanner) SmallCopyOf(ctx context.Context, f *os.File, src string, width int) string
- func (s *Scanner) Snapshot(id int64) *ScanProgress
- func (s *Scanner) Start(libraryID int64) bool
- func (s *Scanner) StartBy(libraryID int64, mode ScanMode, by tasks.By) bool
- func (s *Scanner) StartSuggesting(libraryID int64) bool
- func (s *Scanner) Stopping()
- func (s *Scanner) Subscribe(ctx context.Context, libraryID int64, feedURL string) (*Podcast, error)
- func (s *Scanner) Suggest(ctx context.Context, t *Title) ([]MatchCandidate, error)
- func (s *Scanner) TMDBClient() *TMDB
- func (s *Scanner) Thumb(ctx context.Context, it *Item, width int) (string, error)
- type SearchHit
- type SearchResult
- type Season
- type SeriesLister
- type SeriesMeta
- type SeriesSource
- type ShareLink
- type Show
- type ShowQuery
- type StationFacts
- type StationStream
- type Store
- func (s *Store) AddComment(ctx context.Context, userID, itemID int64, parentID *int64, body string) (*Comment, error)
- func (s *Store) AddFromDirectory(ctx context.Context, libraryID int64, id string) (*Item, error)
- func (s *Store) AddListening(ctx context.Context, userID, itemID int64, seconds float64)
- func (s *Store) AddRadioStation(ctx context.Context, libraryID int64, st RadioStation) (*Item, error)
- func (s *Store) AddToCollection(ctx context.Context, id int64, items, shows []int64) error
- func (s *Store) Albums(ctx context.Context, libraryID int64, artist, search, sort string, ...) ([]Album, error)
- func (s *Store) AlbumsFiltered(ctx context.Context, libraryID int64, f AlbumFilter, access *Access) ([]Album, error)
- func (s *Store) Annotations(ctx context.Context, userID, itemID int64) ([]Annotation, error)
- func (s *Store) ApplyMetadataFolder(ctx context.Context, dir string, o FolderApply) (*FolderResult, error)
- func (s *Store) ApplyStationFacts(ctx context.Context, it *Item, f StationFacts)
- func (s *Store) ArchiveEPUB(ctx context.Context, p string) (*EPUBInfo, []int, error)
- func (s *Store) ArchiveEPUBOf(ctx context.Context, it *Item, book string) (*EPUBInfo, []int, error)
- func (s *Store) ArchivePages(ctx context.Context, p string) ([]string, error)
- func (s *Store) Artists(ctx context.Context, libraryID int64, access *Access) ([]Artist, error)
- func (s *Store) AttachItem(ctx context.Context, id int64, link, extraType, label string, ...) error
- func (s *Store) AttachProgress(ctx context.Context, userID int64, items []*Item) error
- func (s *Store) AttachRadio(ctx context.Context, userID int64, items []*Item) error
- func (s *Store) AttachedTo(ctx context.Context, target string, id int64, link string) ([]*Item, []ItemLink, error)
- func (s *Store) BackfillAges(ctx context.Context) error
- func (s *Store) BookGroups(ctx context.Context, libraryID int64, by string, access *Access) ([]BookGroup, error)
- func (s *Store) Brands(ctx context.Context, libraryID int64, kind string, access *Access) ([]Brand, error)
- func (s *Store) Browse(ctx context.Context, f BrowseFilter, userID int64, access *Access) (*BrowseResult, error)
- func (s *Store) ByTMDB(ctx context.Context, kind, id string) (items []int64, shows []int64)
- func (st *Store) CDTrackItems(ctx context.Context, disc int64) map[int]int64
- func (s *Store) Categories(ctx context.Context, libraryID int64, access *Access, includeHidden bool) ([]Category, error)
- func (s *Store) ChangeCategories(ctx context.Context, libraryID int64, changes []CategoryChange, order []string) error
- func (s *Store) CheckStation(ctx context.Context, it *Item) error
- func (s *Store) CheckStations(ctx context.Context, stations []*Item, log func(string, ...any)) bool
- func (s *Store) ChooseDiscMain(ctx context.Context, it *Item, ttn int, by int64) error
- func (s *Store) ClearProgress(ctx context.Context, userID, itemID int64) error
- func (s *Store) ClearWatchCache(ctx context.Context) error
- func (s *Store) ClearWatchHistory(ctx context.Context, userID int64) error
- func (s *Store) CollectionByID(ctx context.Context, id, userID int64, isAdmin bool) (*Collection, error)
- func (s *Store) CollectionItems(ctx context.Context, c *Collection, userID int64, access *Access, ...) ([]*Item, []*Show, error)
- func (s *Store) Collections(ctx context.Context, userID int64, access *Access) ([]*Collection, error)
- func (s *Store) CollectionsHolding(ctx context.Context, userID, itemID, showID int64) ([]int64, error)
- func (s *Store) CollectionsInLibrary(ctx context.Context, libraryID, userID int64, access *Access) ([]LibraryCollection, error)
- func (s *Store) CommentOwner(ctx context.Context, id int64) (userID, itemID int64, err error)
- func (s *Store) Comments(ctx context.Context, itemID int64, limit, offset int) ([]Comment, int, error)
- func (s *Store) CommonsArtwork(ctx context.Context, acc *Access) ([]CommonsArt, error)
- func (s *Store) ContinueWatching(ctx context.Context, userID int64, limit int) ([]*Item, error)
- func (s *Store) ConversionItems(ctx context.Context, libraryID int64) ([]ConversionItem, error)
- func (s *Store) ConversionItemsSince(ctx context.Context, libraryID, since int64) ([]ConversionItem, error)
- func (s *Store) CountShareView(ctx context.Context, id int64)
- func (s *Store) CreateLibrary(ctx context.Context, name, typ string, paths []string) (*Library, error)
- func (s *Store) CreateRigLibrary(ctx context.Context, name string) (*Library, error)
- func (s *Store) CreateShare(ctx context.Context, l ShareLink) (*ShareLink, error)
- func (s *Store) CreatorArt(ctx context.Context, id int64, kind string) (string, error)
- func (s *Store) CreatorPlaylists(ctx context.Context, creatorID int64, access *Access) ([]PlaylistSummary, error)
- func (s *Store) Creators(ctx context.Context, q CreatorQuery) ([]Creator, error)
- func (s *Store) CreditsRead(ctx context.Context, target string, id int64, source string) bool
- func (s *Store) DeleteAnnotation(ctx context.Context, userID, id int64) error
- func (s *Store) DeleteCollection(ctx context.Context, id int64) error
- func (s *Store) DeleteComment(ctx context.Context, id int64) error
- func (s *Store) DeleteLibrary(ctx context.Context, id int64) error
- func (s *Store) DeleteShare(ctx context.Context, id int64) error
- func (s *Store) DeleteView(ctx context.Context, userID, id int64) error
- func (s *Store) DetachItem(ctx context.Context, id int64) error
- func (s *Store) EditComment(ctx context.Context, id int64, body string) error
- func (s *Store) EditVideo(ctx context.Context, it *Item, e VideoEdit) error
- func (s *Store) EnsureLogo(ctx context.Context, kind, name string) (*Logo, error)
- func (s *Store) EpisodePoster(ctx context.Context, showID int64, access *Access) string
- func (s *Store) Episodes(ctx context.Context, showID int64, access *Access) ([]*Item, error)
- func (s *Store) ExportMetadata(ctx context.Context, dir string, libraryID int64, ...) (*ExportResult, error)
- func (s *Store) FacetCounts(ctx context.Context, libraryID int64, access *Access) (map[string]int, error)
- func (s *Store) Filmography(ctx context.Context, personID int64, access *Access) (*Filmography, error)
- func (s *Store) ForYou(ctx context.Context, q VideoQuery, seed int64) ([]VideoCard, bool, error)
- func (s *Store) ForgetDetails(ctx context.Context, lib *Library, opt ForgetOptions, res *ForgetResult) error
- func (s *Store) ForgetEverywhereExtras(ctx context.Context) error
- func (s *Store) ForgetFiles(ctx context.Context, lib *Library, opt ForgetOptions, res *ForgetResult) error
- func (s *Store) Genres(ctx context.Context, libraryID int64, access *Access) ([]string, error)
- func (s *Store) History(ctx context.Context, limit int) ([]HistoryEntry, error)
- func (s *Store) InLibraries(ctx context.Context, path string) bool
- func (s *Store) InProgress(ctx context.Context, libraryID, userID int64, limit int, access *Access) ([]*Item, error)
- func (s *Store) InWatchLater(ctx context.Context, userID, itemID, showID int64) (bool, error)
- func (s *Store) Item(ctx context.Context, id int64) (*Item, error)
- func (s *Store) ItemCredits(ctx context.Context, it *Item) (*Credits, error)
- func (s *Store) ItemEdits(ctx context.Context, id int64) []string
- func (s *Store) ItemFiles(ctx context.Context, id int64) ([]string, error)
- func (s *Store) Items(ctx context.Context, q ItemQuery) ([]*Item, int, error)
- func (s *Store) ItemsInOrder(ctx context.Context, ids []int64, access *Access) ([]*Item, error)
- func (s *Store) Libraries(ctx context.Context) ([]Library, error)
- func (s *Store) Library(ctx context.Context, id int64) (*Library, error)
- func (s *Store) LibraryFacets(ctx context.Context, libraryID int64, access *Access) (*Facets, error)
- func (s *Store) LibraryFile(ctx context.Context, path string) bool
- func (s *Store) LibraryItemFacets(ctx context.Context, libraryID int64, console string, access *Access) (*ItemFacets, error)
- func (s *Store) LibraryRoots(ctx context.Context) ([]string, error)
- func (s *Store) LikedItems(ctx context.Context, userID, libraryID int64, kinds []string, ...) ([]*Item, error)
- func (s *Store) LikedTracks(ctx context.Context, userID, libraryID int64, access *Access) ([]int64, error)
- func (s *Store) LinkOf(ctx context.Context, id int64) *ItemLink
- func (s *Store) ListLogos(ctx context.Context, kind, query string, limit, offset int) ([]Logo, int, error)
- func (s *Store) ListingPlatforms(ctx context.Context, libraryID int64, access *Access) ([]ListingPlatform, error)
- func (s *Store) ListingTMDB(ctx context.Context, target string, id int64) (kind, tmdbID string)
- func (s *Store) ListingsEnabled(ctx context.Context) bool
- func (s *Store) ListingsRegion(ctx context.Context) string
- func (s *Store) LoadTitle(ctx context.Context, target string, id int64) (*Title, error)
- func (s *Store) LogPlay(ctx context.Context, userID, itemID int64, seconds float64) error
- func (s *Store) LogoByID(ctx context.Context, id int64) (*Logo, error)
- func (s *Store) LogoConsent(ctx context.Context) string
- func (s *Store) LogoCounts(ctx context.Context) (map[string]int, error)
- func (s *Store) LogoCredits(ctx context.Context) ([]Logo, error)
- func (s *Store) LogoFor(ctx context.Context, kind, name string) (*Logo, error)
- func (s *Store) LookUpRadio(ctx context.Context, it *Item) error
- func (s *Store) MarkPersonLookedUp(ctx context.Context, id int64) error
- func (s *Store) Markers(ctx context.Context, id int64) StoredMarkers
- func (s *Store) MatchRules(ctx context.Context, libraryID int64) ([]MatchRule, error)
- func (s *Store) MostWatched(ctx context.Context, q WatchQuery, access *Access) ([]WatchTotal, error)
- func (s *Store) MoveOptions(ctx context.Context, t *Title) MoveInfo
- func (s *Store) MoveTitle(ctx context.Context, t *Title, to int64) error
- func (s *Store) MusicCounts(ctx context.Context, libraryID, userID int64, access *Access) (albums, artists, songs, liked int, err error)
- func (s *Store) MusicTracks(ctx context.Context, q MusicQuery, access *Access) ([]*Item, error)
- func (s *Store) Networks(ctx context.Context, libraryID int64, access *Access) ([]Network, error)
- func (s *Store) NextEpisode(ctx context.Context, it *Item, access *Access) *int64
- func (s *Store) NextInCollection(ctx context.Context, c *Collection, userID, after int64, access *Access) *int64
- func (s *Store) NextUpItems(ctx context.Context, userID int64, showIDs []int64, access *Access, limit int) ([]*Item, error)
- func (s *Store) OpenArchive(ctx context.Context, p string) (*zip.Reader, func(), error)
- func (s *Store) OpenBook(ctx context.Context, it *Item, book string) (*zip.Reader, func(), error)
- func (s *Store) OpenLibraryFile(ctx context.Context, path string) (*os.File, fs.FileInfo, error)
- func (s *Store) PeopleNeedingDetails(ctx context.Context, limit int) ([]*Person, error)
- func (s *Store) Person(ctx context.Context, id int64) (*Person, error)
- func (s *Store) PersonVisible(ctx context.Context, id int64, access *Access) bool
- func (s *Store) PhotoBounds(ctx context.Context, q PhotoQuery) (*PhotoBounds, error)
- func (s *Store) PhotoClusters(ctx context.Context, q PhotoQuery, zoom int) (out []PhotoCluster, cut bool, err error)
- func (s *Store) PhotoDetail(ctx context.Context, userID int64, it *Item) (*PhotoDetail, error)
- func (s *Store) PhotoFolders(ctx context.Context, q PhotoQuery) ([]PhotoFolder, error)
- func (s *Store) PhotoLocated(ctx context.Context, id int64) bool
- func (s *Store) PhotoMonths(ctx context.Context, q PhotoQuery) ([]PhotoMonth, error)
- func (s *Store) PhotoMotion(ctx context.Context, id int64) string
- func (s *Store) Photos(ctx context.Context, q PhotoQuery) ([]Photo, string, error)
- func (s *Store) Podcast(ctx context.Context, id int64) (*Podcast, error)
- func (s *Store) Podcasts(ctx context.Context, libraryID int64) ([]Podcast, error)
- func (s *Store) PreviewMetadataFolder(ctx context.Context, dir string) (*FolderPreview, error)
- func (s *Store) PreviewRule(ctx context.Context, r *CollectionRule, userID int64, access *Access) ([]*Item, int, error)
- func (s *Store) PrunePeople(ctx context.Context) error
- func (s *Store) PurgeExpiredShares(ctx context.Context)
- func (s *Store) PurgeMetadataFiles(ctx context.Context, lib *Library) (int, error)
- func (s *Store) RadioAddresses(ctx context.Context, libraryID int64) (map[string]bool, error)
- func (s *Store) RadioFrom(ctx context.Context, seed *Item, userID int64, limit int, access *Access) ([]*Item, error)
- func (s *Store) RadioResult(ctx context.Context, id int64, failure error)
- func (s *Store) RecentlyPlayedGames(ctx context.Context, userID int64, limit int) ([]PlayedGame, error)
- func (s *Store) Recommend(ctx context.Context, userID int64, it *Item, access *Access) (*Item, *Show, error)
- func (s *Store) RecommendForYou(ctx context.Context, userID int64, access *Access, seed int64, limit int) ([]*Item, []*Show, string, error)
- func (s *Store) RecordView(ctx context.Context, userID, itemID int64, e ViewEvent) error
- func (s *Store) RelatedVideos(ctx context.Context, q VideoQuery, it *Item, limit int) ([]VideoCard, error)
- func (s *Store) Remember(ctx context.Context, batch, user, action string, t *Title, ...) error
- func (s *Store) RemoveFromCollection(ctx context.Context, id int64, items, shows []int64) error
- func (s *Store) RemoveRadioStation(ctx context.Context, id int64) error
- func (s *Store) RemoveRigGame(ctx context.Context, itemID int64) error
- func (s *Store) RemoveTitle(ctx context.Context, t *Title) error
- func (s *Store) RemovedTitles(ctx context.Context, libraryID int64) ([]RemovedTitle, error)
- func (s *Store) RereadLibrary(ctx context.Context, id int64) error
- func (s *Store) ResetCategories(ctx context.Context, libraryID int64) error
- func (s *Store) ResetScanning(ctx context.Context) error
- func (s *Store) Resolve(ctx context.Context, a *Access) (*Access, error)
- func (s *Store) RestoreRemoved(ctx context.Context, path string) error
- func (s *Store) ReviewOfYear(ctx context.Context, userID int64, year int, access *Access) (*YearReview, error)
- func (s *Store) Roots(ctx context.Context) []string
- func (s *Store) SaveAnnotation(ctx context.Context, userID int64, a *Annotation) error
- func (s *Store) SaveCollection(ctx context.Context, c *Collection) error
- func (s *Store) SaveDetectedMarkers(ctx context.Context, id int64, m *mediaextras.Markers) error
- func (s *Store) SaveMeta(ctx context.Context, target string, id int64, m *TitleMeta) error
- func (s *Store) SaveRigGame(ctx context.Context, libraryID int64, path, title, tagline string, ...) (int64, error)
- func (s *Store) SaveScannedMarkers(ctx context.Context, id int64, m *mediaextras.Markers) error
- func (s *Store) SaveTitle(ctx context.Context, t *Title) error
- func (s *Store) SaveView(ctx context.Context, userID int64, v *SavedView) error
- func (s *Store) SavedViews(ctx context.Context, userID int64) ([]SavedView, error)
- func (s *Store) ScanRuns(ctx context.Context) ([]ScanRun, error)
- func (s *Store) SearchPeople(ctx context.Context, text string, limit int, access *Access) ([]FoundPerson, error)
- func (s *Store) SeasonPoster(ctx context.Context, showID int64, n int) string
- func (s *Store) Seasons(ctx context.Context, showID, userID int64, access *Access) ([]Season, error)
- func (s *Store) SeriesInLibrary(ctx context.Context, libraryID int64, access *Access) ([]LibraryCollection, error)
- func (s *Store) SetCredits(ctx context.Context, target string, id int64, source string, list []CreditIn) error
- func (s *Store) SetDiscRank(ctx context.Context, it *Item, rank *DiscRank) error
- func (s *Store) SetItemEdited(ctx context.Context, id int64, fields ...string) error
- func (s *Store) SetItemPrefs(ctx context.Context, id int64, playMode, insertFX string) error
- func (s *Store) SetLibraryConsole(ctx context.Context, id int64, console string) error
- func (s *Store) SetLibraryForeignNFO(ctx context.Context, id int64, on bool) error
- func (s *Store) SetLibraryReadOnly(ctx context.Context, id int64, on bool) error
- func (s *Store) SetLibraryShowMain(ctx context.Context, id int64, on bool) error
- func (s *Store) SetManualMarkers(ctx context.Context, id int64, m *mediaextras.Markers) error
- func (s *Store) SetMatchRules(ctx context.Context, libraryID int64, rules []MatchRule) ([]MatchRule, error)
- func (s *Store) SetPersonDetails(ctx context.Context, id int64, d PersonDetails) error
- func (s *Store) SetProgress(ctx context.Context, userID, itemID int64, p Progress) error
- func (s *Store) SetReaction(ctx context.Context, userID, itemID int64, value int) error
- func (s *Store) SetRigPoster(ctx context.Context, itemID int64, poster string) (bool, error)
- func (s *Store) SetSeasonPoster(ctx context.Context, showID int64, n int, poster string, replace bool) error
- func (s *Store) SetShowView(ctx context.Context, id int64, view string) error
- func (s *Store) ShareByToken(ctx context.Context, tok string) (*ShareLink, error)
- func (s *Store) ShareHolds(ctx context.Context, shareID, itemID int64) bool
- func (s *Store) ShareItems(ctx context.Context, shareID int64) ([]int64, error)
- func (s *Store) ShareOwner(ctx context.Context, id int64) (int64, error)
- func (s *Store) Shares(ctx context.Context, userID int64, all bool) ([]ShareLink, error)
- func (s *Store) Show(ctx context.Context, id, userID int64) (*Show, error)
- func (s *Store) ShowCredits(ctx context.Context, showID int64, season int, access *Access) (*Credits, error)
- func (s *Store) ShowFacts(ctx context.Context, id int64) (*Show, error)
- func (s *Store) ShowGenres(ctx context.Context, libraryID int64, access *Access) ([]string, error)
- func (s *Store) Shows(ctx context.Context, q ShowQuery) ([]*Show, error)
- func (s *Store) Subscribe(ctx context.Context, userID, creatorID int64, on bool) error
- func (s *Store) SyncBrands(ctx context.Context) error
- func (s *Store) TitleBrands(ctx context.Context, target string, id int64, kind string) []string
- func (s *Store) TitleListings(ctx context.Context, target string, id int64) ([]ListingPlatform, int64)
- func (s *Store) TitleMeta(ctx context.Context, target string, id int64) *TitleMeta
- func (s *Store) TryRules(ctx context.Context, libraryID int64, rules []MatchRule) ([]RuleTry, error)
- func (s *Store) Undo(ctx context.Context, batch string) (int, error)
- func (s *Store) Unsubscribe(ctx context.Context, id int64) error
- func (s *Store) UpdateCreator(ctx context.Context, id int64, name, handle, description, platform, url string) error
- func (s *Store) UpdateItem(ctx context.Context, it *Item) error
- func (s *Store) UpdateLibrary(ctx context.Context, id int64, name, typ string, paths []string) (*Library, error)
- func (s *Store) UpsertShow(ctx context.Context, sh *Show) error
- func (s *Store) VideoByID(ctx context.Context, userID int64, it *Item) (*VideoDetail, error)
- func (s *Store) VideoTags(ctx context.Context, libraryID int64, access *Access, limit int) ([]string, error)
- func (s *Store) Videos(ctx context.Context, q VideoQuery) ([]VideoCard, bool, error)
- func (s *Store) VisibleCounts(ctx context.Context, libs []Library, a *Access) error
- func (s *Store) VisibleRigGames(ctx context.Context, libraryID int64, a *Access) (int, error)
- func (s *Store) WatchCacheGet(ctx context.Context, source, kind, id, region string) (string, int64, bool)
- func (s *Store) WatchCachePut(ctx context.Context, source, kind, id, region, body string) error
- func (s *Store) WatchLater(ctx context.Context, userID int64) (*Collection, error)
- type StoredMarkers
- type SubtitleFile
- type SuggestJob
- type TMDB
- func (t *TMDB) Check(ctx context.Context) error
- func (t *TMDB) Enrich(ctx context.Context, it *Item) error
- func (t *TMDB) Images(ctx context.Context, it *Item) (posters, backdrops []string, err error)
- func (t *TMDB) MovieCredits(ctx context.Context, id string) ([]CreditIn, error)
- func (t *TMDB) Person(ctx context.Context, id string) (*PersonDetails, error)
- func (t *TMDB) WatchOffers(ctx context.Context, kind, id, region string) (*WatchOffers, error)
- type TOCEntry
- type TVDB
- func (t *TVDB) Check(ctx context.Context) error
- func (t *TVDB) Episodes(ctx context.Context, id string) (map[[2]int]EpisodeMeta, error)
- func (t *TVDB) FindSeries(ctx context.Context, name string, year *int) (*SeriesMeta, error)
- func (t *TVDB) Name() string
- func (t *TVDB) Search(ctx context.Context, name string, year *int) ([]string, error)
- func (t *TVDB) Series(ctx context.Context, id string) (*SeriesMeta, error)
- type TVMaze
- func (t *TVMaze) Episodes(ctx context.Context, id string) (map[[2]int]EpisodeMeta, error)
- func (t *TVMaze) FindSeries(ctx context.Context, name string, year *int) (*SeriesMeta, error)
- func (t *TVMaze) Name() string
- func (t *TVMaze) Series(ctx context.Context, id string) (*SeriesMeta, error)
- func (t *TVMaze) ShowCredits(ctx context.Context, id string) ([]CreditIn, error)
- type Title
- func (t *Title) EditFields(changes map[string]string, lock bool) error
- func (t *Title) Field(f string) string
- func (t *Title) FieldNames() []string
- func (t *Title) HasField(f string) bool
- func (t *Title) LibraryID() int64
- func (t *Title) Name() string
- func (t *Title) Path() string
- func (t *Title) Provider() (string, string)
- func (t *Title) RevertField(f string) error
- func (t *Title) SetField(f, v string) error
- func (t *Title) Snapshot() titleSnapshot
- func (t *Title) SourceOf(f string) string
- type TitleMeta
- type TitlePoster
- type VideoCard
- type VideoDetail
- type VideoEdit
- type VideoQuery
- type ViewEvent
- type WatchOffer
- type WatchOffers
- type WatchQuery
- type WatchTotal
- type Wikidata
- type WikimediaLogos
- type YearReview
Constants ¶
const ( FeatureGames = "games" // play games, here or on a game PC FeatureRecordings = "recordings" // record Live TV FeatureDownloads = "downloads" // keep a copy of a file FeatureSharing = "sharing" // make share links FeatureComments = "comments" // see comments, and write them FeatureRemote = "remote" // use the server away from home FeatureEditProfile = "editProfile" // change their own name and picture FeatureEditLayout = "editLayout" // rearrange pages for themselves: order, hidden rows, card sizes // FeatureSyncplay: watch parties, starting one and joining one. // FeatureRemoteControl: playing on and steering other devices. A profile // without it can still be played on and steered by whoever may. FeatureSyncplay = "syncplay" FeatureRemoteControl = "remoteControl" )
What an account can be kept from doing, apart from what it may watch.
const ( WatchStream = "stream" // with a subscription WatchFree = "free" WatchAds = "ads" WatchRent = "rent" WatchBuy = "buy" )
Kinds of watch offer.
const ( LogoStudio = "studio" LogoNetwork = "network" LogoPlatform = "platform" )
The kinds of thing that can have a logo.
const ( LogoPending = "pending" // not looked for yet LogoFound = "found" // there is a file LogoNone = "none" // looked, and no source has one LogoText = "text" // someone chose the name alone )
What's known about a logo.
const ( RoleCast = "cast" // in the regular cast: a film's, or a show's series regulars RoleGuest = "guest" // a guest star in one episode RoleCrew = "crew" // behind the camera, in a department )
Credit roles.
const ( CreditsNFO = "nfo" CreditsTMDB = "tmdb" CreditsTVDB = "tvdb" CreditsTVMaze = "tvmaze" CreditsTags = "tags" )
Credit sources, best first. nfo is a file beside the media (the owner's, or one this server wrote, which holds what an online source said); tags are a file's own tags, which name few.
const ( // RigConsole marks a games library, and its items, as belonging to a gaming PC. RigConsole = "rig" // RigArtPrefix starts the name of every picture that came from a PC. RigArtPrefix = "cache:rig-" )
const ( TargetItem = "item" TargetShow = "show" )
Targets.
const ( MatchAuto = "" // whatever the scan found MatchManual = "manual" // a person chose it: lookups leave it alone MatchNone = "none" // a person said it has no match: nothing is looked up for it )
What's been decided about a title's match.
const ( SourceFile = "file" SourceNFO = "nfo" SourceLocal = "local" SourceFrame = "frame" SourceProbe = "probe" // SourceSaved: an NFO this server wrote itself earlier. It says what some match said // back then, so it's no more a person's work than that match was. SourceSaved = "saved" )
Where a value can come from besides a metadata service.
const ( LinkExtra = "extra" LinkVersion = "version" )
The kinds of attachment.
const ( NoPosterFrame = "frame" // a frame from the video (the default) NoPosterTitle = "title" // its title, made into a poster NoPosterNone = "none" // nothing: apps draw their own placeholder )
NoPoster settings: what a film or video with no poster of its own gets.
const ( OriginalsFolder = ".wittymedia-originals" WorkFolder = ".wittymedia-work" )
Hidden folders beside a video. A scan never goes into a folder whose name starts with a dot.
const BrandSeries = "series"
BrandSeries is the kind of row in title_brands for a film series. It has no logo.
const CDKind = "cd-image"
CDKind is a CD image's item kind.
const CommercialsType = "commercials"
CommercialsType is a library of the owner's own adverts and bumpers for channels. They are titles to schedule, not to browse, so they stay out of Home, search and everything else that looks across libraries.
const ConvertedInfix = ".wms-converted."
ConvertedInfix marks a converted copy written beside its original: "Film.wms-converted.mkv". A scan leaves it out, so it never shows up as a film of its own.
const (
// EmbeddedMotion marks a picture's motion clip as being inside its own file.
EmbeddedMotion = "embedded:"
)
const (
FilmActing = "acting"
)
The parts of a person's titles: what they are seen (and heard) in, then each department.
const LazyPoster = "lazy:"
LazyPoster in an item's poster field means: made on demand by Thumb.
const ListingAttribution = "Listings from JustWatch, through TMDB. This product uses the TMDB API but is not endorsed or certified by TMDB."
ListingAttribution is the credit TMDB requires, in the words shown everywhere.
const ListingsVersion = "1"
ListingsVersion goes up if what the owner accepted changes enough to ask again.
const LogoConsentVersion = "1"
LogoConsentVersion goes up if what the owner agreed to changes enough to ask again.
const (
MapMaxZoom = 20
)
The map is grouped as it's drawn: Web Mercator, 256 pixels across the world at zoom 0 and twice that at each step, as online maps are. Pictures fall into squares of mapCellPx, and groups whose pins would still overlap are joined, so groups never pile up, near the poles or at the equator.
const MaxCommentRunes = 2000
MaxCommentRunes is the longest comment accepted.
const MusicBrainzAttribution = cdlookup.Attribution
MusicBrainzAttribution is what is shown wherever their data is used.
const NoAgeLimit = -1
NoAgeLimit as MaxAge: only the library and title choices apply.
const RadioDirectorySource = "radio-browser"
RadioDirectorySource names the directory on stations that came from it.
const SourceMade = "made"
SourceMade marks a poster made from the title's words.
const SourceYou = "you"
SourceYou marks what a person typed.
const WatchCacheMaxAge = listingMaxAge
WatchCacheMaxAge is how long a where-to-watch answer is kept: the same as listings.
Variables ¶
var ( // ErrNoPhotoEngine: WittyPhotos isn't on this server. ErrNoPhotoEngine = errors.New("WittyPhotos isn't on this server") // ErrNoRawPreview: this RAW file holds no picture to show. ErrNoRawPreview = errors.New("this RAW file has no preview") )
var AgentKinds = []string{"movies", "discs", "videos", "books"}
AgentKinds are the library types custom agents can serve.
var Departments = []Department{
{"directing", "Directing"}, {"writing", "Writing"}, {"production", "Production"}, {"camera", "Camera"},
{"lighting", "Lighting"}, {"editing", "Editing"}, {"sound", "Sound"}, {"art", "Art"},
{"costume", "Costume & Make-Up"}, {"effects", "Visual Effects"}, {"crew", "Crew"},
}
Departments are the crew departments in the order a page lists them. The names are TMDB's, which Kodi, Jellyfin and TVDB's own people types map onto.
var EngineThere = func(string) bool { return false }
EngineThere says whether a disc engine is on this server, so a scan can tell a disc it can't read yet from one that can't be read. The server sets it as it starts.
var ErrAlreadyUndone = errors.New("that has already been undone")
ErrAlreadyUndone: this group of changes has been undone.
ErrDirectoryUnavailable: no directory server gave a usable answer.
var ErrListingsNotAccepted = errors.New("every statement has to be accepted before listings can be turned on")
ErrListingsNotAccepted: every disclosure has to be accepted first.
var ErrLogosNotAgreed = errors.New("downloading logos isn't turned on. Turn it on in Settings, Metadata agents, after reading what it means")
ErrLogosNotAgreed: downloading logos needs the owner's agreement first.
var ErrModuleArt = errors.New("a poster or backdrop must be an address the host API's PutImage gave this module")
ErrModuleArt: a picture a module names must be one it kept through the host API.
var ErrNeedsDjVu = errors.New("DjVu books need the DjVuLibre tools (ddjvu) on the server. You can still download this one")
ErrNeedsDjVu: the book is here, the program that draws its pages isn't.
var ErrNoReader = errors.New("this kind of book can't be opened here")
ErrNoReader says a book can't be opened here, and why.
var ErrNoRoom = errors.New("the disk is nearly full")
ErrNoRoom: too little of the disk is left to go on.
var ErrNoScanModule = errors.New("the module that scans this kind of library isn't installed and turned on")
ErrNoScanModule: the module that scans this kind of library isn't installed and turned on.
var ErrNotAudio = errors.New("that address isn't an audio stream")
ErrNotAudio: the address gave something other than sound.
var ErrNotFound = errors.New("not found")
var ErrNotInLibrary = errors.New("not a file in a library")
ErrNotInLibrary: the path isn't a plain file inside a library folder.
var ErrReadOnly = errors.New("this library is set to read-only, so nothing can be added to its folders. An administrator can change that under its conversion settings")
ErrReadOnly: someone asked to add a file to a library set to read-only.
var ErrScanStuck = errors.New("the scan was stopped because nothing moved for a long time")
ErrScanStuck: nothing moved for StuckAfter.
var ErrStationEncrypted = errors.New("that stream is encrypted, so it can't be played")
ErrStationEncrypted: the stream's sound is encrypted, which is never undone here.
var ErrTooLarge = errors.New("too large")
ErrTooLarge: a file beside the media is bigger than any real one of its kind.
var ExtraTypes = []string{"trailer", "featurette", "behind-the-scenes", "deleted-scene", "interview", "short", "other"}
ExtraTypes are the kinds of bonus feature.
var Features = []string{FeatureGames, FeatureRecordings, FeatureDownloads, FeatureSharing, FeatureComments, FeatureSyncplay, FeatureRemoteControl, FeatureRemote, FeatureEditProfile, FeatureEditLayout}
Features lists them in the order Settings shows them.
var ListingAcknowledgements = []string{"not-streaming", "no-affiliation", "may-be-wrong", "sends-titles"}
ListingAcknowledgements are the separate things the owner has to accept. Each one has to be sent back to turn the feature on.
var RadioDirectoryServers = radioDirectoryServers
RadioDirectoryServers lists the directory's servers, in the order to try them. Tests replace it with a local stand-in.
var SafeClient = &http.Client{ Timeout: 0, Transport: logging.Calls(safeTransport, "library", "online"), CheckRedirect: func(req *http.Request, via []*http.Request) error { if len(via) >= 8 || (req.URL.Scheme != "http" && req.URL.Scheme != "https") { return errors.New("too many or unsafe redirects") } return nil }, }
SafeClient fetches feeds and episodes from the internet only: addresses on the local network or this machine are refused, so a feed cannot be used to reach other devices (server-side request forgery).
var StuckAfter = 10 * time.Minute
StuckAfter is how long a scan may go without anything moving before it's stopped as stuck. Tests make it shorter.
var ThumbWidths = []int{160, 320, 480, 640, 1280, 1920, 2560}
ThumbWidths are the sizes that can be asked for (the longer side, in pixels). A fixed list keeps the cache from filling with every width someone could type.
Functions ¶
func AgeFor ¶
AgeFor returns the minimum age for a content rating, or nil if unknown (unrated). Country prefixes ("US:PG-13", "de/12") are accepted.
func BoardAge ¶
BoardAge says what a board's rating means, in years. Nil: unknown, or not decided yet (Rating Pending), which is treated as having no rating at all.
func CDTrackNumber ¶
CDTrackNumber reads a track's number from its path.
func ChannelBrandName ¶
ChannelBrandName is the name a tuner or playlist channel would have its logo under, or "" if it isn't one worth asking about. What comes out goes to the logo service, which only takes a logo by itself when the name is exact, so this keeps to removing what's plainly not part of the name, and leaves out what could only ever match the wrong thing.
func CleanComment ¶
CleanComment trims a comment and drops control characters, keeping line breaks. It returns "" for an empty one or one that is too long.
func CleanPicture ¶
CleanPicture reads an uploaded picture and writes it again from its pixels, so nothing but the picture survives: no location or camera details, no trailing data. A picture with see-through parts (a logo) becomes a PNG, which keeps them; anything else a JPEG, which keeps a large photo small.
func CleanRadioText ¶
CleanRadioText makes text from a station or a directory fit to store and show: no markup, no control or direction-changing characters, one line, limited length. The interface escapes what it shows as well; this is so nothing odd is kept.
func CleanViewQuery ¶
CleanViewQuery keeps only what a saved view can hold, for storing.
func ClipName ¶
ClipName names a commercial from its file. All of the name is the title: in "1999 Toyota 2000 Clearance Sale" the second year is part of what it's called, not where a film's name ends. The year is the first one in it.
func ComicPageWeb ¶
ComicPageWeb is comicPageWeb for the server's handlers.
func ComicPages ¶
ComicPages lists the page images of a comic archive in reading order.
func CommonsCredits ¶
CommonsCredits says, for each address that is a picture on Commons, where it came from and under what licence. Addresses of anything else, and files Commons no longer has as free, are left out.
func CommonsFileOf ¶
CommonsFileOf is the name of the Commons file a picture's address shows, or "" for any other address. "https://upload.wikimedia.org/wikipedia/commons/thumb/a/ab/A_poster.jpg/500px-A_poster.jpg" is "A poster.jpg", and so is the same on thumb.wikimedia.org, where Commons now puts some thumbnails.
func ConfidenceFor ¶
ConfidenceFor rates a title's current match from what's stored, without asking anyone: it's run over a whole library to find what needs a look.
func CreateInLibrary ¶
CreateInLibrary makes a new file named name in the folder dir under root, and any folders on the way, numbering the name when it is taken.
func DateFromName ¶
DateFromName reads a date from a file name, as wall-clock seconds.
func DepartmentKeys ¶
func DepartmentKeys() []string
DepartmentKeys are the departments' keys in order.
func DepartmentOf ¶
DepartmentOf turns a department as a source writes it ("Directing", "Costume & Make-Up", "Visual Effects") or a job with no department ("Director", "Set Decoration") into a key.
func DiscMainTitle ¶
func DiscMainTitle(d *dvd.Disc, info *DiscInfo) *dvd.TitleSummary
DiscMainTitle is the title an item's disc counts as its film, laid out to read: the engine's assembled feature, someone's choice, or the older rule's pick.
func DjvuPageList ¶
DjvuPageList names a DjVu book's pages in the form the comic reader uses.
func FileKind ¶
FileKind says what a file is to the server, from its name: video, audio, book, disc (an image of a DVD or Blu-ray), subtitle, image, playlist or other.
func ForgetsDetails ¶
ForgetsDetails: a library whose titles are looked up by file name, so forgetting their details means something. Music, books, photos and games keep their own kinds of facts.
func FreeLogoLicense ¶
FreeLogoLicense: public domain, or a licence that allows reuse, changes (these files are recoloured) and commercial use. "No derivatives" and "non-commercial" never appear on Commons, and aren't taken if one ever does.
func GuessDiscContent ¶
GuessDiscContent: a disc in a TV library, or named like part of a series, holds TV episodes; anything else is taken to be a film.
func HLSKeyProtection ¶
HLSKeyProtection says why a key line means a stream can't be played, or "". Only METHOD=NONE, said plainly and with nothing else claiming otherwise, means no key.
func HueOf ¶
HueOf is a title's own colour, worked out from its words as the web app's artHue does (a letter at a time, by its first UTF-16 unit), so a made poster and a card agree.
func ID3Title ¶
ID3Title reads the song from an ID3v2 tag at the start of a packed audio HLS segment: "Artist - Track", or whichever of them is there. Sizes come from the station and are all checked against the bytes actually given.
func IsAudioLibrary ¶
IsAudioLibrary reports whether a library type holds audio files.
func IsConvertedCopy ¶
IsConvertedCopy says whether a file name is such a copy.
func IsCreatorLibrary ¶
IsCreatorLibrary: shorts, channels or music videos. A music video's artist is its creator.
func IsGalleryLibrary ¶
IsGalleryLibrary: a library whose edits stay in the database, never written beside the media (the owner's own photos and archives are left as they are).
func IsLogoPreview ¶
IsLogoPreview: an address the logo chooser may ask the server to show.
func IsMadePoster ¶
IsMadePoster: a poster this server made by itself because there was none (a frame, or a title poster), which a picture from a source or beside the file may replace. One a person made and chose in the artwork picker is theirs, like any other choice.
func IsPhotoFile ¶
IsPhotoFile: a picture or camera RAW file by its name.
func IsRatingBoard ¶
IsRatingBoard says whether a name is a games age rating board's. Film ratings are written the same way, so only these names mean a game's rating.
func IsZipComic ¶
IsZipComic is comicIsZip for the server's handlers.
func ListChange ¶
ListChange adds to and takes from a list held as text.
func LooksLikeTVDisc ¶
LooksLikeTVDisc reports whether a disc's name reads like part of a TV series ("Friends Season 1 Disc 2", "THE_OFFICE_S2D1") rather than a film.
func MediaKind ¶
MediaKind is which of the kinds a limit can name an item belongs to: "" for those with none of their own (photos), which follow the general limit.
func MercX ¶
MercX and MercY place a point on the map, as a share of the world's width from the top left.
func ParseEmbeddedMotion ¶
ParseEmbeddedMotion reads where a clip lies in its picture's file.
func ParseEntries ¶
ParseEntries reads the entries of a playlist file, in order, as written.
func ParseStreamTitle ¶
ParseStreamTitle finds StreamTitle='...'; in an ICY metadata block. ok is false when the block doesn't mention the title (it may carry only other fields).
func PersonKey ¶
PersonKey is how two spellings of a name are told to be the same person: case, accents, punctuation and spacing don't count.
func PersonSortName ¶
PersonSortName is a name surname first ("Hanks Tom"), as a list of people is sorted, keeping a suffix (Jr., III) with the surname. One word, or a name that already has a comma, stays.
func PictureExt ¶
PictureExt names what kind of picture some bytes are, or "".
func PlaysDirect ¶
PlaysDirect is audioPlaysDirect for the server's handlers.
func RadioAudioType ¶
RadioAudioType: a type that carries sound. Anything else isn't relayed, so a station's address can't serve up a web page from this site.
func RemoteArtPath ¶
RemoteArtPath is where the artwork cache keeps a picture from the internet. The name is the cache's own: nothing from the address becomes part of it.
func ReservedName ¶
ReservedName says Windows gives this name to a device, whatever folder it is in.
func ResetRadioDirectoryCache ¶
func ResetRadioDirectoryCache()
ResetRadioDirectoryCache forgets the directory's answers (for tests).
func RewriteHLS ¶
func RewriteHLS(body []byte, base *url.URL, link func(abs string) string) (out []byte, title string, err error)
RewriteHLS turns a station's HLS playlist into one that leads back through this server: every address goes through link, so a player never contacts the station itself and the relay can check each answer. Video variants are left out, and an encrypted stream is refused, not unlocked. title is the song the playlist names, if any.
func SafeFileName ¶
SafeFileName makes a name that came from a client safe to create on any file system: no folders, control characters or characters some systems forbid, no leading dots, no reserved Windows names, and a sensible length. It returns "" when nothing usable is left.
func SafeTransport ¶
SafeTransport is a copy of SafeClient's transport, to change.
func SanitizeSVG ¶
SanitizeSVG returns a picture that keeps its shapes and loses anything active.
func SavePicture ¶
SavePicture keeps a picture in the image cache under a name that's only ours, and says how a title's field refers to it.
func SegmentTitle ¶
SegmentTitle finds the song at the start of an HLS segment: an ID3 tag in packed audio, or in the first emsg box of fragmented MP4. MPEG-TS segments carry theirs split across packets, and aren't read.
func SetPhotoEngine ¶
func SetPhotoEngine(e PhotoEngine)
SetPhotoEngine chooses what reads photos, once at start.
func SharesFolder ¶
SharesFolder: other media are beside this file, so the folder's pictures aren't all its own.
func SnapThumbWidth ¶
SnapThumbWidth is the smallest listed size that covers w.
func SniffMedia ¶
SniffMedia: the first bytes of a file really are a picture or video of a kind this library takes. Used for uploads, where the name alone proves nothing.
func SourceURL ¶
SourceURL is a title's page on a service. Only known addresses are built, from an id that's been checked, so a link can't be pointed anywhere else.
func StackedParts ¶
StackedParts lists the files of a split film, first part first, when this path is its first part. Any other file is just itself.
func TitleAlike ¶
TitleAlike says how alike two titles are, from 0 to 1.
func ValidDirectoryID ¶
ValidDirectoryID: the form of a directory's station ID.
func ValidLogoKind ¶
ValidLogoKind reports whether kind is one the service knows.
func ValidStreamURL ¶
ValidStreamURL keeps web addresses with a host.
func WebSafeImage ¶
WebSafeImage: browsers and native TV image views show these as they are. Everything else is sent as a JPEG.
func WikidataPoster ¶
WikidataPoster is the free poster from Commons of the film with this Wikidata id, or "".
func WithoutAddress ¶
WithoutAddress is an HTTP client's error without the address it quotes: a private feed's address is a password, and these errors end up in the log.
Types ¶
type Access ¶
type Access struct {
MaxAge int `json:"maxAge"` // highest minimum age allowed, e.g. 7 for "Kids 7+"; -1 = no limit
AllowUnrated bool `json:"allowUnrated"` // titles without a known rating
Libraries []int64 `json:"libraries"` // allowed libraries; empty = all
BlockGenres []string `json:"blockGenres"`
AllowItems []int64 `json:"allowItems"` // always allowed, whatever the rating
BlockItems []int64 `json:"blockItems"` // never allowed
AllowShows []int64 `json:"allowShows"`
BlockShows []int64 `json:"blockShows"`
// Live TV: whether the account sees Live TV at all, the server's own
// channels made from the libraries, and channels from tuners and IPTV.
LiveTV bool `json:"liveTv"`
LibraryChannels bool `json:"libraryChannels"`
TunerChannels bool `json:"tunerChannels"`
// Kinds: an age limit of its own for one kind of media ("film", "tv",
// "game", "music", "book"). A kind that isn't named follows MaxAge and
// AllowUnrated.
Kinds map[string]KindLimit `json:"kinds,omitempty"`
// OnlyGenres: when set, only titles with one of these genres. BlockTags:
// tags of videos never to show.
OnlyGenres []string `json:"onlyGenres,omitempty"`
BlockTags []string `json:"blockTags,omitempty"`
// Collections whose titles are always or never allowed, like AllowItems
// and BlockItems. Only collections that list their titles count: one made
// from a rule has no list to go by.
AllowCollections []int64 `json:"allowCollections,omitempty"`
BlockCollections []int64 `json:"blockCollections,omitempty"`
// Off names what the account may not do, of the Features below. A list of
// what is off, so limits written before a feature was a choice leave it on.
Off []string `json:"off,omitempty"`
// On names what a Kids or Guest profile was given that such profiles don't
// have unless someone says so: only "editProfile". See ForKind.
On []string `json:"on,omitempty"`
// Time: when the account may play things, and for how long each day.
Time *parental.TimeRules `json:"time,omitempty"`
// contains filtered or unexported fields
}
Access are the limits of one account. A nil *Access means no limits (administrators, and accounts nobody restricted).
func DefaultAccess ¶
DefaultAccess is what a new account of a kind starts with.
func (*Access) AllowsItem ¶
AllowsItem checks one item in Go (single-item pages and playback). showAge is the item's show's minimum age, if it is an episode.
func (*Access) AllowsLibrary ¶
AllowsLibrary reports whether the account may open a library at all.
func (*Access) AllowsOutside ¶
AllowsOutside says whether the account may see something that isn't in a library: a card a module's data source gives (docs/SDUI-MODULES.md). It has no ID to allow or block and no library, so what is held to is what it says of itself: its kind (games need the games switch), its genres and its content rating. A module that says nothing of a rating is unrated, which a profile that may not see unrated titles doesn't see.
func (*Access) CanWatchChannels ¶
CanWatchChannels reports whether the account may use a kind of channel ("library" or "tuner").
func (*Access) ForKind ¶
ForKind makes the limits say what the kind of profile decides: a Kids or Guest profile's name and picture are for whoever manages it, unless they gave it that (On). It is applied when limits are read for an account, so limits written before this was a choice mean what they always did.
func (*Access) ItemClause ¶
ItemClause is an SQL condition for items aliased "i". Ids are numbers from our own JSON, never user text, so they are inlined; genres are passed as arguments.
func (*Access) Limited ¶
Limited reports whether the account can't see everything. Someone who is limited can't set limits for others: a Kids profile they make with no limits and a password they know would be a way around their own.
func (*Access) Resolved ¶
Resolved reports whether the limits can answer for one title: they need no looking up, or have been.
func (*Access) ShowClause ¶
ShowClause is the same for shows aliased "s".
type Agent ¶
type Agent struct {
ID string `json:"id"`
Name string `json:"name"`
URL string `json:"url"` // with {title}, {year}, {type}
Header string `json:"header"` // optional "Name: value", for an API key
Kinds []string `json:"kinds"` // library types it serves: movies, videos, books
Enabled bool `json:"enabled"`
}
Agent is one custom metadata agent.
func ParseAgents ¶
ParseAgents reads the agents setting (a JSON list); bad entries are dropped.
func (*Agent) Lookup ¶
func (a *Agent) Lookup(ctx context.Context, title string, year *int, libType string) (*AgentResult, error)
Lookup asks the agent about a title.
type AgentResult ¶
type AgentResult struct {
ID string `json:"id"`
Title string `json:"title"`
Year int `json:"year"`
Overview string `json:"overview"`
Tagline string `json:"tagline"`
Genres []string `json:"genres"`
Rating float64 `json:"rating"`
ContentRating string `json:"contentRating"`
Studio string `json:"studio"`
RuntimeMinutes int `json:"runtimeMinutes"`
Poster string `json:"poster"`
Backdrop string `json:"backdrop"`
}
AgentResult is what an agent answers.
type Album ¶
type Album struct {
Artist string `json:"artist"`
Title string `json:"title"`
Year *int `json:"year,omitempty"`
Tracks int `json:"tracks"`
DurationSec float64 `json:"durationSec"`
CoverItem int64 `json:"coverItem"` // an item whose poster is the cover
// FirstItem is the album's first track (disc, then track number): what Play starts
// with, and what tells two albums apart when neither has a cover.
FirstItem int64 `json:"firstItem,omitempty"`
AddedAt int64 `json:"addedAt"`
Genre string `json:"genre,omitempty"`
}
Album is a group of tracks (or an audiobook's chapters).
type AlbumFilter ¶
type AlbumFilter struct {
Artist, Search, Sort, Genre string
UserID int64
Limit int
// PlayedOnly keeps the albums this person has listened to (for a "recently played" shelf: an album never played isn't one).
PlayedOnly bool
}
AlbumFilter narrows and orders a list of albums. Sort: title | artist | year | added | played (this person's own plays, which needs UserID).
type AniList ¶
type AniList struct {
Client *http.Client
TitleLang string // english (default) | romaji | native
BaseURL string // tests
}
AniList reads anime metadata from anilist.co: free, no key. Anime libraries use it for show details; TitleLang picks English, rōmaji or native titles. AniList marks adult titles, which become an 18 rating so parental controls hide them.
func (*AniList) Episodes ¶
Episodes uses AniList's streaming-episode list for episode names and stills. Each AniList entry is one season, so they are season 1 (and the absolute numbers anime releases use).
func (*AniList) FindSeries ¶
FindSeries searches anime by name (any title language), preferring the year.
type Annotation ¶
type Annotation struct {
ID int64 `json:"id"`
ItemID int64 `json:"itemId"`
Kind string `json:"kind"` // bookmark | highlight | ink
Chapter int `json:"chapter"`
Pos float64 `json:"pos"` // chapter + fraction of the chapter
Quote string `json:"quote"`
Prefix string `json:"prefix"`
Suffix string `json:"suffix"`
Color string `json:"color"` // a named colour or #rrggbb
Note string `json:"note"`
Data string `json:"data,omitempty"` // ink: the stroke; PDF highlights: their boxes (JSON)
Created int64 `json:"created"`
}
Annotation is a bookmark, highlight, note or ink stroke in a book. A highlight is anchored by its quoted text plus a little text before and after it, so it is found again whatever the font size or screen. An ink stroke keeps its points in Data, relative to the word it was drawn by. In PDFs, where pages never reflow, a highlight also keeps its boxes on the page in Data and an ink stroke is in page units.
type ArtCandidate ¶
ArtCandidate is a picture a source has.
type Artist ¶
type Artist struct {
Name string `json:"name"`
Albums int `json:"albums"`
Tracks int `json:"tracks"`
CoverItem int64 `json:"coverItem"`
}
Artist is everyone credited as album artist (or the author).
type BookGroup ¶
type BookGroup struct {
// Name is "" for the books with no series, or no author.
Name string `json:"name"`
Books int `json:"books"`
// CoverItem is a book of the group with a cover, 0 when none has one.
CoverItem int64 `json:"coverItem"`
}
BookGroup is one series or one author, with how many books it holds.
type Brand ¶
type Brand struct {
Kind string `json:"kind"`
Name string `json:"name"`
Key string `json:"key"`
Count int `json:"count"`
}
Brand is a studio or a network with what's on this server from it.
type BrowseFilter ¶
type BrowseFilter struct {
Library int64
Search string
Genre string
Studio string
Network string
Year int
Decade int
Content string // a content rating
MinRating float64
Resolution string // 4k | 1080p | 720p | sd
Audio string // an audio language
Subtitle string // a subtitle language
Format string // an audio format such as "AC3 5.1"
Tag string
Edition string
Series string // a film series, which is a collection made from metadata
Kind string // video | dvd | bluray | disc | show
Disc string // what a disc holds: movie | tv | music
// AnimeOf: this anime library's shows and the anime of every TV library; HideAnime: a
// TV library when anime goes to the anime library only.
AnimeOf, HideAnime bool
Watched string // yes | no
Platform string // a streaming service's key (needs listings on)
// Person: only titles this person is credited on (a show: on the show or one of its
// episodes).
Person int64
Sort string // title | added | newest | oldest | rating | quality | shuffle
Desc bool
Seed int
Limit int
Offset int
}
BrowseFilter is what's asked for. The zero value is everything.
func ParseBrowseFilter ¶
func ParseBrowseFilter(q url.Values) BrowseFilter
ParseBrowseFilter reads a filter from a request's query or a saved view.
type BrowseResult ¶
BrowseResult is a page of results.
type BrowseRow ¶
type BrowseRow struct {
Type string `json:"type"` // item | show
Item *Item `json:"item,omitempty"`
Show *Show `json:"show,omitempty"`
}
BrowseRow is one result, a film or a show.
type CDInfo ¶
type CDInfo struct {
DiscID string `json:"discId"`
CDDBID string `json:"cddbId,omitempty"`
Format string `json:"format"`
// Lookup: "" not asked, matched, ask (several possible, a person chooses),
// unknown (nobody knows it), failed (couldn't ask; a later scan tries again),
// off (lookups are turned off) or sidecar (names read from a file beside it).
Lookup string `json:"lookup,omitempty"`
Matches int `json:"matches,omitempty"`
// ReleaseID is the MusicBrainz release in use, Disc which disc of it.
ReleaseID string `json:"releaseId,omitempty"`
Disc int `json:"disc,omitempty"`
// Source says where the names came from: musicbrainz, sheet (CD-TEXT or the
// sheet's titles), sidecar or file (the file's own name).
Source string `json:"source,omitempty"`
Tracks []CDTrackName `json:"tracks"`
}
CDInfo is what the server remembers about a disc, besides the item's own fields. The layout isn't kept: the sheet is read again when the disc is played.
type CDTrackName ¶
CDTrackName is a track's name from any source.
type Category ¶
type Category struct {
Key string `json:"key"`
Name string `json:"name"`
Genre string `json:"genre"`
Count int `json:"count"`
Hidden bool `json:"hidden"`
Position int `json:"position"`
Merged []string `json:"merged,omitempty"` // the other categories folded into this one
// What to draw it with: its members with the most artwork-worthy pictures.
Art []CategoryArt `json:"art"`
}
Category is one generated category.
type CategoryArt ¶
type CategoryArt struct {
Type string `json:"type"` // item | show
ID int64 `json:"id"`
Version int64 `json:"v"`
}
CategoryArt is one picture for a category's card.
type CategoryChange ¶
type CategoryChange struct {
Key string `json:"key"`
Name *string `json:"name"`
Hidden *bool `json:"hidden"`
Merge *string `json:"mergeInto"` // "" splits it back out
ArtItem *int64 `json:"artItem"`
}
CategoryChange is an edit to a category.
type Collection ¶
type Collection struct {
ID int64 `json:"id"`
OwnerID int64 `json:"ownerId"`
Owner string `json:"owner"`
Name string `json:"name"`
Description string `json:"description"`
Kind string `json:"kind"` // manual | smart
Rule *CollectionRule `json:"rule,omitempty"`
System string `json:"system,omitempty"` // watchlater
Count int `json:"count"`
CoverID int64 `json:"coverId"`
CoverShow int64 `json:"coverShowId,omitempty"`
UpdatedAt int64 `json:"updatedAt"`
}
Collection is a list or a smart playlist.
type CollectionRule ¶
type CollectionRule struct {
Libraries []int64 `json:"libraries,omitempty"`
LibraryTypes []string `json:"libraryTypes,omitempty"` // movies, music, ...
Genres []string `json:"genres,omitempty"` // any of these
Tags []string `json:"tags,omitempty"` // creator video tags, any of these
Search string `json:"search,omitempty"`
Artist string `json:"artist,omitempty"`
YearFrom int `json:"yearFrom,omitempty"`
YearTo int `json:"yearTo,omitempty"`
RatingMin float64 `json:"ratingMin,omitempty"`
RuntimeMinSec float64 `json:"runtimeMinSec,omitempty"`
RuntimeMaxSec float64 `json:"runtimeMaxSec,omitempty"`
Watched string `json:"watched,omitempty"` // yes | no | started
Liked bool `json:"liked,omitempty"`
AddedWithinDays int `json:"addedWithinDays,omitempty"`
Sort string `json:"sort,omitempty"` // added | title | year | rating | runtime | random | played
Desc bool `json:"desc,omitempty"`
Limit int `json:"limit,omitempty"` // up to 500
Episodes bool `json:"episodes,omitempty"`
}
CollectionRule is what a smart playlist asks for. Everything is a whitelisted field turned into SQL with arguments; nothing in it reaches a statement as text.
func (*CollectionRule) Clean ¶
func (r *CollectionRule) Clean() error
Clean checks a rule; its errors are safe to show.
type Comment ¶
type Comment struct {
ID int64 `json:"id"`
ItemID int64 `json:"itemId"`
ParentID *int64 `json:"parentId,omitempty"`
UserID *int64 `json:"userId,omitempty"`
Author string `json:"author"`
Body string `json:"body"`
Imported bool `json:"imported"`
Likes int64 `json:"likes,omitempty"`
CreatedAt int64 `json:"createdAt"`
EditedAt *int64 `json:"editedAt,omitempty"`
}
Comment is one comment on an item. Imported ones came with an archive and are shown with the name they had there; they can't be edited.
type CommonsArt ¶
CommonsArt is a title whose poster or backdrop is a picture from Commons.
type CommonsPicture ¶
type CommonsPicture struct {
URL string `json:"-"` // the thumbnail, on upload.wikimedia.org
Page string `json:"page"`
License string `json:"license"`
LicenseURL string `json:"licenseUrl,omitempty"`
Credit string `json:"credit,omitempty"`
}
CommonsPicture is a picture on Wikimedia Commons, with what its licence asks to be said about it.
type ConversionItem ¶
ConversionItem is a file of a library, as a conversion sees it.
type Creator ¶
type Creator struct {
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
Name string `json:"name"`
Handle string `json:"handle,omitempty"`
Description string `json:"description,omitempty"`
Platform string `json:"platform,omitempty"`
URL string `json:"url,omitempty"`
HasAvatar bool `json:"hasAvatar"`
HasBanner bool `json:"hasBanner"`
Videos int `json:"videos"`
Subscribed bool `json:"subscribed"`
Subscribers int `json:"subscribers"`
UpdatedAt int64 `json:"updatedAt"`
LatestAt string `json:"latestAt,omitempty"`
}
Creator is one person or channel in a library.
type CreatorQuery ¶
type CreatorQuery struct {
LibraryID int64
UserID int64
Access *Access
Search string
Subscribed bool
ID int64
}
CreatorQuery lists creators.
type Credit ¶
type Credit struct {
PersonID int64 `json:"personId"`
Name string `json:"name"`
HasPhoto bool `json:"hasPhoto"`
Role string `json:"role"`
Department string `json:"department,omitempty"`
Job string `json:"job,omitempty"`
Character string `json:"character,omitempty"`
Order int `json:"order"`
// Episodes: how many of a season's episodes a guest star is in (a season's guests).
Episodes int `json:"episodes,omitempty"`
Source string `json:"source"`
}
Credit is one person's part in a title, as a page shows it.
type CreditIn ¶
type CreditIn struct {
Name string
IDs PersonIDs
Photo string // a web address or a picture beside the media
Role string // RoleCast, RoleGuest or RoleCrew
Department string // crew: a key from Departments, or a source's own name for one
Job string // crew: Director, Screenplay, Set Decoration ...
Character string // cast and guests: who they played
Order int // cast: billing order, 0 first
}
CreditIn is one credit as a source gives it.
type Credits ¶
type Credits struct {
Cast []Credit `json:"cast"`
Guests []Credit `json:"guests"`
Crew []CrewGroup `json:"crew"`
}
Credits are a title's cast, guest stars and crew by department.
type CrewGroup ¶
type CrewGroup struct {
Department string `json:"department"`
Label string `json:"label"`
People []Credit `json:"people"`
}
CrewGroup is one department's people.
type Department ¶
Department is one crew department: the key the API sends and the name a page shows.
type DirectoryCount ¶
type DirectoryCount struct {
Name string `json:"name"`
Code string `json:"code,omitempty"`
Stations int `json:"stations"`
}
DirectoryCount is one entry of a browse list, with how many stations it has.
type DirectoryFacets ¶
type DirectoryFacets struct {
Countries []DirectoryCount `json:"countries"`
Tags []DirectoryCount `json:"tags"`
Languages []DirectoryCount `json:"languages"`
}
DirectoryFacets is what the directory can be browsed by.
func DirectoryBrowse ¶
func DirectoryBrowse(ctx context.Context) (*DirectoryFacets, error)
DirectoryBrowse gives what the directory can be browsed by, kept for hours: these lists barely change.
type DirectoryQuery ¶
type DirectoryQuery struct {
Text string
Tag string
Country string // two-letter code
Language string
Limit int
Offset int
}
DirectoryQuery is a search of the directory.
type DirectoryStation ¶
type DirectoryStation struct {
ID string `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
Homepage string `json:"homepage,omitempty"`
Logo string `json:"logo,omitempty"`
Tags []string `json:"tags"`
Country string `json:"country,omitempty"`
CountryCode string `json:"countryCode,omitempty"`
Language string `json:"language,omitempty"`
Codec string `json:"codec,omitempty"`
Bitrate int `json:"bitrate,omitempty"`
HLS bool `json:"hls"`
Votes int `json:"votes,omitempty"`
Working bool `json:"working"` // the directory's own latest check reached it
Added bool `json:"added"` // already in the library that was asked about
}
DirectoryStation is a station as a directory lists it, already cleaned.
func DirectoryByID ¶
func DirectoryByID(ctx context.Context, ids []string) ([]DirectoryStation, error)
DirectoryByID reads stations by their IDs; ones the directory no longer has are simply not in the answer.
func DirectorySearch ¶
func DirectorySearch(ctx context.Context, q DirectoryQuery) ([]DirectoryStation, error)
DirectorySearch searches the directory. Answers are kept for a few minutes, so typing and paging back don't ask it the same thing twice.
type DiscCandidate ¶
type DiscCandidate struct {
TTN int `json:"ttn"`
DurationSec float64 `json:"durationSec"`
Chapters int `json:"chapters"`
Class string `json:"class"`
Score float64 `json:"score"`
Decoy bool `json:"decoy,omitempty"`
Reasons []string `json:"reasons,omitempty"`
}
DiscCandidate is one title as the engine scored it.
type DiscChoice ¶
type DiscChoice struct {
TTN int `json:"ttn"`
By int64 `json:"by"` // the account that chose
At int64 `json:"at"`
// Was is the main title before the choice, for when it is cleared and no ranking is
// kept to go back to.
Was int `json:"was"`
}
DiscChoice is the title someone with the right to chose as this disc's film. It beats the engine's pick everywhere, until it is cleared or the disc no longer has that title.
type DiscEpisode ¶
type DiscEpisode struct {
Index int `json:"index"`
TTN int `json:"ttn"`
DurationSec float64 `json:"durationSec"`
StartSec float64 `json:"startSec"`
Chapter int `json:"chapter,omitempty"`
Item int `json:"item,omitempty"`
Part bool `json:"part,omitempty"`
}
DiscEpisode is one episode of a TV disc, in viewing order. One that has no title of its own is a stretch of the play-all title: Part is then true, and it starts at StartSec, at Chapter (DVD) or play item Item (Blu-ray) of that title.
type DiscFeature ¶
type DiscFeature struct {
Titles []int `json:"titles"`
DurationSec float64 `json:"durationSec"`
Source string `json:"source"` // chapters, commands or chain
// Assembled: more than the main title's own chapter table. It then plays as one
// stream in the engine's order.
Assembled bool `json:"assembled"`
Segments []dvd.FeatureSegment `json:"segments,omitempty"`
}
DiscFeature is what plays for the film on a DVD.
func (*DiscFeature) Engine ¶
func (f *DiscFeature) Engine() *dvd.Feature
Engine is the feature in the form the engine gave it, for laying it out to play.
type DiscInfo ¶
type DiscInfo struct {
Label string `json:"label"`
Format string `json:"format"`
HasMenus bool `json:"hasMenus"`
MainTitle int `json:"mainTitle"`
Titles []DiscTitle `json:"titles"`
Scrambled bool `json:"scrambled"`
// Content: what the disc holds, "movie" or "tv". Worked out from the
// library and the disc's name unless someone chose it (ContentManual).
Content string `json:"content,omitempty"`
ContentManual bool `json:"contentManual,omitempty"`
// CD: an audio CD image's own facts (kind cd-image), left out of lists.
CD *CDInfo `json:"cd,omitempty"`
// Rank is what the disc's engine made of it: which title is the film, why, and what
// else there is to choose. nil for a disc scanned with an engine from before rankings.
Rank *DiscRank `json:"rank,omitempty"`
// Chosen is the title someone chose as the film instead. MainTitle is then that title.
Chosen *DiscChoice `json:"chosen,omitempty"`
}
DiscInfo is the cached summary of a DVD.
func (*DiscInfo) EngineMain ¶
EngineMain is the main title without anyone's choice: the engine's pick, or what the older rule found before a choice was made.
func (*DiscInfo) FeaturePlays ¶
func (d *DiscInfo) FeaturePlays(ttn int) *DiscFeature
FeaturePlays is the assembled feature to play for a title, when that title is the engine's film and the film is more than the title's own chapter table.
type DiscIssue ¶
type DiscIssue struct {
Severity string `json:"severity"` // error, warn or info
Kind string `json:"kind"`
TTN int `json:"ttn"` // -1 when it is about no one title
What string `json:"what"`
}
DiscIssue is one place where a copy's structures disagree.
type DiscRank ¶
type DiscRank struct {
// Engine is the module and version that gave it, such as "wittydvd 0.4.0".
Engine string `json:"engine"`
// Main is the engine's pick, or -1 when it found nothing that could be the film.
Main int `json:"main"`
Confidence float64 `json:"confidence"` // 0 to 1
Level string `json:"level"` // high, medium or low
Why string `json:"why"` // one sentence
Reasons []string `json:"reasons"`
Against []string `json:"against,omitempty"`
// RunnerUp is the next best candidate, or -1.
RunnerUp int `json:"runnerUp"`
// Feature is what plays for the film on a DVD, when that is more than one title's
// chapter table says: several titles in a row, or chains only commands join.
Feature *DiscFeature `json:"feature,omitempty"`
Versions []DiscVersion `json:"versions,omitempty"`
Episodes []DiscEpisode `json:"episodes,omitempty"`
// PlayAll is the title that plays every episode, or -1.
PlayAll int `json:"playAll"`
Candidates []DiscCandidate `json:"candidates"`
// Decoys counts the titles the engine found to be decoys, and Hidden the candidates
// that aren't listed here.
Decoys int `json:"decoys"`
Hidden int `json:"hidden"`
Warnings []string `json:"warnings,omitempty"`
// Repairs are what the engine mended or read from a backup copy, and Issues where the
// copy's structures still disagree. The counts are of all of them.
Repairs []string `json:"repairs,omitempty"`
RepairCount int `json:"repairCount"`
Issues []DiscIssue `json:"issues,omitempty"`
IssueCount int `json:"issueCount"`
// PaddedSectors are sectors that couldn't be read while ranking and were taken as
// zeros; ReadRetries how many reads were tried again.
PaddedSectors int64 `json:"paddedSectors"`
ReadRetries int64 `json:"readRetries"`
// Protected: the video is encrypted. The structure was still read; nothing plays.
Protected bool `json:"protected,omitempty"`
SecondOpinion *DiscSecondOpinion `json:"secondOpinion,omitempty"`
At int64 `json:"at"`
}
DiscRank is the engine's ranking of a disc, as kept and shown.
func BlurayRank ¶
BlurayRank puts a Blu-ray's analysis in the kept form. nil when there is no ranking.
func DVDRank ¶
func DVDRank(a *dvdsession.Analysis) *DiscRank
DVDRank puts a DVD's analysis in the kept form. nil when there is no ranking.
type DiscSecondOpinion ¶
type DiscSecondOpinion struct {
Source string `json:"source"`
Agrees bool `json:"agrees"`
Main int `json:"main"`
Differences []string `json:"differences,omitempty"`
More int `json:"more,omitempty"`
// Note says why none was taken, when one was asked for.
Note string `json:"note,omitempty"`
}
DiscSecondOpinion is how a libbluray on this machine read the same disc.
type DiscVersion ¶
type DiscVersion struct {
Kind string `json:"kind"` // angle, parental, cut or edition
TTN int `json:"ttn"`
Angle int `json:"angle,omitempty"`
Levels []int `json:"parentalLevels,omitempty"`
DurationSec float64 `json:"durationSec"`
Label string `json:"label"`
Main bool `json:"main,omitempty"`
}
DiscVersion is another way to see the film.
type EPUBInfo ¶
type EPUBInfo struct {
Root string `json:"-"`
Spine []string `json:"spine"` // paths inside the archive
TOC []TOCEntry `json:"toc"`
Title string `json:"title"`
Author string `json:"author"`
Cover string `json:"-"`
// contains filtered or unexported fields
}
EPUBInfo is what the reader needs: the chapters in order and the contents.
type EpisodeListing ¶
type EpisodeListing struct {
Season int `json:"season"`
Episode int `json:"episode"`
Title string `json:"title"`
Aired string `json:"aired,omitempty"`
}
EpisodeListing is one number on the source.
type EpisodeMapResult ¶
type EpisodeMapResult struct {
Rows []EpisodeRow `json:"rows"`
Source string `json:"source"`
Label string `json:"sourceLabel"`
Listed []EpisodeListing `json:"listed"`
Note string `json:"note,omitempty"`
}
EpisodeMapResult is everything renumbering needs.
type EpisodeMeta ¶
type EpisodeMeta struct {
ID string
Season int
Number int
Title string
Overview string
Aired string
RuntimeMin int
Image string
// The episode's own guest stars and crew, when the service was asked for them.
Credits []CreditIn
CreditsRead bool
}
EpisodeMeta is one episode from the default (aired) order.
type EpisodeNumber ¶
type EpisodeNumber struct {
ID int64 `json:"id"`
Season *int `json:"season"`
Episode *int `json:"episode"`
EpisodeEnd *int `json:"episodeEnd"`
}
EpisodeNumber is a new number for a file.
type EpisodePreview ¶
type EpisodePreview struct {
Total int `json:"total"`
Known int `json:"known"`
Unknown []string `json:"unknown"` // the numbers it doesn't know, for fixing them
}
EpisodePreview says what a match does for a show's episodes.
type EpisodeRef ¶
type EpisodeRef struct {
Show string // from the show folder (or the file name when there is none)
ShowYear *int
ShowDir string // folder that groups the show's files
Season int
Episode int
EpisodeEnd int // last episode of a multi-episode file, 0 when single
Title string
// Absolute: the file only had an episode number counted across the whole
// show ("Show - 012"), as anime releases usually do. Season is 1 then.
Absolute bool
}
EpisodeRef is what a file name says about an episode.
func ParseEpisode ¶
func ParseEpisode(root, path string) (EpisodeRef, bool)
ParseEpisode reads show/season/episode from a path relative to the library root. Typical layouts:
Show Name (2002)/Season 02/Show Name - S02E01 - Title.mkv Show Name/Show.Name.S02E01.Title.1080p.mkv Show Name/2x01 - Title.mkv Show.Name.S02E01.mkv (no folder)
type EpisodeRow ¶
type EpisodeRow struct {
ID int64 `json:"id"`
File string `json:"file"`
Title string `json:"title"`
Season *int `json:"season"`
Episode *int `json:"episode"`
EpisodeEnd *int `json:"episodeEnd,omitempty"`
Locked bool `json:"locked"`
Known string `json:"known,omitempty"` // what the source calls this number
}
EpisodeRow is a file beside what the source says its number is.
type ErrBadInput ¶
type ErrBadInput string
ErrBadInput is a refused value; its text is safe to show.
func (ErrBadInput) Error ¶
func (e ErrBadInput) Error() string
type ExportResult ¶
type ExportResult struct {
Total int `json:"total"`
Written int `json:"written"`
Unchanged int `json:"unchanged"`
Kept int `json:"kept"` // files with edits not applied yet, left alone
Problems []metafolder.Problem `json:"problems"`
}
ExportResult is how an export went.
type Facet ¶
type Facet struct {
Value string `json:"value"`
Label string `json:"label,omitempty"`
Count int `json:"count"`
}
Facet is one value and how many titles have it.
type Facets ¶
type Facets struct {
Genres []Facet `json:"genres"`
Studios []Facet `json:"studios"`
Networks []Facet `json:"networks"`
Decades []Facet `json:"decades"`
Years []Facet `json:"years"`
Content []Facet `json:"content"`
Resolutions []Facet `json:"resolutions"`
Audio []Facet `json:"audio"`
Subtitles []Facet `json:"subtitles"`
Formats []Facet `json:"formats"`
Tags []Facet `json:"tags"`
Editions []Facet `json:"editions"`
Kinds []Facet `json:"kinds"`
Platforms []Facet `json:"platforms"`
}
Facets lists everything a library can be filtered by.
type FactsProgress ¶
type FactsProgress struct {
Running bool `json:"running"`
Total int64 `json:"total"`
Done int64 `json:"done"`
Found int64 `json:"found"`
}
FactsProgress is how far a fill has got.
func NetworkFactsProgress ¶
func NetworkFactsProgress() FactsProgress
NetworkFactsProgress reads the state of the current or last fill.
type FieldChange ¶
type FieldChange struct {
Field string `json:"field"`
Label string `json:"label"`
Current string `json:"current"`
Incoming string `json:"incoming"`
Source string `json:"source"`
Locked bool `json:"locked"`
// Change says it differs; Apply says it would be changed unless someone unticks it.
Change bool `json:"change"`
Apply bool `json:"apply"`
Note string `json:"note,omitempty"`
}
FieldChange is one row of "here's what would change".
func DiffDetails ¶
func DiffDetails(t *Title, d *MatchDetails) []FieldChange
DiffDetails compares what a source says with what a title has. Locked fields are shown so nobody wonders why they didn't change. Text someone typed, an NFO and pictures beside the file aren't replaced unless someone ticks them.
type FileChange ¶
type FileChange struct {
File string `json:"file"`
Target string `json:"target"`
ID int64 `json:"id"`
Name string `json:"name"`
Fields []FolderFieldChange `json:"fields"`
}
FileChange is what one file would change.
type FilmGroup ¶
type FilmGroup struct {
Key string `json:"key"`
Label string `json:"label"`
Titles []FilmTitle `json:"titles"`
}
FilmGroup is one part of a filmography: their acting, or one department's work.
type FilmTitle ¶
type FilmTitle struct {
Target string `json:"target"` // item or show
ID int64 `json:"id"`
Title string `json:"title"`
Year int `json:"year,omitempty"`
Character string `json:"character,omitempty"`
Job string `json:"job,omitempty"`
Episodes int `json:"episodes,omitempty"`
Guest bool `json:"guest,omitempty"`
// contains filtered or unexported fields
}
FilmTitle is one film or show and what the person did in it. An episode's guest part or crew work is its show's, with how many episodes.
type Filmography ¶
type Filmography struct {
Groups []FilmGroup `json:"groups"`
}
Filmography is a person's titles in this library that an account may see, by part.
type FolderApply ¶
type FolderApply struct {
User string
ImagesDir string
// Persist writes a title beside its media after a change, if the owner wants that.
Persist func(context.Context, *Title)
}
FolderApply says who is applying and where things go.
type FolderFieldChange ¶
type FolderFieldChange struct {
Field string `json:"field"`
Label string `json:"label"`
Old string `json:"old"`
New string `json:"new"`
Line int `json:"line,omitempty"`
}
FolderFieldChange is one thing a file would change.
type FolderPreview ¶
type FolderPreview struct {
Dir string `json:"dir"`
Files int `json:"files"` // files of titles, and pictures
Unchanged int `json:"unchanged"` // nothing to do
Changes []FileChange `json:"changes"`
Listed bool `json:"listed"` // false: more changes than were listed
Total int `json:"total"` // changed files, listed or not
Problems []metafolder.Problem `json:"problems"`
}
FolderPreview is what applying the folder would do.
type FolderResult ¶
type FolderResult struct {
Batch string `json:"batch,omitempty"` // for undoing all of it
Applied int `json:"applied"`
Fields int `json:"fields"`
Skipped int `json:"skipped"`
Changes []FileChange `json:"changes"`
Problems []metafolder.Problem `json:"problems"`
}
FolderResult is how applying it went.
type ForgetOptions ¶
type ForgetOptions struct {
Files bool
Details bool
// ImagesDir is the artwork cache, where downloaded pictures and their smaller copies are.
ImagesDir string
}
ForgetOptions says which parts to forget.
type ForgetResult ¶
type ForgetResult struct {
Libraries int `json:"libraries"`
// Files beside the media.
Removed int `json:"removed"` // files of the server's removed
Restored int `json:"restored"` // a person's NFO put back from its .nfo.bak
Companions int `json:"companions"` // macOS "._" files that went with them
Skipped int `json:"skipped"` // recorded, but changed since or couldn't be removed
Titles int `json:"titles"` // films and episodes reset
Shows int `json:"shows"` // shows reset
Cached int `json:"cached"` // pictures removed from the artwork cache
Logos int `json:"logos"` // downloaded logos dropped (every library only)
LockedKept int `json:"lockedKept"` // fields kept because a person locked or typed them
NotReset []string `json:"notReset"` // libraries whose kind of details aren't looked up this way
Problems []string `json:"problems,omitempty"`
}
ForgetResult says what was done.
type FoundPerson ¶
type FoundPerson struct {
ID int64 `json:"id"`
Name string `json:"name"`
HasPhoto bool `json:"hasPhoto"`
KnownFor string `json:"knownFor,omitempty"`
Titles int `json:"titles"`
}
FoundPerson is a person a search found, with how many titles of theirs the account may see.
type HLSAttr ¶
type HLSAttr struct {
Key string // in capitals
Value string // without its quotes
Raw string // as written
}
HLSAttr is one attribute of an HLS tag.
func ParseHLSAttrs ¶
ParseHLSAttrs reads KEY=value,KEY="value, with commas". A value can hold words that look like another attribute, such as IV="METHOD=NONE", so looking for those words in the line isn't enough.
type HistoryEntry ¶
type HistoryEntry struct {
Batch string `json:"batch"`
At int64 `json:"at"`
User string `json:"user"`
Action string `json:"action"`
Title string `json:"title"`
Count int `json:"count"`
Undone bool `json:"undone"`
}
HistoryEntry is a group of changes that can be undone.
type IcyReader ¶
type IcyReader struct {
// contains filtered or unexported fields
}
IcyReader gives a stream's audio with the metadata blocks taken out, and hands each block's title to onTitle. A block is at most 4080 bytes (its length byte counts sixteens), so a station can't make this hold more than that.
func NewIcyReader ¶
NewIcyReader reads r, whose metadata comes every metaInt bytes.
type Item ¶
type Item struct {
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
Kind string `json:"kind"` // video | dvd-iso | dvd-folder | audio
Path string `json:"path"`
Title string `json:"title"`
SortTitle string `json:"sortTitle"`
Year *int `json:"year"`
Overview string `json:"overview"`
Tagline string `json:"tagline"`
Genres []string `json:"genres"`
Rating *float64 `json:"rating"`
ContentRating string `json:"contentRating"`
Studio string `json:"studio"`
RuntimeSec float64 `json:"runtimeSec"`
Poster string `json:"poster"` // cache-relative path or URL
Backdrop string `json:"backdrop"` // cache-relative path or URL
Container string `json:"container"`
VideoCodec string `json:"videoCodec"`
// AudioDirect: sound files a browser plays as they are. Reader: books, which
// reader opens it (epub, cbz or pdf), "" when none does. Both are worked out here,
// from the registry, so no client keeps a list of its own.
AudioDirect bool `json:"audioDirect,omitempty"`
Reader string `json:"reader,omitempty"`
Width int `json:"width"`
Height int `json:"height"`
AudioLangs []string `json:"audioLangs"`
SubLangs []string `json:"subLangs"`
Disc *DiscInfo `json:"disc,omitempty"`
Provider string `json:"provider"`
ProviderID string `json:"providerId"`
SizeBytes int64 `json:"sizeBytes"`
MTime int64 `json:"mtime"`
AddedAt int64 `json:"addedAt"`
UpdatedAt int64 `json:"updatedAt"`
Missing bool `json:"missing"`
// DiscSource: a video copied from a disc, "dvd" or "bluray", worked out from its name and
// type. Players give it that disc's remote, with no menus (docs/DVD.md, "The remote").
DiscSource string `json:"discSource,omitempty"`
// TV episodes (shows libraries):
ShowID *int64 `json:"showId,omitempty"`
ShowTitle string `json:"showTitle,omitempty"`
Season *int `json:"season,omitempty"`
Episode *int `json:"episode,omitempty"`
EpisodeEnd *int `json:"episodeEnd,omitempty"` // multi-episode files (S02E15-E16)
Aired string `json:"aired,omitempty"`
NextID *int64 `json:"nextId,omitempty"` // next episode, filled by the item endpoint
// Per-item viewer preferences (set from the item's settings, never by scans):
PlayMode string `json:"playMode"` // DVDs: menu | title | "" (server default)
InsertFX string `json:"insertFx"` // DVDs: on | off | "" (server default)
// StartMode and InsertEffect are what those settings come to with the
// server's defaults applied: menu | title, and whether the insert effect
// plays. Filled for discs by the item endpoints.
StartMode string `json:"startMode,omitempty"`
InsertEffect *bool `json:"insertEffect,omitempty"`
// Intro range for "Skip intro" (seconds); the item endpoint falls back to
// the show's range.
IntroStart *float64 `json:"introStart,omitempty"`
IntroEnd *float64 `json:"introEnd,omitempty"`
// Audio (music, audiobooks, podcasts), from the file's tags:
Artist string `json:"artist,omitempty"`
Album string `json:"album,omitempty"` // album, or the book for audiobooks
AlbumArtist string `json:"albumArtist,omitempty"` // or the author
Track *int `json:"track,omitempty"`
DiscNo *int `json:"discNo,omitempty"`
// Books: "" / ltr, rtl (manga) or webtoon (vertical strip). For books
// RuntimeSec is the length in pages (comics) or chapters (EPUB).
Reading string `json:"reading,omitempty"`
// Games: the console it runs on (the console facet, from the module that scans games).
Console string `json:"console,omitempty"`
// Its other names, for a profile that would rather see those than the title. Only when
// whoever described it knew one of them (a game's module).
Titles *ItemTitles `json:"titles,omitempty"`
// Internet radio: filled by the radio routes.
Radio *RadioMeta `json:"radio,omitempty"`
// CD images: a track of a disc says which disc it is (kind audio, in a music
// library). The disc itself is kind cd-image.
CDDisc *int64 `json:"cdDisc,omitempty"`
// Filled per user:
Progress *Progress `json:"progress,omitempty"`
// contains filtered or unexported fields
}
type ItemFacets ¶
type ItemFacets struct {
Genres []ItemFacet `json:"genres"`
Decades []ItemFacet `json:"decades"`
Rated int `json:"rated"` // items with a score
Letters []ItemFacet `json:"letters"` // first letters of the titles, in title order
}
ItemFacets are what a library's items can be filtered by, each with how many there are: the generic facets. A module that knows more about its items (players, series) counts those itself.
type ItemLink ¶
type ItemLink struct {
Link string `json:"link"`
ExtraType string `json:"extraType,omitempty"`
ParentItem *int64 `json:"parentItem,omitempty"`
ParentShow *int64 `json:"parentShow,omitempty"`
Label string `json:"label,omitempty"`
}
ItemLink says what an item is attached to.
type ItemQuery ¶
type ItemQuery struct {
LibraryID int64
Search string
Sort string // title | added | year | rating | runtime | newest | oldest
Desc bool
Limit int
Offset int
Genre string
Kind string // an item kind, or "disc" for every DVD and Blu-ray
// DiscContent: "movie" or "tv", discs holding films or TV episodes.
DiscContent string
ShowID int64
// NoEpisodes leaves TV episodes out (home hero, movie views).
NoEpisodes bool
// Access limits the result to what a Kids/Guest profile may see.
Access *Access
// IDs limits the result to these items.
IDs []int64
// NoTotal skips counting all matches, for callers that only want the list.
NoTotal bool
// Brief leaves a disc's list of titles and chapters out: only its own page
// reads them, and they can be most of what a list of discs weighs.
Brief bool
// Watchable: movies, videos and discs only (no music, books or podcasts).
Watchable bool
// NoGallery leaves out photo, vertical video and creator libraries, which
// are not what the home page's hero or Shuffle are for.
NoGallery bool
// Console: games for one console.
Console string
// PlayedBy: only what this user has played for more than a minute (games'
// Continue playing shelf, which must not depend on how far a list has loaded).
PlayedBy int64
// At least this score out of 10, released in this decade.
MinRating float64
Decade int
// HasArt: only items with a backdrop or a frame from the video, for the home
// page's hero, which would otherwise be an empty dark box.
HasArt bool
// Audio: one album (by album artist and album title).
Album *string
AlbumArtist *string
// IncludeAttached also lists extras and other versions, which appear only on
// their parent's page. Asking for particular IDs always gets them.
IncludeAttached bool
// Containers: only files of these formats (books: what one reader opens).
Containers []string
// Reading narrows to what UserID has started and not finished ("reading"), finished ("finished") or never
// opened ("unread"): a book's progress, as the bookshelf's tabs have it.
Reading string
UserID int64
}
ItemQuery filters and sorts items.
type ItemTitles ¶
type ItemTitles struct {
// Native is the name in its own script, such as Japanese.
Native string `json:"native,omitempty"`
// English is the English release's name.
English string `json:"english,omitempty"`
// Romanized is the title as it's listed: the name in Latin letters, the default.
Romanized string `json:"romanized,omitempty"`
}
ItemTitles are an item's names, each only when known.
type KindLimit ¶
type KindLimit struct {
MaxAge int `json:"maxAge"` // -1 = no limit
AllowUnrated bool `json:"allowUnrated"`
}
KindLimit is the age limit for one kind of media.
type Library ¶
type Library struct {
ID int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // movies | shows | anime | videos
Console string `json:"console,omitempty"` // games libraries: a console, or auto
Paths []string `json:"paths"`
CreatedAt int64 `json:"createdAt"`
LastScanAt *int64 `json:"lastScanAt"`
Scanning bool `json:"scanning"`
ItemCount int `json:"itemCount"`
// ShowMain: a commercials library also appears in the menus, Home and
// search. Off by default; channels can use it either way.
ShowMain bool `json:"showMain"`
// ReadOnly: nothing the server does may change this library's files.
ReadOnly bool `json:"readOnly"`
// ForeignNFO: .nfo files other programs wrote beside the media are read (they are on unless
// turned off; the server's own are read either way).
ForeignNFO bool `json:"foreignNfo"`
// ScanMode is how much the library's scan reads again (ScanChanges or ScanFull) while one
// runs or waits to carry on after a restart; "" otherwise. ScanSince is when it began.
ScanMode ScanMode `json:"scanMode,omitempty"`
ScanSince int64 `json:"-"`
}
type LibraryCollection ¶
type LibraryCollection struct {
ID int64 `json:"id"`
// Key: a series, made from metadata, rather than a collection someone made.
Key string `json:"key,omitempty"`
Name string `json:"name"`
Count int `json:"count"`
Art []CategoryArt `json:"art"`
}
LibraryCollections lists collections holding anything from a library, for a shelf.
type ListingPlatform ¶
type ListingPlatform struct {
Key string `json:"key"`
Name string `json:"name"`
Count int `json:"count"`
}
ListingPlatform is a service with what it lists from a library.
type ListingStatus ¶
type ListingStatus struct {
Enabled bool `json:"enabled"`
Region string `json:"region"`
// AsOf is when the oldest answer was fetched and Newest the latest; both are for showing a date.
AsOf int64 `json:"asOf"`
Newest int64 `json:"newest"`
HasKey bool `json:"hasKey"`
Titles int `json:"titles"`
Listed int `json:"listed"`
Running bool `json:"running"`
Done int `json:"done"`
Total int `json:"total"`
Source string `json:"source"`
Attribution string `json:"attribution"`
Acknowledgements []string `json:"acknowledgements"`
}
ListingStatus says how the feature is doing.
type Logo ¶
type Logo struct {
ID int64 `json:"id"`
Kind string `json:"kind"`
Name string `json:"name"`
Status string `json:"status"`
Has bool `json:"has"`
Version int `json:"version"`
// Opaque: the picture has a background of its own that couldn't be taken off,
// so all three variants are the same picture, to be shown on its own plate.
Opaque bool `json:"opaque"`
Source string `json:"source,omitempty"`
SourceURL string `json:"sourceUrl,omitempty"`
License string `json:"license,omitempty"`
LicenseURL string `json:"licenseUrl,omitempty"`
Credit string `json:"credit,omitempty"`
// contains filtered or unexported fields
}
Logo is one row of the service. Has says there's a picture to show; anything else is shown as Name.
type LogoCandidate ¶
type LogoCandidate struct {
Source string `json:"source"`
SourceID string `json:"sourceId"`
Name string `json:"name"`
Note string `json:"note,omitempty"`
ImageURL string `json:"imageUrl"`
PageURL string `json:"pageUrl"`
License string `json:"license"`
LicenseURL string `json:"licenseUrl,omitempty"`
Credit string `json:"credit,omitempty"`
Exact bool `json:"exact"`
}
LogoCandidate is a picture a source offers for something.
type LogoSource ¶
type LogoSource interface {
Find(ctx context.Context, kind, name string) ([]LogoCandidate, error)
Fetch(ctx context.Context, c LogoCandidate) ([]byte, error)
}
LogoSource finds logos online.
type Logos ¶
type Logos struct {
Tasks *tasks.Registry // where this shows in the activity panel; may be nil
Store *Store
Dir string // where the pictures are kept
// Source is where downloads come from. Nil means nowhere.
Source LogoSource
Log *slog.Logger
// Gap between lookups, so a first run over a big library asks gently.
Gap time.Duration
// contains filtered or unexported fields
}
Logos runs the service.
func (*Logos) Candidates ¶
Candidates lists what a source has for a logo, for someone choosing by hand.
func (*Logos) CopyFrom ¶
CopyFrom makes another downloaded logo of the same kind this one too, with its source, licence and credit, so the credits still say where it came from.
func (*Logos) Downloaded ¶
Downloaded lists the logos of one kind already downloaded here (not uploaded), to reuse for another name without asking a source again: a studio's logo for its other name, say.
func (*Logos) ForgetDownloaded ¶
ForgetDownloaded drops every logo that was downloaded, files and all, and says how many. Each is looked for again, as on a new server. A logo the owner uploaded is theirs, and stays, as does their choice of the name alone.
func (*Logos) ForgetDownloadedKind ¶
ForgetDownloadedKind is ForgetDownloaded for one kind of logo only ("" for every kind).
func (*Logos) Kick ¶
func (l *Logos) Kick()
Kick starts looking for what's pending, if the owner agreed. It returns at once.
func (*Logos) LookupLogos ¶
LookupLogos answers for many names at once, in the order asked. create says the asker may add names nobody has asked about yet. A name without a row still gets an answer, with no id and no picture.
func (*Logos) Pick ¶
Pick downloads a candidate and makes it this logo. The candidate comes from the browser, so only a fresh answer from the source is believed: a page must not be able to make the server fetch an address of its choosing, or claim a licence.
func (*Logos) SearchAllowed ¶
SearchAllowed says an administrator may search a source for a logo: under the agreement.
func (*Logos) SetLogoConsent ¶
SetLogoConsent records the owner's answer. Agreeing starts the downloads; declining stops them, and drops what was downloaded when asked to. A logo the owner uploaded is theirs, and stays.
func (*Logos) SetLogoStatus ¶
SetLogoStatus handles "use the name alone" and "look again".
type MatchCandidate ¶
type MatchCandidate struct {
Source string `json:"source"`
ID string `json:"id"`
Kind string `json:"kind"` // movie | show
Title string `json:"title"`
Year *int `json:"year,omitempty"`
Rating *float64 `json:"rating,omitempty"`
Overview string `json:"overview,omitempty"`
Poster string `json:"poster,omitempty"`
URL string `json:"url,omitempty"`
// Score is how likely this is the right one, from 0 to 100, and Reasons say why.
Score int `json:"score"`
Reasons []string `json:"reasons,omitempty"`
}
MatchCandidate is one search result.
type MatchDetails ¶
type MatchDetails struct {
Source, ID, Kind, URL string
Title string
Year *int
Overview string
Tagline string
Genres []string
Rating *float64
ContentRating string
Studios []string
Network string
Director string
Series string
Status string
RuntimeMin int
Poster, Backdrop, Banner, Logo string
Posters, Backdrops, Banners, Logos []string
SeasonPosters map[int]string
AirDays []string
AirTime string
// People: see SeriesMeta. A source that gives none leaves CreditsRead false.
Credits []CreditIn
CreditsRead bool
EpisodeCredits map[string][]CreditIn
}
MatchDetails is everything a source knows about one title.
type MatchPreview ¶
type MatchPreview struct {
Source string `json:"source"`
ID string `json:"id"`
Kind string `json:"kind"`
URL string `json:"url,omitempty"`
Label string `json:"sourceLabel"`
Title string `json:"title"`
Changes []FieldChange `json:"changes"`
Unchanged int `json:"unchanged"`
// Episodes: for a show, how many of its episodes the source knows.
Episodes *EpisodePreview `json:"episodes,omitempty"`
}
MatchPreview says what choosing a result would do.
type MatchRef ¶
type MatchRef struct {
Source, ID string
}
MatchRef is an exact reference someone typed: an id or an address.
func ParseMatchRef ¶
ParseMatchRef recognises a TMDB, IMDb, TheTVDB, TVmaze, AniList or Wikidata id or address.
type MatchRule ¶
type MatchRule struct {
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
Position int `json:"position"`
Pattern string `json:"pattern"`
Lookup string `json:"lookup"` // auto | none | a source
Tags []string `json:"tags"`
Extra string `json:"extra"` // "" or an extra type, to mark as a bonus feature
Enabled bool `json:"enabled"`
}
MatchRule is one rule of a library.
type MatchSource ¶
type MatchSource interface {
Name() string
Label() string
Search(ctx context.Context, query string, year *int) ([]MatchCandidate, error)
Details(ctx context.Context, id string) (*MatchDetails, error)
}
MatchSource is a service titles can be searched for on.
type MoveFromInfo ¶
MoveFromInfo: it was moved here, and from where.
type MoveInfo ¶
type MoveInfo struct {
Can bool `json:"can"`
Why string `json:"why,omitempty"`
Options []MoveOption `json:"options"`
Moved *MoveFromInfo `json:"moved,omitempty"`
}
MoveInfo says where a title can go, or why it can't.
type MoveOption ¶
MoveOption is a library a title can move to.
type MusicQuery ¶
type MusicQuery struct {
LibraryID int64
UserID int64
Artist string
Genre string
Search string
// View: "" every song, liked, played (most played), recent (played lately), added.
View string
// Sort: title | artist | album | year | added | runtime | random. A view has its own.
Sort string
Desc bool
Limit int
Offset int
}
MusicQuery asks for songs in a way a plain list of items can't: the order and the shelf depend on who is listening.
type Network ¶
type Network struct {
Name string `json:"name"`
Shows int `json:"shows"`
Genres []string `json:"genres"`
ShowIDs []int64 `json:"showIds"`
}
Network groups the shows of one TV network (the building block for channel-style playback).
type NowPlaying ¶
type NowPlaying struct {
Title string `json:"title"` // the whole line, as the station sent it
Artist string `json:"artist,omitempty"` // when the line reads "Artist - Track"
Track string `json:"track,omitempty"`
Since int64 `json:"since,omitempty"` // when this line first appeared
Live bool `json:"live"` // someone is listening through this server now
}
NowPlaying is what a station says it is playing.
func SplitNowPlaying ¶
func SplitNowPlaying(title string) NowPlaying
SplitNowPlaying fills in the artist and track from a line like "Artist - Track".
type Person ¶
type Person struct {
ID int64 `json:"id"`
Name string `json:"name"`
SortName string `json:"sortName"`
HasPhoto bool `json:"hasPhoto"`
Birthday string `json:"birthday,omitempty"`
Deathday string `json:"deathday,omitempty"`
Birthplace string `json:"birthplace,omitempty"`
Biography string `json:"biography,omitempty"`
KnownFor string `json:"knownFor,omitempty"` // a department key, or "acting"
IDs PersonIDs `json:"ids"`
// Photo is where the picture is: served through /api/people/{id}/photo, never sent.
Photo string `json:"-"`
DetailsAt int64 `json:"-"`
}
Person is someone credited on this server.
type PersonDetails ¶
type PersonDetails struct {
Photo, Birthday, Deathday, Birthplace, Biography, KnownFor string
IDs PersonIDs
}
PersonDetails is what an online source says about a person beyond their name.
type PersonIDs ¶
type PersonIDs struct {
TMDB string `json:"tmdb,omitempty"`
IMDB string `json:"imdb,omitempty"`
TVDB string `json:"tvdb,omitempty"`
TVMaze string `json:"tvmaze,omitempty"`
}
PersonIDs are a person's numbers at the online sources.
type Photo ¶
type Photo struct {
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
Kind string `json:"kind"` // photo | video
Title string `json:"title"`
TakenAt int64 `json:"takenAt"` // wall-clock seconds; show as UTC
Width int `json:"width"`
Height int `json:"height"`
DurationSec float64 `json:"durationSec,omitempty"`
Raw bool `json:"raw,omitempty"`
Motion bool `json:"motion,omitempty"`
HasLocation bool `json:"hasLocation,omitempty"`
Favorite bool `json:"favorite,omitempty"`
UpdatedAt int64 `json:"updatedAt"`
}
Photo is one picture or clip in a list. It says nothing about where it is on disk or where it was taken; PhotoDetail does, for one picture at a time.
type PhotoBounds ¶
type PhotoBounds struct {
South float64 `json:"south"`
West float64 `json:"west"`
North float64 `json:"north"`
East float64 `json:"east"`
Count int `json:"count"`
}
PhotoBounds is the smallest box holding every located picture a query finds, to fit the map to them. West is greater than East when the box is shorter the other way round the world, across the date line (Fiji and Samoa).
type PhotoCluster ¶
type PhotoCluster struct {
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
Count int `json:"count"`
Cover int64 `json:"coverId"`
South float64 `json:"south"`
West float64 `json:"west"`
North float64 `json:"north"`
East float64 `json:"east"`
From int64 `json:"from"` // when the first and the last were taken
To int64 `json:"to"`
}
PhotoCluster is a group of pictures close together on the map.
type PhotoDetail ¶
type PhotoDetail struct {
Photo
FileName string `json:"fileName"`
Folder string `json:"folder"`
Size int64 `json:"sizeBytes"`
Make string `json:"make,omitempty"`
Model string `json:"model,omitempty"`
Lens string `json:"lens,omitempty"`
FNumber float64 `json:"fNumber,omitempty"`
Exposure string `json:"exposure,omitempty"`
ISO int `json:"iso,omitempty"`
FocalMM float64 `json:"focalMm,omitempty"`
Lat *float64 `json:"lat,omitempty"`
Lon *float64 `json:"lon,omitempty"`
Alt *float64 `json:"alt,omitempty"`
WebSafe bool `json:"webSafe"` // the original can be shown as it is
}
PhotoDetail is everything known about one picture.
type PhotoEngine ¶
type PhotoEngine interface {
ReadFile(path string) (*PhotoInfo, error)
Dimensions(path string) (w, h int)
RawPreview(path string) ([]byte, error)
IsRaw(name string) bool
}
PhotoEngine reads what photos say about themselves, which WittyPhotos does (internal/modules). A library of photos still scans without it, with less to say.
type PhotoFolder ¶
type PhotoFolder struct {
Folder string `json:"folder"`
Count int `json:"count"`
Cover int64 `json:"coverId"`
}
PhotoFolder is one folder of a gallery, a read-only album of its own.
type PhotoInfo ¶
type PhotoInfo struct {
Taken time.Time // when the picture was taken, local to the camera unless HasOffset
HasOffset bool
Make string
Model string
Lens string
FNumber float64
Exposure string // "1/250" or "2.5"
ISO int
FocalMM float64
Orientation int // 1 to 8; 0 when not set
Width int // as stored, before Orientation
Height int
HasGPS bool
Lat float64
Lon float64
Alt float64
}
PhotoInfo is what WittyPhotos answers about a photo. It travels as JSON, so a field a newer version adds is simply not read here.
type PhotoMonth ¶
PhotoMonth is one month of a gallery, for the timeline and its scrubber.
type PhotoQuery ¶
type PhotoQuery struct {
LibraryID int64
UserID int64
Access *Access
YM int
// IDs, when not nil, keeps to these pictures: an album's (WittyPhotos keeps albums) or a
// share link's.
IDs []int64
Folder *string
Favorites bool
Kind string // photo | video
Search string
Camera string
BBox *[4]float64 // south, west, north, east; west > east crosses longitude 180
Limit int
Cursor string // from the previous page
}
PhotoQuery picks a slice of a gallery. Results run newest first and page by the cursor each page returns.
type PlayedGame ¶
PlayedGame is a game someone has played: its item, and when they last did.
type PlaylistSummary ¶
type PlaylistSummary struct {
Name string `json:"name"`
Count int `json:"count"`
CoverID int64 `json:"coverId"`
}
PlaylistSummary is one playlist on a creator's page.
type Podcast ¶
type Podcast struct {
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
URL string `json:"url"`
Title string `json:"title"`
Author string `json:"author"`
Image string `json:"image"`
Description string `json:"description"`
LastChecked int64 `json:"lastChecked"`
AutoDownload int `json:"autoDownload"` // newest N episodes kept on disk (0 = stream only)
}
Podcast is one subscription.
type Progress ¶
type Progress struct {
PositionSec float64 `json:"positionSec"`
DurationSec float64 `json:"durationSec"`
Watched bool `json:"watched"`
DiscTitle *int `json:"discTitle,omitempty"`
UpdatedAt int64 `json:"updatedAt"`
// ResumeSec is where to pick up again, 0 to start over: the rule for
// "Resume" that every client shares (see resumePoint).
ResumeSec float64 `json:"resumeSec"`
}
type QueueResult ¶
type QueueResult struct {
Rows []QueueRow `json:"rows"`
Total int `json:"total"`
Counts map[string]int `json:"counts"`
}
QueueResult is a page of the queue with the counts for its tabs.
type QueueRow ¶
type QueueRow struct {
Target string `json:"target"`
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
Title string `json:"title"`
Year *int `json:"year,omitempty"`
File string `json:"file"`
Kind string `json:"kind"`
Provider string `json:"provider"`
ProviderID string `json:"providerId"`
Label string `json:"sourceLabel"`
URL string `json:"url,omitempty"`
Poster string `json:"poster"`
UpdatedAt int64 `json:"updatedAt"`
Confidence int `json:"confidence"`
Reasons []string `json:"reasons"`
State string `json:"state"` // unmatched | low | ok | manual | none
Top []MatchCandidate `json:"suggestions,omitempty"`
}
QueueRow is one title in the review queue.
type RadioMeta ¶
type RadioMeta struct {
Source string `json:"source,omitempty"` // the directory it came from; "" when added by address
SourceID string `json:"sourceId,omitempty"` // its ID there
Homepage string `json:"homepage,omitempty"`
Country string `json:"country,omitempty"`
CountryCode string `json:"countryCode,omitempty"`
Language string `json:"language,omitempty"`
Codec string `json:"codec,omitempty"`
Bitrate int `json:"bitrate,omitempty"`
HLS bool `json:"hls"` // the stream is HLS: GET /radio/{id}/stream answers with a playlist
// Status: ok | trouble (recent failures, may recover) | dead | unknown (not tried yet).
Status string `json:"status"`
Reason string `json:"reason,omitempty"` // why it isn't ok, in plain words
LastOK int64 `json:"lastOk,omitempty"`
LastCheck int64 `json:"lastCheck,omitempty"`
Favorite bool `json:"favorite"`
LastPlayed int64 `json:"lastPlayed,omitempty"`
}
RadioMeta is a station's details. Favorite and LastPlayed belong to the account asking.
type RadioStation ¶
type RadioStation struct {
Name string `json:"name"`
URL string `json:"url"`
Genre string `json:"genre"`
}
RadioStation is a station to add.
func ParsePlaylist ¶
func ParsePlaylist(text string) []RadioStation
ParsePlaylist reads stations from an M3U or PLS playlist. The text may be hostile: entries are bounded and cleaned, and an HLS playlist isn't a list of stations (its addresses are pieces of one stream).
type Recommendation ¶
type Recommendation struct {
Item *Item `json:"item,omitempty"`
Show *Show `json:"show,omitempty"`
Reason string `json:"reason"`
}
Recommendation is a film or show for someone, and why.
type RemovedTitle ¶
type RemovedTitle struct {
Path string `json:"path"`
Title string `json:"title"`
Library int64 `json:"libraryId"`
At int64 `json:"at"`
}
RemovedTitle is something taken out of a library that scans leave out.
type ReviewEntry ¶
type ReviewEntry struct {
ID int64 `json:"id,omitempty"`
ShowID int64 `json:"showId,omitempty"`
Name string `json:"name"`
Sub string `json:"sub,omitempty"`
Seconds float64 `json:"seconds"`
Plays int `json:"plays,omitempty"`
}
ReviewEntry is one line of a top list.
type RuleResult ¶
type RuleResult struct {
Matched bool `json:"matched"`
Rule int64 `json:"rule,omitempty"`
Title string `json:"title,omitempty"`
Year *int `json:"year,omitempty"`
Edition []string `json:"edition,omitempty"`
Ref *MatchRef `json:"-"`
Source string `json:"source,omitempty"`
ID string `json:"id,omitempty"`
Lookup string `json:"lookup,omitempty"`
Tags []string `json:"tags,omitempty"`
Extra string `json:"extra,omitempty"`
}
RuleResult is what a rule says about a path.
type RuleTry ¶
type RuleTry struct {
File string `json:"file"`
Result RuleResult `json:"result"`
}
RuleTry is one file in a try of some rules.
type SavedView ¶
type SavedView struct {
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
Name string `json:"name"`
Query string `json:"query"` // a URL query
Pinned bool `json:"pinned"`
Position int `json:"position"`
}
SavedView is a browse someone kept.
type ScanMode ¶
type ScanMode string
ScanMode is how much a scan reads again.
func ParseScanMode ¶
ParseScanMode reads a scan mode; "" is ScanChanges.
type ScanModule ¶
type ScanModule struct {
ID string
Name string
// Version is the version in use, for whoever keeps what it said (scan.choices).
Version string
// On: installed and turned on. A module that isn't can't be asked, and the library's
// items are kept as they are until it is.
On bool
// Describe: it answers scan.describe.
Describe bool
// Facet is the facet a library of the kind can be held to ("console"), "" for none.
Facet string
}
ScanModule is the module that scans a kind of library.
type ScanModules ¶
type ScanModules interface {
// ScanModule is the module whose integration.json says it scans this kind of library, and
// whether there is one.
ScanModule(kind string) (ScanModule, bool)
// Call asks a module's service one of the scan calls (wittymodule.CallScan…). It ends when
// ctx does.
Call(ctx context.Context, module, call string, args, out any) error
}
ScanModules is how a scan reaches the modules that scan kinds of library. The server's module manager answers it; tests stand in for it.
type ScanProgress ¶
type ScanProgress struct {
LibraryID int64 `json:"libraryId"`
Phase string `json:"phase"`
Current string `json:"current"`
Found int `json:"found"`
Done int `json:"done"`
StartedAt int64 `json:"startedAt"`
// Mode is how much the scan reads again: changes, or full.
Mode ScanMode `json:"mode"`
// Resumed: a restart cut this scan short and it's carrying on.
Resumed bool `json:"resumed,omitempty"`
}
type ScanRun ¶
type ScanRun struct {
LibraryID int64 `json:"libraryId"`
Mode ScanMode `json:"mode"`
Since int64 `json:"since"` // when it began, Unix seconds
}
ScanRun is a scan written down and not finished: running, or cut short by a restart.
type Scanner ¶
type Scanner struct {
Store *Store
Tools *ffmpeg.Tools
CacheDir string
// ImagesDir holds downloaded and generated artwork; "cache:<name>"
// references are relative to it, so it can be moved.
ImagesDir string
TMDBKey func() string
// TVDBKey returns TheTVDB API key and optional subscriber PIN.
TVDBKey func() (key, pin string)
// TVMazeOn reports whether TVmaze may be used when there is no TheTVDB key.
TVMazeOn func() bool
// WikidataOn: Wikidata may fill in movies when there is no TMDB key.
WikidataOn func() bool
// MusicBrainzOn: audio CDs may be looked up by their table of contents.
MusicBrainzOn func() bool
// MusicBrainzBase and CoverArtBase replace the services' addresses in tests.
MusicBrainzBase, CoverArtBase string
// AnimeTitles: english | romaji | native titles for anime libraries.
AnimeTitles func() string
// Agents returns the custom metadata agents, in the order they run.
Agents func() []Agent
// Modules are the modules that scan kinds of library (scan hooks, module API 5): games are
// WittyPlay's. May be nil: then every library is scanned by the server's own walks.
Modules ScanModules
// TMDBBase replaces TMDB's address in tests.
TMDBBase string
// OnScanned runs after a scan of a library that holds films or shows.
OnScanned func()
// AfterScan is told when any library's scan has finished without trouble. It's called
// with the scan's turn at the disk given up, and must not hold things up.
AfterScan func(libraryID int64)
// SaveMeta reports whether to write NFO/artwork beside the media.
SaveMeta func() bool
// NoPoster says what a video with no poster of its own gets: NoPosterFrame (also when
// nil), NoPosterTitle or NoPosterNone.
NoPoster func() string
Log *slog.Logger
// Tasks is where scans show up in the activity panel. May be nil.
Tasks *tasks.Registry
// Progress for the UI.
Progress map[int64]*ScanProgress
// contains filtered or unexported fields
}
Scanner walks library paths and keeps items up to date.
func NewScanner ¶
func (*Scanner) ApplyAgents ¶
ApplyAgents runs the custom agents for an item (its "Refresh" button).
func (*Scanner) ApplyCDMatch ¶
func (s *Scanner) ApplyCDMatch(ctx context.Context, lib *Library, it *Item, d *wittycd.Disc, m *CDMatch) error
ApplyCDMatch puts a release's names and cover on a disc and its tracks.
func (*Scanner) ApplyItemFields ¶
func (s *Scanner) ApplyItemFields(ctx context.Context, module string, f wittymodule.ItemFields) error
ApplyItemFields sets an item's generic fields from what a module knows about it (scan.describe, or host PATCH /items/{id}). A field left empty stays as it is, Clear empties the fields it names, and a field a person typed (ItemEdits) is never changed. Whether the module may set this item's fields at all is the caller's to check.
func (*Scanner) ApplyMatch ¶
func (s *Scanner) ApplyMatch(ctx context.Context, t *Title, source, id string, only map[string]bool, user string) (string, error)
ApplyMatch changes a title to a result, and remembers that a person chose it, so no scan or refresh changes it to anything else. It returns the batch that undoes it.
func (*Scanner) ArtworkFor ¶
ArtworkFor asks the title's match, then whatever else is on, for pictures of it. The answer can't be limited to one service: the point is to see all of them.
func (*Scanner) BookEPUB ¶
BookEPUB returns the EPUB a book reads as: itself for an EPUB, otherwise one made once from the book, kept in the cache and named after the book's identity.
func (*Scanner) CDCoverPreview ¶
CDCoverPreview fetches a release's cover small, for the choosing dialog, so the browser doesn't have to ask another site for it.
func (*Scanner) ComicPageFile ¶
func (s *Scanner) ComicPageFile(ctx context.Context, p string, pages []string, n int) (string, error)
ComicPageFile puts a page of a RAR, 7-Zip or TAR comic in the cache and returns its file. A few pages after it come out too.
func (*Scanner) ComicPageImage ¶
func (s *Scanner) ComicPageImage(ctx context.Context, archive, name string, read func() (io.ReadCloser, error)) (string, error)
ComicPageImage makes sure a page can be shown: pictures a browser can't show become a JPEG, cached beside the unpacked pages.
func (*Scanner) ComicPageList ¶
ComicPageList lists a comic's pages, by reading its archive's directory.
func (*Scanner) DescribeItems ¶
func (s *Scanner) DescribeItems(ctx context.Context, libraryID int64, ids []int64, refresh bool) error
DescribeItems asks the module that scans the items' library about them again (Refresh: an administrator asked), or for the first time (a game added to a held library). Nothing happens without a module that describes that kind of library.
func (*Scanner) DescribesKind ¶
func (s *Scanner) DescribesKind(kind string) (ScanModule, bool)
DescribesKind says whether items of a library of this kind are described by a module, and which: the item editor's Refresh asks it.
func (*Scanner) DjvuPageFile ¶
DjvuPageFile draws one page, once, as a JPEG in the cache. It has a time limit, so a hostile file costs a moment; ddjvu is a separate program, so a crash costs nothing.
func (*Scanner) Download ¶
Download saves an episode into the library's first folder: <folder>/<podcast>/<date> <title>.<ext>, and the item then plays from disk.
func (*Scanner) EpisodeMap ¶
EpisodeMap lists a show's files with what its source calls each number.
func (*Scanner) FileReplaced ¶
FileReplaced records that an item's file is now the one at path, after a conversion. Only what the file itself says changes. The item keeps its id, so everything anyone has done with it stays: what's been watched and how far, ratings, its match and every edit. And because the size and time are up to date, the next scan sees nothing new.
func (*Scanner) FillNetworkFacts ¶
FillNetworkFacts starts the fill in the background, unless one is running.
func (*Scanner) ForgetCDMatch ¶
ForgetCDMatch goes back to what the disc says about itself.
func (*Scanner) Frame ¶
Frame is a picture from about a fifth of the way into a video or a disc's main feature, kept in the image cache: the frame a title's poster is made from when nothing else has one, large enough to be a backdrop.
func (*Scanner) HoldScans ¶
HoldScans keeps any library from being scanned until release is called, once it has waited for one that's going to reach a stopping point. For work that needs the files and the database to hold still, such as a backup. Scans asked for meanwhile wait their turn, shown as queued.
func (*Scanner) IndexUploaded ¶
IndexUploaded saves one file that was just added to a library, without a scan.
func (*Scanner) KickListings ¶
func (s *Scanner) KickListings()
KickListings checks whatever hasn't been checked lately, in the background and gently. It does nothing if the owner hasn't turned listings on.
func (*Scanner) ListingStatus ¶
func (s *Scanner) ListingStatus(ctx context.Context) ListingStatus
Status reads the state of the feature.
func (*Scanner) LoadImage ¶
LoadImage reads an artwork reference: a URL, a "cache:" name or a path. References can come from sidecar files anyone with access to a media folder wrote, and what is read here gets saved beside the media, so it only ever reads pictures: from the internet, the artwork cache or a library folder.
func (*Scanner) LookUpPerson ¶
LookUpPerson fills in a person from TMDB when they have an id there, a key is set, and nobody asked in the last month. It reports whether it asked.
func (*Scanner) MIDIAudio ¶
MIDIAudio makes the sound of a MIDI file, once, and keeps it as FLAC in the cache: a browser plays that as it is, and can seek in it.
func (*Scanner) MakeTitlePoster ¶
func (s *Scanner) MakeTitlePoster(p TitlePoster) (string, error)
MakeTitlePoster draws a title poster into the image cache and returns its address. The same words and look always give the same file.
func (*Scanner) MatchQueue ¶
func (s *Scanner) MatchQueue(ctx context.Context, libraryID int64, state, search string, limit, offset int) (*QueueResult, error)
MatchQueue lists the titles of a library (0 = all), worst first. Everything it says is worked out from what's stored, so opening it asks nobody anything. state is review (unmatched and low), unmatched, low, ok, manual, none or all.
func (*Scanner) ModuleReport ¶
ModuleReport is a module saying how far a scan call it's answering has got (the host API's task "scan-<library>"). It counts as the scan moving, and the scan's task shows it. False when that module isn't scanning that library now.
func (*Scanner) Persist ¶
Persist writes a title's metadata beside its files, if the owner wants that.
func (*Scanner) PosterThumb ¶
PosterThumb returns a smaller copy of a picture in the image cache, src a "cache:" reference, as a "cache:" reference, or src when it can't or needn't be made smaller. A picture beside the media goes to SmallCopyOf, opened inside its library.
func (*Scanner) PreviewMatch ¶
func (s *Scanner) PreviewMatch(ctx context.Context, t *Title, source, id string) (*MatchPreview, error)
PreviewMatch says what choosing this would change, without changing anything.
func (*Scanner) PreviewRefresh ¶
PreviewRefresh says what looking a title up again would change.
func (*Scanner) RecheckListings ¶
func (s *Scanner) RecheckListings()
RecheckListings checks everything again now, however lately it was checked, and forgets the kept where-to-watch answers so that they're asked for again too.
func (*Scanner) RefreshPodcast ¶
RefreshPodcast reloads one feed.
func (*Scanner) RefreshPodcasts ¶
RefreshPodcasts reloads every feed (run periodically).
func (*Scanner) RefreshRadio ¶
RefreshRadio is the quiet background work, run a few times a day: details from the directory (unless turned off), and checks on stations if the owner turned those on.
func (*Scanner) RefreshShow ¶
RefreshShow re-reads a show from its metadata service (optionally with a series id of that service) and re-applies episode data to its episodes.
func (*Scanner) RefreshTitle ¶
func (s *Scanner) RefreshTitle(ctx context.Context, t *Title, only map[string]bool, user string) (string, error)
RefreshTitle looks a title up again, keeping its match and everything locked.
func (*Scanner) RemapEpisodes ¶
func (s *Scanner) RemapEpisodes(ctx context.Context, showID int64, list []EpisodeNumber, user string) (string, error)
RemapEpisodes renumbers a show's files, locks the numbers so a scan keeps them, and fills each from what its source says that number is. Only files of this show can be touched.
func (*Scanner) RemoveMatch ¶
RemoveMatch takes a title's match away. What came from a service goes, what a person typed and what's beside the file stay, and a title that came from a service is named after its file again. Nothing is looked up for it until someone chooses a match.
func (*Scanner) ResumeScans ¶
ResumeScans starts again the scans a restart cut short, each as it was asked for.
func (*Scanner) RunOf ¶
RunOf is how a library's scan is going now, if one runs or waits to carry on after a restart: its mode and when it began.
func (*Scanner) SaveItemMetadata ¶
SaveItemMetadata writes the item's NFO and artwork beside it. Artwork is copied to the standard names and the item is pointed at the local files, so other servers (and a rescan) see the same pictures.
func (*Scanner) SaveShowMetadata ¶
SaveShowMetadata writes tvshow.nfo and show/season artwork into the show folder.
func (*Scanner) SearchMatches ¶
func (s *Scanner) SearchMatches(ctx context.Context, t *Title, query string, year *int) (*SearchResult, error)
SearchMatches searches every source for a title, or finds the exact thing if the query is an id or an address. An empty query uses the file's name. Sources are asked at the same time and each has its own time limit, so one being slow only costs its own answers.
func (*Scanner) SetListings ¶
SetListings turns the feature on or off. Turning it off drops all its data.
func (*Scanner) SmallCopyOf ¶
SmallCopyOf is PosterThumb for a picture already open, which is what's read. A picture beside the media is opened by Store.OpenLibraryFile, which checks it's inside a library in one open, where checking it by name again looks at every folder on the way (37 looks for each poster on the WSL test machine's media drive). src names it, for the copy's name.
func (*Scanner) Snapshot ¶
func (s *Scanner) Snapshot(id int64) *ScanProgress
Snapshot returns a copy of the progress for a library, or nil when idle.
func (*Scanner) Start ¶
Start scans a library for changes in the background (no-op if already scanning).
func (*Scanner) StartBy ¶
StartBy starts a scan of a library, reading again only what changed or, with ScanFull, everything, saying who asked. It has no time limit: it runs until it's done, a person stops it, or nothing moves for StuckAfter. A scan that was stopped, or that a restart cut short, picks up where it left off: files it has already seen, unchanged, take almost no time, and a Full rescan doesn't read again what it has read already.
func (*Scanner) StartSuggesting ¶
StartSuggesting finds suggestions for everything in a library that needs a look and doesn't have any yet, one title at a time. It returns false if it's already running.
func (*Scanner) Stopping ¶
func (s *Scanner) Stopping()
Stopping says the server is stopping: a scan that fails from now on (its module's service going away under it) is carried on at the next start rather than forgotten.
func (*Scanner) Suggest ¶
Suggest searches for a title and keeps the best results, so its row in the queue can offer them without asking again.
func (*Scanner) TMDBClient ¶
TMDBClient is a TMDB client with the scanner's key, or nil without one.
type SearchHit ¶
type SearchHit struct {
Chapter int `json:"chapter"`
Snippet string `json:"snippet"`
Quote string `json:"quote"` // the matched text as written in the book
Prefix string `json:"prefix"`
}
SearchHit is one match of a search in a book.
type SearchResult ¶
type SearchResult struct {
Results []MatchCandidate `json:"results"`
// Warnings: sources that couldn't answer, so an empty list isn't taken for "nothing exists".
Warnings []string `json:"warnings"`
// Sources: who was asked, for saying so.
Sources []string `json:"sources"`
Exact bool `json:"exact"`
}
SearchResult is the answer to a search.
type Season ¶
type Season struct {
Number int `json:"number"`
Title string `json:"title"`
Overview string `json:"overview"`
Poster string `json:"poster"`
EpisodeCount int `json:"episodeCount"`
Unwatched int `json:"unwatched"`
}
Season is per-season artwork and counts.
type SeriesLister ¶
type SeriesLister interface {
Episodes(ctx context.Context, id string) (map[[2]int]EpisodeMeta, error)
}
SeriesLister is a source that also knows a show's episodes.
type SeriesMeta ¶
type SeriesMeta struct {
ID string
Title string
Year *int
Overview string
Genres []string
Rating *float64
ContentRating string
Network string
Status string
Poster string
Backdrop string
SeasonPosters map[int]string
// The slot it aired in, where the service knows: weekday names and HH:MM.
AirDays []string
AirTime string
// All posters/backgrounds, best first (for the artwork picker).
Posters []string
Backdrops []string
// Wide banners and the title as a picture, where the service has them.
Banners, Logos []string
// The show's people, when the service was asked for them (CreditsRead), and the guest
// stars and crew of its episodes by the service's episode id, when it names them with
// the show (nil when it doesn't; an episode it names nobody in is simply not there).
Credits []CreditIn
CreditsRead bool
EpisodeCredits map[string][]CreditIn
}
SeriesMeta is the show-level metadata WittyMediaServer uses.
type SeriesSource ¶
type SeriesSource interface {
Name() string // stored as the show's provider: "tvdb", "tvmaze"
Series(ctx context.Context, id string) (*SeriesMeta, error)
FindSeries(ctx context.Context, name string, year *int) (*SeriesMeta, error)
Episodes(ctx context.Context, id string) (map[[2]int]EpisodeMeta, error)
}
SeriesSource is an online TV metadata service.
func TVSource ¶
func TVSource(tvdbKey, tvdbPin string, tvmazeOn bool) SeriesSource
TVSource picks the TV metadata service: TheTVDB when a key is set, otherwise TVmaze (no key needed) unless it was switched off.
type ShareLink ¶
type ShareLink struct {
// Items are the pictures of a set (kind photos), kept with the link when it's made.
}
ShareLink lets someone without an account see one item or album. Only a hash of the link's secret is stored, so the link itself is shown once, when made.
type Show ¶
type Show struct {
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
Path string `json:"path"`
Title string `json:"title"`
SortTitle string `json:"sortTitle"`
Year *int `json:"year"`
Overview string `json:"overview"`
Genres []string `json:"genres"`
Rating *float64 `json:"rating"`
ContentRating string `json:"contentRating"`
Network string `json:"network"`
Status string `json:"status"`
Poster string `json:"poster"`
Backdrop string `json:"backdrop"`
Provider string `json:"provider"`
ProviderID string `json:"providerId"`
AddedAt int64 `json:"addedAt"`
UpdatedAt int64 `json:"updatedAt"`
// Show-wide intro range used by "Skip intro" when an episode has no
// intro chapter of its own.
IntroStart *float64 `json:"introStart,omitempty"`
IntroEnd *float64 `json:"introEnd,omitempty"`
// View is this show's episode layout: cards | list | "" (server default).
View string `json:"view"`
// Aggregates (per user for Unwatched):
EpisodeCount int `json:"episodeCount"`
SeasonCount int `json:"seasonCount"`
Unwatched int `json:"unwatched"`
LastAddedAt int64 `json:"lastAddedAt"`
// contains filtered or unexported fields
}
Show is a TV series in a shows library. Its episodes are items.
type ShowQuery ¶
type ShowQuery struct {
// InCollection: only the shows in this collection.
InCollection int64
LibraryID int64
Search string
Genre string
Network string // exact network name (case-insensitive)
Sort string // title | added | year | rating
Desc bool
Limit int
UserID int64
Access *Access // Kids/Guest limits
// AnimeOf lists anime library LibraryID together with the anime shows
// (genre "Anime") of every TV library.
AnimeOf bool
// HideAnime leaves anime out (TV libraries when anime goes to the anime
// library only).
HideAnime bool
// Started: only shows with an episode UserID has watched.
Started bool
// IDs limits the result to these shows.
IDs []int64
}
ShowQuery filters shows.
type StationFacts ¶
StationFacts is what a station says about itself in its answer.
func FactsOf ¶
func FactsOf(st *StationStream) StationFacts
FactsOf reads an opened station's headers. They are the station's own words, so they only fill gaps and are cleaned like anything else from outside.
func ProbeStation ¶
func ProbeStation(ctx context.Context, raw string) (StationFacts, error)
ProbeStation opens a station and waits for some sound, then hangs up.
type StationStream ¶
type StationStream struct {
URL *url.URL // where it ended up, after playlists and redirects
ContentType string // "" for HLS
MetaInt int // bytes of audio between ICY metadata blocks; 0 for none
Header http.Header
HLS []byte // the playlist, for HLS stations
Body io.Reader
// contains filtered or unexported fields
}
StationStream is an opened station: audio to relay, or an HLS playlist.
func OpenStation ¶
func OpenStation(ctx context.Context, raw string) (*StationStream, error)
OpenStation connects to a station, unwrapping .pls and .m3u playlists. It waits a limited time for the station to answer; ctx ends the stream afterwards.
func (*StationStream) Close ¶
func (st *StationStream) Close()
Close ends the connection to the station.
type Store ¶
func (*Store) AddComment ¶
func (s *Store) AddComment(ctx context.Context, userID, itemID int64, parentID *int64, body string) (*Comment, error)
AddComment saves a comment by an account. A reply must answer a comment on the same item.
func (*Store) AddFromDirectory ¶
AddFromDirectory adds a station by its directory ID. The details are read from the directory here, never taken from the client.
func (*Store) AddListening ¶
AddListening adds time to a station's record without counting another play.
func (*Store) AddRadioStation ¶
func (s *Store) AddRadioStation(ctx context.Context, libraryID int64, st RadioStation) (*Item, error)
AddRadioStation saves a station. Adding the same address again renames it, and what is already known about it stays.
func (*Store) AddToCollection ¶
AddToCollection adds items (and shows) that the account may see, checked by the caller.
func (*Store) Albums ¶
func (s *Store) Albums(ctx context.Context, libraryID int64, artist, search, sort string, access *Access) ([]Album, error)
Albums lists a library's albums (an audiobook library's books, a books library's series). sort: title | artist | year | added.
func (*Store) AlbumsFiltered ¶
func (s *Store) AlbumsFiltered(ctx context.Context, libraryID int64, f AlbumFilter, access *Access) ([]Album, error)
AlbumsFiltered is Albums with the rest of what a library's page can ask for.
func (*Store) Annotations ¶
Annotations lists one account's annotations in a book, in reading order.
func (*Store) ApplyMetadataFolder ¶
func (s *Store) ApplyMetadataFolder(ctx context.Context, dir string, o FolderApply) (*FolderResult, error)
ApplyMetadataFolder does what the preview said: each changed file through the same code as the edit dialog, in one batch that can be undone as a whole. A bad file is listed and left out, and the rest go ahead.
func (*Store) ApplyStationFacts ¶
func (s *Store) ApplyStationFacts(ctx context.Context, it *Item, f StationFacts)
ApplyStationFacts fills what a station says about itself into the gaps of what is known. It never overwrites, and writes only when something is new.
func (*Store) ArchiveEPUB ¶
ArchiveEPUB is ReadEPUB and WordCounts for a cached archive.
func (*Store) ArchiveEPUBOf ¶
ArchiveEPUBOf is ArchiveEPUB for what the reader reads for a book, as OpenBook.
func (*Store) ArchivePages ¶
ArchivePages is ComicPages for a cached archive.
func (*Store) Artists ¶
Artists lists the album artists of a library, or the authors of an audiobook or books library.
func (*Store) AttachItem ¶
func (s *Store) AttachItem(ctx context.Context, id int64, link, extraType, label string, parentItem, parentShow *int64) error
AttachItem makes an item an extra or a version of a film or show. A title can't attach to itself, or to something that's attached itself: there's one level.
func (*Store) AttachProgress ¶
func (*Store) AttachRadio ¶
AttachRadio fills in the details of a library's stations for one account.
func (*Store) AttachedTo ¶
func (s *Store) AttachedTo(ctx context.Context, target string, id int64, link string) ([]*Item, []ItemLink, error)
AttachedTo lists what's attached to a film or a show.
func (*Store) BackfillAges ¶
BackfillAges fills min_age for items and shows saved before parental controls existed. It runs once; later saves keep the column current.
func (*Store) BookGroups ¶
func (s *Store) BookGroups(ctx context.Context, libraryID int64, by string, access *Access) ([]BookGroup, error)
BookGroups lists a books library's series (by "series") or authors (by "author"), by name, with the books that have none last. Books the account may not see aren't counted, and a group of only those isn't there.
func (*Store) Brands ¶
func (s *Store) Brands(ctx context.Context, libraryID int64, kind string, access *Access) ([]Brand, error)
Brands lists the studios or networks in a library (0 = all), most titles first, counting only what this viewer may see.
func (*Store) Browse ¶
func (s *Store) Browse(ctx context.Context, f BrowseFilter, userID int64, access *Access) (*BrowseResult, error)
Browse runs a filter.
func (*Store) ByTMDB ¶
ByTMDB finds the titles here matched with a TMDB id: films (and discs) for movie, shows for tv. Missing ones are left out. Who may see them is for the caller to check.
func (*Store) CDTrackItems ¶
CDTrackItems maps a disc's track numbers to their items.
func (*Store) Categories ¶
func (s *Store) Categories(ctx context.Context, libraryID int64, access *Access, includeHidden bool) ([]Category, error)
Categories works out a library's categories from its genres. includeHidden is for someone arranging them.
func (*Store) ChangeCategories ¶
func (s *Store) ChangeCategories(ctx context.Context, libraryID int64, changes []CategoryChange, order []string) error
ChangeCategories applies edits and an order. A new order lists keys, first to last.
func (*Store) CheckStation ¶
CheckStation tries a station now and records the result. A failure on this end (the request was cancelled) says nothing about the station, and isn't recorded.
func (*Store) CheckStations ¶
CheckStations tries the stations given, one at a time with a pause between them. If nothing answers, the trouble is probably this server's own connection, so none of them are marked. It answers false if a round is already running.
func (*Store) ChooseDiscMain ¶
ChooseDiscMain remembers ttn as the disc's film, chosen by an account, or forgets the choice when ttn is negative. The item's own length and languages follow. It refuses a title the disc doesn't have.
func (*Store) ClearProgress ¶
func (*Store) ClearWatchCache ¶
ClearWatchCache forgets every kept answer, as checking the listings again does.
func (*Store) ClearWatchHistory ¶
ClearWatchHistory forgets what an account watched: its numbers, its daily record and its likes stay apart from the media itself.
func (*Store) CollectionByID ¶
func (s *Store) CollectionByID(ctx context.Context, id, userID int64, isAdmin bool) (*Collection, error)
CollectionByID loads a collection an account may see.
func (*Store) CollectionItems ¶
func (s *Store) CollectionItems(ctx context.Context, c *Collection, userID int64, access *Access, limit, offset int) ([]*Item, []*Show, error)
CollectionItems is one page of what a collection holds, for an account.
func (*Store) Collections ¶
func (s *Store) Collections(ctx context.Context, userID int64, access *Access) ([]*Collection, error)
Collections lists what an account can see: its own and those shared with everyone.
func (*Store) CollectionsHolding ¶
func (s *Store) CollectionsHolding(ctx context.Context, userID, itemID, showID int64) ([]int64, error)
CollectionsHolding lists which of an account's lists hold an item or show.
func (*Store) CollectionsInLibrary ¶
func (s *Store) CollectionsInLibrary(ctx context.Context, libraryID, userID int64, access *Access) ([]LibraryCollection, error)
CollectionsInLibrary lists a viewer's collections with members in this library.
func (*Store) CommentOwner ¶
CommentOwner says who wrote a comment (0 for an imported one) and on what.
func (*Store) Comments ¶
func (s *Store) Comments(ctx context.Context, itemID int64, limit, offset int) ([]Comment, int, error)
Comments lists an item's comments: those of accounts on this server first, then those that came with the archive by their likes.
func (*Store) CommonsArtwork ¶
CommonsArtwork lists the titles an account may see whose poster or backdrop comes from Commons.
func (*Store) ContinueWatching ¶
ContinueWatching lists in-progress items for a user.
func (*Store) ConversionItems ¶
ConversionItems lists what's in a library, in the order it would be worked through.
func (*Store) ConversionItemsSince ¶
func (s *Store) ConversionItemsSince(ctx context.Context, libraryID, since int64) ([]ConversionItem, error)
ConversionItemsSince lists the video files of a library that are new or have changed since a time. A row changes for other reasons too (someone edits its details), so this is who to look at, and doesn't say that anything needs doing.
func (*Store) CountShareView ¶
CountShareView adds one to a link's opens.
func (*Store) CreateLibrary ¶
func (*Store) CreateRigLibrary ¶
CreateRigLibrary makes the library that holds a rig's games.
func (*Store) CreateShare ¶
CreateShare makes a link and returns it with its secret.
func (*Store) CreatorArt ¶
CreatorArt is the path of a creator's avatar or banner.
func (*Store) CreatorPlaylists ¶
func (s *Store) CreatorPlaylists(ctx context.Context, creatorID int64, access *Access) ([]PlaylistSummary, error)
CreatorPlaylists lists a creator's playlists (from folders and sidecars).
func (*Store) CreditsRead ¶
CreditsRead says whether a source's credits were read for a title since credits existed.
func (*Store) DeleteAnnotation ¶
DeleteAnnotation removes one of the account's annotations.
func (*Store) DeleteCollection ¶
DeleteCollection removes a collection; what is in it stays.
func (*Store) DeleteComment ¶
DeleteComment removes a comment and its replies.
func (*Store) DeleteShare ¶
DeleteShare ends a link.
func (*Store) DeleteView ¶
DeleteView removes a view of this account's.
func (*Store) DetachItem ¶
DetachItem makes an attached item a title of its own again (a split).
func (*Store) EditComment ¶
EditComment replaces a comment's text.
func (*Store) EnsureLogo ¶
EnsureLogo makes sure a name has a row, so the service looks for it. This is what other parts of the server call when they find a studio or a network. It does nothing for an empty or unknown name, and contacts nobody by itself.
func (*Store) EpisodePoster ¶
EpisodePoster is the artwork of a show's first episode that has any.
func (*Store) ExportMetadata ¶
func (s *Store) ExportMetadata(ctx context.Context, dir string, libraryID int64, progress func(done, total int)) (*ExportResult, error)
ExportMetadata writes the folder: every title of one library, or all of them with libraryID 0. A file is only written if it would be different, and never over edits that haven't been applied. Nothing is ever deleted.
func (*Store) FacetCounts ¶
func (s *Store) FacetCounts(ctx context.Context, libraryID int64, access *Access) (map[string]int, error)
FacetCounts says how many items a library holds for each value of the console facet (a games library's consoles).
func (*Store) Filmography ¶
func (s *Store) Filmography(ctx context.Context, personID int64, access *Access) (*Filmography, error)
Filmography lists a person's titles that the account may see. Each title is named once per part, newest first.
func (*Store) ForgetDetails ¶
func (s *Store) ForgetDetails(ctx context.Context, lib *Library, opt ForgetOptions, res *ForgetResult) error
ForgetDetails resets a library's films, episodes and shows to what a new scan of their files starts from, keeping every ID and whatever a person locked or typed. The next scan reads each file again (its size and time are forgotten too) and looks it up afresh. Pictures from the internet that nothing uses any more leave the artwork cache.
func (*Store) ForgetEverywhereExtras ¶
ForgetEverywhereExtras is what forgetting every library's details adds: where-to-watch answers kept by TMDB id, and the logo service's verdicts that nothing was found (looked for again). Downloaded logos themselves are the Logos service's to drop.
func (*Store) ForgetFiles ¶
func (s *Store) ForgetFiles(ctx context.Context, lib *Library, opt ForgetOptions, res *ForgetResult) error
ForgetFiles removes what the server saved into a library's folders. The library's read-only switch doesn't stop it: these are the server's own files.
func (*Store) InLibraries ¶
InLibraries reports whether a path is inside a library folder, by its name alone. It touches nothing, so a path from an untrusted file can be checked without the machine contacting the server a network path names.
func (*Store) InProgress ¶
func (s *Store) InProgress(ctx context.Context, libraryID, userID int64, limit int, access *Access) ([]*Item, error)
InProgress is what someone has started and not finished in a library of books or podcasts, newest first.
func (*Store) InWatchLater ¶
InWatchLater says whether a title (an item, or a show) is on an account's Watch later list, without making the list.
func (*Store) ItemCredits ¶
ItemCredits are a film's credits, or an episode's: its show's regular cast, its own guest stars, and its own crew where it names a department (else the show's).
func (*Store) ItemEdits ¶
ItemEdits are the fields of an item a person typed in the item editor (wittymodule ItemFieldNames' names): nothing that describes the item changes them again.
func (*Store) ItemFiles ¶
ItemFiles are an item's files in order: what a scan by a module kept (a game's discs), or its one path.
func (*Store) ItemsInOrder ¶
ItemsInOrder reads these items, brief, in the order given, leaving out any the account may not see.
func (*Store) LibraryFacets ¶
func (s *Store) LibraryFacets(ctx context.Context, libraryID int64, access *Access) (*Facets, error)
LibraryFacets reads what's in a library (0 = all), counting only what this viewer may see.
func (*Store) LibraryFile ¶
LibraryFile reports whether path is a file inside a library folder once links are followed.
func (*Store) LibraryItemFacets ¶
func (s *Store) LibraryItemFacets(ctx context.Context, libraryID int64, console string, access *Access) (*ItemFacets, error)
LibraryItemFacets counts what's in a library, as far as this account can see: its items as lists show them (not other versions of one). One console narrows it.
func (*Store) LibraryRoots ¶
LibraryRoots lists every library's folders (what artwork paths are checked against, for each picture a page shows).
func (*Store) LikedItems ¶
func (s *Store) LikedItems(ctx context.Context, userID, libraryID int64, kinds []string, offset, limit int, access *Access) ([]*Item, error)
LikedItems are the items an account liked, most recently liked first, a page at a time: those it may still see and that are still on disk, in one library or (0) any. kinds narrows them to these item kinds; nil is every kind.
func (*Store) LikedTracks ¶
func (s *Store) LikedTracks(ctx context.Context, userID, libraryID int64, access *Access) ([]int64, error)
LikedTracks is the ids of the songs someone has liked in a library, or in all of them with libraryID 0, so a heart can be drawn without asking for each song.
func (*Store) ListLogos ¶
func (s *Store) ListLogos(ctx context.Context, kind, query string, limit, offset int) ([]Logo, int, error)
ListLogos is a page of the names the service knows, for an administrator to find one.
func (*Store) ListingPlatforms ¶
func (s *Store) ListingPlatforms(ctx context.Context, libraryID int64, access *Access) ([]ListingPlatform, error)
ListingPlatforms lists the services with titles here, most first, counting only what this viewer may see.
func (*Store) ListingTMDB ¶
ListingTMDB says which TMDB title the listings matched a local title with, if any.
func (*Store) ListingsEnabled ¶
ListingsEnabled reports whether the owner has turned it on.
func (*Store) ListingsRegion ¶
ListingsRegion is the country listings are for.
func (*Store) LogoConsent ¶
LogoConsent says what the owner decided: "yes", "no" or "" (not asked yet).
func (*Store) LogoCounts ¶
LogoCounts says how far the service has got.
func (*Store) LogoCredits ¶
LogoCredits lists where every downloaded logo came from: its source, licence and author, which is what the licences of those files ask for.
func (*Store) LookUpRadio ¶
LookUpRadio finds a station added by address in the directory, on an administrator's request, and fills in what it knows. The address is sent only when it can't be someone's private one: a query string or sign-in in it may be a key.
func (*Store) MarkPersonLookedUp ¶
MarkPersonLookedUp records that a source was asked about a person, found or not, so it isn't asked again on every visit.
func (*Store) Markers ¶
func (s *Store) Markers(ctx context.Context, id int64) StoredMarkers
Markers reads an item's kept markers.
func (*Store) MatchRules ¶
MatchRules lists a library's rules, in order.
func (*Store) MostWatched ¶
func (s *Store) MostWatched(ctx context.Context, q WatchQuery, access *Access) ([]WatchTotal, error)
MostWatched adds up the play log as q asks, most time first. Only titles the account may see count, titles no longer on disk aren't named, and a show is there only if it may see the show itself.
func (*Store) MoveOptions ¶
MoveOptions works out where a title can move to.
func (*Store) MoveTitle ¶
MoveTitle puts a title in another library. Its file doesn't move: the library it was found in is told to leave it, and the new one to look after it, through scans.
func (*Store) MusicCounts ¶
func (s *Store) MusicCounts(ctx context.Context, libraryID, userID int64, access *Access) (albums, artists, songs, liked int, err error)
MusicCounts is the size of a library, for its page.
func (*Store) MusicTracks ¶
MusicTracks answers a MusicQuery. It works out which and in what order first, then reads those items, so a long library costs one simple query.
func (*Store) Networks ¶
Networks lists the networks of the shows in a library (0 = all), with the genres that appear on each.
func (*Store) NextEpisode ¶
NextEpisode returns the id of the next episode in its show this account may see, if any.
func (*Store) NextInCollection ¶
func (s *Store) NextInCollection(ctx context.Context, c *Collection, userID, after int64, access *Access) *int64
NextInCollection is what comes after an item when a list is played through.
func (*Store) NextUpItems ¶
func (s *Store) NextUpItems(ctx context.Context, userID int64, showIDs []int64, access *Access, limit int) ([]*Item, error)
NextUpItems picks the next episode of each show, for the home page, reading only what the choice needs: one query for all the shows instead of every episode's full row for each. limit bounds the result.
func (*Store) OpenArchive ¶
OpenArchive returns an open archive of a library (call the release func when done). The file is opened again each time, so one replaced since doesn't get by on the copy kept open.
func (*Store) OpenBook ¶
OpenBook opens what the reader reads for a book: the library's own file, or the copy made from it in the cache, which isn't in a library and which only this server writes. A book that's locked stops here, so none of its files go out.
func (*Store) OpenLibraryFile ¶
OpenLibraryFile opens a file inside a library folder. What it hands back is what was checked: a check followed by an open by name can be raced by anyone who can rename files in the folder, so the opening itself can't leave the library. Serve from this handle.
func (*Store) PeopleNeedingDetails ¶
PeopleNeedingDetails are people with an id at TMDB who were never looked up, or not for a month, most credited first: what a background pass asks about.
func (*Store) PersonVisible ¶
PersonVisible: the person is credited on at least one title this account may see. A person credited only on hidden titles doesn't exist for that account.
func (*Store) PhotoBounds ¶
func (s *Store) PhotoBounds(ctx context.Context, q PhotoQuery) (*PhotoBounds, error)
PhotoBounds is nil when nothing has a place.
func (*Store) PhotoClusters ¶
func (s *Store) PhotoClusters(ctx context.Context, q PhotoQuery, zoom int) (out []PhotoCluster, cut bool, err error)
PhotoClusters groups located pictures for a map zoom level (0 shows the whole world), within q.BBox when there is one, which a map asks for: the part in view. Each square's cover is its newest picture, and a group joined from several keeps the biggest one's. The rows are grouped here rather than by SQLite, which is twice as quick: one pass, no sorting, a few hundred squares held. cut says the smallest groups were left out, which only happens to a caller asking for the whole world far too close up.
func (*Store) PhotoDetail ¶
PhotoDetail loads one picture for an account that may see its item.
func (*Store) PhotoFolders ¶
func (s *Store) PhotoFolders(ctx context.Context, q PhotoQuery) ([]PhotoFolder, error)
PhotoFolders lists the folders with pictures in them.
func (*Store) PhotoLocated ¶
PhotoLocated: the picture or clip has a known place.
func (*Store) PhotoMonths ¶
func (s *Store) PhotoMonths(ctx context.Context, q PhotoQuery) ([]PhotoMonth, error)
PhotoMonths lists months with pictures, newest first.
func (*Store) PhotoMotion ¶
PhotoMotion is the clip that belongs to a live photo ("" when none).
func (*Store) PreviewMetadataFolder ¶
PreviewMetadataFolder says what applying the folder would change, field by field, and what's wrong with any file. Nothing is written.
func (*Store) PreviewRule ¶
func (s *Store) PreviewRule(ctx context.Context, r *CollectionRule, userID int64, access *Access) ([]*Item, int, error)
PreviewRule is what a rule would find, before saving it.
func (*Store) PrunePeople ¶
PrunePeople forgets people no title names any more, and what was read for titles gone.
func (*Store) PurgeExpiredShares ¶
PurgeExpiredShares drops links past their date.
func (*Store) PurgeMetadataFiles ¶
PurgeMetadataFiles deletes every .nfo and .metadata.json file in a library's folders, and says how many went. A read-only library is refused, as for anything that would change its files.
func (*Store) RadioAddresses ¶
RadioAddresses says which directory stations and addresses a library already has.
func (*Store) RadioFrom ¶
func (s *Store) RadioFrom(ctx context.Context, seed *Item, userID int64, limit int, access *Access) ([]*Item, error)
RadioFrom makes a station from a song, out of this library alone: the song first, then others scored by how close they are, with enough chance in the score that two stations from the same song differ. Songs this person disliked are left out.
func (*Store) RadioResult ¶
RadioResult records whether a station answered. Failures close together count once, so it takes a real outage to mark a station dead.
func (*Store) RecentlyPlayedGames ¶
func (s *Store) RecentlyPlayedGames(ctx context.Context, userID int64, limit int) ([]PlayedGame, error)
RecentlyPlayedGames is someone's most recently played games, newest first, from the time played kept in progress (WittyPlay's sessions add to it through the server). Whether they can still see each one is the caller's to check.
func (*Store) Recommend ¶
func (s *Store) Recommend(ctx context.Context, userID int64, it *Item, access *Access) (*Item, *Show, error)
Recommend suggests what to watch after it: for an episode another show (genre overlap first, shows already started before new ones), for a movie a similar unwatched movie. Returns nil when nothing fits.
func (*Store) RecommendForYou ¶
func (s *Store) RecommendForYou(ctx context.Context, userID int64, access *Access, seed int64, limit int) ([]*Item, []*Show, string, error)
RecommendForYou picks unwatched films and shows that match the genres this account spends its time on. It reads only this account's record on this server.
func (*Store) RecordView ¶
RecordView adds one play to an item's numbers for an account.
func (*Store) RelatedVideos ¶
func (s *Store) RelatedVideos(ctx context.Context, q VideoQuery, it *Item, limit int) ([]VideoCard, error)
RelatedVideos are what to watch after a video: the rest of its playlist, then its creator's, then videos that share its tags, picked by the same taste.
func (*Store) Remember ¶
func (s *Store) Remember(ctx context.Context, batch, user, action string, t *Title, before titleSnapshot) error
Remember keeps a title's state before a change.
func (*Store) RemoveFromCollection ¶
RemoveFromCollection takes items and shows out of a collection.
func (*Store) RemoveRadioStation ¶
RemoveRadioStation removes a station from a library.
func (*Store) RemoveRigGame ¶
RemoveRigGame takes a game out of a rig's library.
func (*Store) RemoveTitle ¶
RemoveTitle takes a title out of its library without touching its file: it's hidden, and scans don't add it back until it's restored.
func (*Store) RemovedTitles ¶
RemovedTitles lists what was taken out of libraries.
func (*Store) RereadLibrary ¶
RereadLibrary makes the next scan read every file of a library again, as if each had changed: what was read from files no longer there, or no longer used, goes. What people chose by hand stays, as it does for any file that changed.
func (*Store) ResetCategories ¶
ResetCategories forgets every change to a library's categories.
func (*Store) ResetScanning ¶
ResetScanning clears flags left by a server that stopped during a scan.
func (*Store) Resolve ¶
Resolve looks up the titles an account's collections and tags name, so AllowsItem and AllowsShow can answer for them. It returns the same limits when there is nothing to look up. An error leaves the rules unresolved, and unresolved rules allow nothing.
func (*Store) RestoreRemoved ¶
RestoreRemoved brings something back. It shows again at once, and the note is gone.
func (*Store) ReviewOfYear ¶
func (s *Store) ReviewOfYear(ctx context.Context, userID int64, year int, access *Access) (*YearReview, error)
ReviewOfYear adds up an account's play log for a year. Its time counts everything, and what it names keeps to what the account may still open.
func (*Store) SaveAnnotation ¶
SaveAnnotation adds (ID 0) or updates one of the account's annotations.
func (*Store) SaveCollection ¶
func (s *Store) SaveCollection(ctx context.Context, c *Collection) error
SaveCollection creates a collection (ID 0) or changes one.
func (*Store) SaveDetectedMarkers ¶
SaveDetectedMarkers keeps what comparing episodes found for one of them, replacing what an earlier comparison found; nil or empty forgets it. What a scan read and what someone set are left as they are.
func (*Store) SaveRigGame ¶
func (s *Store) SaveRigGame(ctx context.Context, libraryID int64, path, title, tagline string, poster *string) (int64, error)
SaveRigGame adds a game to a rig's library, or updates it, and returns its item ID. Details from elsewhere stay as they are. The title is always the PC's, as that's the name Moonlight needs. A nil poster means the PC couldn't say just now, so what's there stays, and a picture someone chose by hand is never replaced by the PC's.
func (*Store) SaveScannedMarkers ¶
SaveScannedMarkers keeps what a scan read, replacing what an earlier scan read. What an administrator set is left as it is.
func (*Store) SavedViews ¶
SavedViews lists an account's views.
func (*Store) SearchPeople ¶
func (s *Store) SearchPeople(ctx context.Context, text string, limit int, access *Access) ([]FoundPerson, error)
SearchPeople finds people by name among those credited on titles the account may see, the best known (most titles) first.
func (*Store) SeasonPoster ¶
SeasonPoster returns the stored poster for a season ("" if none).
func (*Store) Seasons ¶
func (s *Store) Seasons(ctx context.Context, showID, userID int64, access *Access) ([]Season, error)
Seasons lists the seasons with episodes this account may see, with per-user unwatched counts.
func (*Store) SeriesInLibrary ¶
func (s *Store) SeriesInLibrary(ctx context.Context, libraryID int64, access *Access) ([]LibraryCollection, error)
SeriesInLibrary lists the film series a library has at least two of, each with the art of its best-rated member: collections nobody had to make.
func (*Store) SetCredits ¶
func (s *Store) SetCredits(ctx context.Context, target string, id int64, source string, list []CreditIn) error
SetCredits replaces what one source says of a title's credits. target is TargetItem (a film or an episode) or TargetShow. An empty list says the source names nobody now.
func (*Store) SetDiscRank ¶
SetDiscRank keeps a ranking worked out after the scan, such as for a disc scanned before its module could rank. The main title follows it unless someone chose another.
func (*Store) SetItemEdited ¶
SetItemEdited notes fields of an item a person typed.
func (*Store) SetItemPrefs ¶
SetItemPrefs stores per-item viewer preferences.
func (*Store) SetLibraryConsole ¶
SetLibraryConsole says which console a games library holds.
func (*Store) SetLibraryForeignNFO ¶
SetLibraryForeignNFO says whether this library reads .nfo files other programs wrote.
func (*Store) SetLibraryReadOnly ¶
SetLibraryReadOnly says that nothing the server does may change this library's files.
func (*Store) SetLibraryShowMain ¶
SetLibraryShowMain says whether a commercials library shows in the main menus.
func (*Store) SetManualMarkers ¶
SetManualMarkers keeps an administrator's markers for an item; nil forgets them, and the file's own come back.
func (*Store) SetMatchRules ¶
func (s *Store) SetMatchRules(ctx context.Context, libraryID int64, rules []MatchRule) ([]MatchRule, error)
SetMatchRules replaces a library's rules, in the order given.
func (*Store) SetPersonDetails ¶
SetPersonDetails stores what a source said about a person. A photo of the person's own beside the media is kept over a web address.
func (*Store) SetProgress ¶
func (*Store) SetReaction ¶
SetReaction saves an account's like (1), dislike (-1) or neither (0).
func (*Store) SetRigPoster ¶
SetRigPoster sets a rig game's picture from its PC ("" for none). A picture someone chose by hand stays: only an empty one, or the PC's own, is replaced. It says whether it changed.
func (*Store) SetSeasonPoster ¶
func (s *Store) SetSeasonPoster(ctx context.Context, showID int64, n int, poster string, replace bool) error
SetSeasonPoster records a season poster, keeping a local file over a remote one.
func (*Store) SetShowView ¶
SetShowView stores a show's episode layout (cards | list | "").
func (*Store) ShareByToken ¶
ShareByToken finds a link that is still valid.
func (*Store) ShareHolds ¶
ShareHolds says whether a link to a set shares a picture.
func (*Store) ShareItems ¶
ShareItems are the pictures a link to a set shares, in the order they were given.
func (*Store) ShareOwner ¶
ShareOwner says who made a link.
func (*Store) ShowCredits ¶
func (s *Store) ShowCredits(ctx context.Context, showID int64, season int, access *Access) (*Credits, error)
ShowCredits are a show's credits. With a season (>= 0) they add the guest stars of that season's episodes this account may see, most episodes first.
func (*Store) ShowFacts ¶
ShowFacts loads a show without its episode counts: all that artwork and access checks need, for every picture a page shows.
func (*Store) ShowGenres ¶
ShowGenres lists the genres used by shows in a library.
func (*Store) SyncBrands ¶
SyncBrands links titles to the studio or network they name, for anything saved before this existed or changed by a scan since. It's cheap when nothing changed.
func (*Store) TitleBrands ¶
TitleBrands lists the studios (or networks) of one title.
func (*Store) TitleListings ¶
func (s *Store) TitleListings(ctx context.Context, target string, id int64) ([]ListingPlatform, int64)
TitleListings says which services list one title.
func (*Store) TryRules ¶
func (s *Store) TryRules(ctx context.Context, libraryID int64, rules []MatchRule) ([]RuleTry, error)
TryRules says what some rules would do to a library's files, without changing anything, so a pattern can be got right first.
func (*Store) Undo ¶
Undo puts back a group of changes, newest first. It returns how many titles changed. Anything since deleted is skipped.
func (*Store) Unsubscribe ¶
Unsubscribe removes a podcast and its episodes that were not downloaded (downloaded files stay on disk and in the library).
func (*Store) UpdateCreator ¶
func (s *Store) UpdateCreator(ctx context.Context, id int64, name, handle, description, platform, url string) error
UpdateCreator changes what a creator page says.
func (*Store) UpdateItem ¶
UpdateItemMeta applies user edits.
func (*Store) UpdateLibrary ¶
func (*Store) UpsertShow ¶
UpsertShow inserts or updates a show (and clears its missing flag).
func (*Store) VideoTags ¶
func (s *Store) VideoTags(ctx context.Context, libraryID int64, access *Access, limit int) ([]string, error)
VideoTags are the most used tags of a library, for the chips above its feed.
func (*Store) VisibleCounts ¶
VisibleCounts puts in each library's ItemCount how many of its titles the account may see. A library's own count is of everything in it, and to a profile with limits that number says there is more than it is shown: hidden titles aren't to show in counts either (docs/PROFILES.md). An account with no limits keeps the counts it has.
func (*Store) VisibleRigGames ¶
VisibleRigGames counts the games of a rig's library this account may see.
func (*Store) WatchCacheGet ¶
func (s *Store) WatchCacheGet(ctx context.Context, source, kind, id, region string) (string, int64, bool)
WatchCacheGet reads a kept answer, and when it was fetched.
func (*Store) WatchCachePut ¶
WatchCachePut keeps an answer. Old answers are dropped on the way.
func (*Store) WatchLater ¶
WatchLater is an account's own list, made the first time it is used.
type StoredMarkers ¶
type StoredMarkers struct {
Scanned *mediaextras.Markers
Manual *mediaextras.Markers
// Detected is what comparing the season's episodes by ear found.
Detected *mediaextras.Markers
}
StoredMarkers are an item's kept markers: what the scan read and what someone set.
type SubtitleFile ¶
type SubtitleFile struct {
Path string
Format string // the registry's id
Codec string // FFmpeg's name, as for a track inside a file
Language string
Title string
Forced bool
SDH bool
Default bool
}
SubtitleFile is one subtitle file that belongs to a video.
func FindSubtitles ¶
func FindSubtitles(video string) []SubtitleFile
FindSubtitles lists the subtitle files of a video: beside it with the same name ("Film.en.forced.srt"), and in a Subs folder beside it. A folder of subtitles counts whole when it's named after the video, or when this is the only video beside it.
func (SubtitleFile) Text ¶
func (s SubtitleFile) Text() bool
Text: the track converts to WebVTT. Otherwise it's pictures, and burned in.
type SuggestJob ¶
type SuggestJob struct {
Running bool `json:"running"`
Done int `json:"done"`
Total int `json:"total"`
Current string `json:"current,omitempty"`
}
SuggestJob is the progress of finding suggestions for a whole queue.
type TMDB ¶
func (*TMDB) Enrich ¶
Enrich fills missing fields from TMDB. It never overwrites a title that a sidecar supplied; it does fill overview, artwork, genres, rating.
func (*TMDB) Images ¶
Images lists poster and backdrop URLs for an item's movie (best first), searching by title when the item is not matched yet.
func (*TMDB) MovieCredits ¶
MovieCredits reads a film's cast and crew alone, for a film matched before credits existed.
func (*TMDB) WatchOffers ¶
WatchOffers reads every way a title can be watched in a region: kind is movie or tv, id TMDB's. Nothing known in the region is an empty answer, not an error. The data is JustWatch's, and has to be credited as such (ListingAttribution).
type TVDB ¶
type TVDB struct {
Key string
PIN string // only for user-supported keys
BaseURL string // default https://api4.thetvdb.com/v4
Client *http.Client
}
TVDB is a small client for TheTVDB API v4 (https://thetvdb.github.io/v4-api/). Metadata provided by TheTVDB; attribution is required by their terms.
func (*TVDB) FindSeries ¶
FindSeries searches by name and returns the best match's metadata.
type TVMaze ¶
TVMaze reads TV metadata from tvmaze.com: free, no API key, data under CC BY-SA 4.0 (credited in the app and the docs). It is used for TV shows whenever no TheTVDB key is set, so TV libraries get posters and episode names out of the box. TVmaze has no content ratings; those come from TheTVDB, an NFO file or a manual edit.
func (*TVMaze) FindSeries ¶
FindSeries searches by name, preferring the given first-air year.
type Title ¶
type Title struct {
Target string
ID int64
Item *Item
Show *Show
Meta *TitleMeta
Studios []string
// Series is the film series it belongs to, which makes a collection by itself.
Series string
}
Title is one film or show with what's kept about it.
func (*Title) EditFields ¶
EditFields applies what a person typed. Each changed field becomes theirs: it remembers what the source said, for Revert, and is locked unless they say not to.
func (*Title) RevertField ¶
RevertField goes back to what the source said, and unlocks the field.
func (*Title) SetField ¶
SetField writes a field from text. Everything going into a field passes through here, from a person or a source, so nothing unbounded or odd reaches the database.
type TitleMeta ¶
type TitleMeta struct {
Locks map[string]bool
Sources map[string]string
Baseline map[string]Baseline
MatchState string
Suggestions []MatchCandidate
SuggestedAt int64
Director string
Edition []string
Tags []string
Banner string
Logo string
AudioFormat string
}
TitleMeta is a title's row in title_meta.
type TitlePoster ¶
type TitlePoster struct {
Title string `json:"title"`
Line string `json:"line"` // a second, smaller line, such as the year
Hue int `json:"hue"` // 0 to 359; -1 is the title's own colour
Frame string `json:"frame"` // a cache: picture to set the words over, or ""
// Auto: made by the scan for a title with no poster, not chosen by anyone. It's
// named apart, so a real poster replaces it and it's never written beside the media.
Auto bool `json:"-"`
}
TitlePoster is what a made poster says and how it looks.
type VideoCard ¶
type VideoCard struct {
ID int64 `json:"id"`
LibraryID int64 `json:"libraryId"`
Title string `json:"title"`
DurationSec float64 `json:"durationSec"`
Width int `json:"width"`
Height int `json:"height"`
Vertical bool `json:"vertical"`
CreatorID int64 `json:"creatorId"`
Creator string `json:"creator"`
HasAvatar bool `json:"hasAvatar"`
Platform string `json:"platform,omitempty"`
UploadDate string `json:"uploadDate"`
Tags []string `json:"tags"`
Playlist string `json:"playlist,omitempty"`
Views int64 `json:"views"` // plays on this server
OrigViews int64 `json:"origViews"` // what the source said when archived
Likes int64 `json:"likes"` // likes on this server
OrigLikes int64 `json:"origLikes"`
Comments int64 `json:"comments"`
Reaction int `json:"reaction"` // this account: 1 liked, -1 disliked, 0 neither
PositionSec float64 `json:"positionSec"`
Watched bool `json:"watched"`
UpdatedAt int64 `json:"updatedAt"`
Reason string `json:"reason,omitempty"` // For You: why this one
}
VideoCard is one creator video in a list: no file paths, one query's worth of counts, and everything a card or a feed page needs.
type VideoDetail ¶
type VideoDetail struct {
VideoCard
Description string `json:"description"`
SourceURL string `json:"sourceUrl,omitempty"`
Genres []string `json:"genres"`
ContentRating string `json:"contentRating,omitempty"`
Custom map[string]any `json:"custom,omitempty"`
}
VideoDetail is one video's page.
type VideoEdit ¶
type VideoEdit struct {
Platform *string `json:"platform"`
SourceURL *string `json:"sourceUrl"`
Date *string `json:"uploadDate"`
Tags *[]string `json:"tags"`
Playlist *string `json:"playlist"`
Creator *string `json:"creator"`
Custom map[string]any `json:"custom"`
}
VideoEdit is custom metadata for one video; nil fields stay as they are.
type VideoQuery ¶
type VideoQuery struct {
LibraryID int64
UserID int64
Access *Access
CreatorID int64
Playlist *string
Tag string
Platform string
Search string
Vertical *bool
Long *bool // true: 20 minutes or more (concerts), false: shorter
Subscribed bool
Liked bool
History bool
IDs []int64
Sort string // latest | oldest | popular | title | artist
Limit int
Offset int
// LibraryType: every library of this kind, as the music library's Music videos does.
LibraryType string
}
VideoQuery picks creator videos.
type ViewEvent ¶
type ViewEvent struct {
Seconds float64 `json:"seconds"`
Completed bool `json:"completed"`
Skipped bool `json:"skipped"`
}
ViewEvent is what a player reports when a viewer moves on from a video.
type WatchOffer ¶
type WatchOffer struct {
ProviderID int `json:"providerId"`
Key string `json:"key"`
Name string `json:"name"`
Type string `json:"type"`
Logo string `json:"logo,omitempty"` // a full address on TMDB's image host
Priority int `json:"priority"`
}
WatchOffer is one service offering a title one way.
type WatchOffers ¶
type WatchOffers struct {
// Link is TMDB's page for the title's offers in the region, which links on to each service.
Link string `json:"link,omitempty"`
Offers []WatchOffer `json:"offers"`
}
WatchOffers is everything TMDB says about a title in one region.
type WatchQuery ¶
type WatchQuery struct {
// UserID is whose record: 0 is everyone's, which only an administrator may be shown.
UserID int64
// By is "title", "show" (a show's episodes together) or "library".
By string
// FromDay is the first day counted, as the play log writes days (YYYYMMDD); 0 is all.
FromDay int
// LibraryID keeps to one library; 0 is every one the account may open.
LibraryID int64
Limit int
}
WatchQuery asks for the most watched titles, shows or libraries.
type WatchTotal ¶
type WatchTotal struct {
// ID is the item's, the show's or the library's.
ID int64
Seconds float64
// People is how many accounts it was; Titles how many titles of a library or show.
People, Titles int
}
WatchTotal is one title's, show's or library's time.
type Wikidata ¶
Wikidata fills in basic facts about films when there is no TMDB key: the year, genres, the US rating (so parental controls work) and a short plot from the film's English Wikipedia article. No key is needed. Wikidata is public domain (CC0); Wikipedia text is CC BY-SA 4.0 and credited in the app. A poster comes only from Wikimedia Commons, where a film has a free one, credited with its licence and author (commons_posters.go).
type WikimediaLogos ¶
type WikimediaLogos struct {
Client *http.Client
// Addresses, replaced in tests.
WikidataAPI, CommonsAPI string
}
WikimediaLogos finds logos through Wikidata (CC0), which says which picture is a company's logo, on Wikimedia Commons, where every file states its licence and only freely licensed or public domain files are allowed. Only files whose licence allows this use are taken. A company's trademark in its logo is a separate matter, which the rights notice beside logos says.
func (*WikimediaLogos) Fetch ¶
func (w *WikimediaLogos) Fetch(ctx context.Context, c LogoCandidate) ([]byte, error)
Fetch downloads a candidate's picture.
func (*WikimediaLogos) Find ¶
func (w *WikimediaLogos) Find(ctx context.Context, kind, name string) ([]LogoCandidate, error)
Find lists candidates, best first. Exact marks those whose name is the name asked about, which are the only ones used without someone choosing.
type YearReview ¶
type YearReview struct {
Year int `json:"year"`
Seconds float64 `json:"seconds"`
Items int `json:"items"`
Days int `json:"days"`
LongestRun int `json:"longestRun"`
BusiestDay int `json:"busiestDay,omitempty"`
BusiestSecs float64 `json:"busiestSeconds,omitempty"`
ByType []ReviewEntry `json:"byType"`
ByMonth [12]float64 `json:"byMonth"`
TopTitles []ReviewEntry `json:"topTitles"`
TopShows []ReviewEntry `json:"topShows"`
TopArtists []ReviewEntry `json:"topArtists"`
TopCreators []ReviewEntry `json:"topCreators"`
TopGenres []ReviewEntry `json:"topGenres"`
Years []int `json:"years"`
}
YearReview is what one account's year looked like. It comes from the account's own record on this server, and goes nowhere else.
Source Files
¶
- access.go
- access_outside.go
- access_rules.go
- agents.go
- anilist.go
- audio.go
- bluray.go
- books.go
- bookshelf.go
- browse.go
- cd.go
- collections.go
- comics.go
- commons_posters.go
- creators.go
- credits_backfill.go
- credits_local.go
- credits_nfo.go
- credits_nfo_write.go
- credits_online.go
- credits_sources.go
- discfolder.go
- discrank.go
- discsource.go
- extras_scan.go
- forget.go
- foryou.go
- games_played.go
- hls_attrs.go
- identify.go
- item_facets.go
- item_titles.go
- kinds.go
- listings.go
- logos.go
- logos_wikimedia.go
- markers.go
- match.go
- match_more.go
- match_rules.go
- match_sources.go
- metadata.go
- metafolder.go
- music.go
- musicbrainz.go
- musiclinks.go
- networkfacts.go
- nfo_foreign.go
- nfo_write.go
- paths.go
- paths_unix.go
- people.go
- people_details.go
- photos.go
- playlists.go
- podcasts.go
- poster_thumbs.go
- radio.go
- radio_directory.go
- radio_meta.go
- radio_stream.go
- rating_boards.go
- reading.go
- rigs.go
- scan.go
- scan_hooks.go
- scan_known.go
- scan_runs.go
- shows.go
- sidecar_safe.go
- social.go
- store.go
- subtitles.go
- svg.go
- thumbs.go
- title_meta.go
- titleposter.go
- tmdb_series.go
- transcode.go
- tvdb.go
- tvmaze.go
- tvparse.go
- tvscan.go
- visible_counts.go
- watchstats.go
- wikidata.go