Help us shape the future of Go! Take the 2026 Go Developer Survey

migrate

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package migrate performs read-only PMS discovery and reviewed, idempotent local imports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	External  string         `json:"external"`
	Key       core.RatingKey `json:"key"`
	Title     string         `json:"title"`
	Viewer    int64          `json:"viewer"`
	Views     int            `json:"views"`
	Offset    int64          `json:"offsetMs"`
	Duration  int64          `json:"durationMs"`
	Rating    float64        `json:"rating"`
	ViewedAt  int64          `json:"viewedAt"`
	Watchlist bool           `json:"watchlist,omitempty"`
}

type List

type List struct {
	External string           `json:"external"`
	Name     string           `json:"name"`
	Kind     string           `json:"kind"`
	Viewer   int64            `json:"viewer"`
	Keys     []core.RatingKey `json:"keys"`
}

type Options

type Options struct {
	State *state.State
	Users interface {
		User(context.Context, int64) (*core.User, error)
	}
}

type Plan

type Plan struct {
	ID       string   `json:"id"`
	Source   string   `json:"source"`
	Items    []Item   `json:"items"`
	History  []Item   `json:"history"`
	Lists    []List   `json:"lists"`
	Viewers  []Viewer `json:"viewers"`
	Warnings []string `json:"warnings"`
	Imported bool     `json:"imported"`
}

type Request

type Request struct {
	URL         string   `json:"url"`
	Token       string   `json:"token"`
	Viewers     []Viewer `json:"viewers"`
	HistoryOnly bool     `json:"historyOnly,omitempty"`
}

type Service

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

func New

func New(db *sql.DB, catalog core.Catalog, opts ...Options) *Service

func (*Service) ExportCSV

func (s *Service) ExportCSV(ctx context.Context, viewer int64, format, kind string, w io.Writer) error

func (*Service) Handler

func (s *Service) Handler() http.Handler

Handler is intentionally unauthenticated: mount inside the owner's authenticated router.

func (*Service) Import

func (s *Service) Import(ctx context.Context, id string) (Plan, error)

func (*Service) Preview

func (s *Service) Preview(ctx context.Context, q Request) (Plan, error)

func (*Service) PreviewCSV

func (s *Service) PreviewCSV(ctx context.Context, viewer int64, format, kind string, r io.Reader) (Plan, error)

PreviewCSV accepts Letterboxd diary/ratings/watchlist and Trakt CSV columns. Letterboxd's export lacks external IDs, so exact title AND year are required.

type Viewer

type Viewer struct {
	LocalUserID     int64  `json:"localUserId"`
	PlexID          int64  `json:"plexId"`
	Name            string `json:"name"`
	Token           string `json:"token,omitempty"`
	SourceAccountID int64  `json:"sourceAccountId,omitempty"`
}

Jump to

Keyboard shortcuts

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