Documentation
¶
Overview ¶
Package ids provides stable, stateless protocol identifiers.
Index ¶
- Constants
- Variables
- func Decimal(id int64) string
- func FormatStremio(id StremioID) (string, error)
- func GUID(kind Kind, id int64) (string, error)
- func IsSeries(key core.RatingKey) bool
- func ParseDecimal(value string) (int64, error)
- func ParseGUID(kind Kind, value string) (int64, error)
- func ParseRatingKeyGUID(value string) (core.RatingKey, error)
- func PersonalView(id int64) bool
- func RatingKeyGUID(key core.RatingKey) string
- func StremioTMDBKey(mediaType string, id StremioID) (core.RatingKey, error)
- func StringGUID(kind Kind, value string) (string, error)
- type Codecs
- func (c Codecs) Compact(ctx context.Context, surface, kind, ref string) (int32, error)
- func (Codecs) Decimal(id int64) string
- func (Codecs) FormatStremio(id StremioID) (string, error)
- func (Codecs) GUID(kind Kind, id int64) (string, error)
- func (Codecs) ParseDecimal(value string) (int64, error)
- func (Codecs) ParseGUID(kind Kind, value string) (int64, error)
- func (Codecs) ParseRatingKeyGUID(value string) (core.RatingKey, error)
- func (Codecs) ParseStremio(value string) (StremioID, error)
- func (Codecs) RatingKeyGUID(key core.RatingKey) string
- func (c Codecs) Resolve(ctx context.Context, surface, kind string, id int32) (string, error)
- func (Codecs) StringGUID(kind Kind, value string) (string, error)
- type CompactAllocator
- type Kind
- type StremioID
Constants ¶
const PersonalViewBit int64 = 1 << 62
PersonalViewBit marks a view id that belongs to one viewer's home row rather than a library section. Library ids are small positive integers and never set this bit. The id stays stable for a viewer and row identity.
Variables ¶
var ErrInvalid = errors.New("invalid identifier")
Functions ¶
func FormatStremio ¶
FormatStremio encodes an external identifier and optional episode in the same format accepted by ParseStremio. IMDb identifiers retain leading zeros.
func ParseDecimal ¶
func PersonalView ¶
PersonalView reports whether a decoded view id is a personalized home row.
func RatingKeyGUID ¶
func StremioTMDBKey ¶
StremioTMDBKey maps a TMDB Stremio identifier to its neutral catalogue key. IMDb identifiers require the host's policy-checked external ID lookup.
Types ¶
type Codecs ¶
type Codecs struct{ Allocator CompactAllocator }
func (Codecs) ParseRatingKeyGUID ¶
type CompactAllocator ¶
type CompactAllocator interface {
Compact(context.Context, string, string, string) (int32, error)
Resolve(context.Context, string, string, int32) (string, error)
}
Codecs exposes stateless codecs to a frontend without retaining state.
type StremioID ¶
StremioID is an external TMDB or IMDb identifier with an optional episode. IMDb identifiers cannot be converted to RatingKey without a catalog lookup.
func ParseStremio ¶
ParseStremio accepts tmdb:<id> or tt<digits>, optionally followed by :<season>:<episode>. TMDB type (movie or series) is supplied by the caller.