// Package media serves generic item RESOURCES: the browse list, one item's // detail, its raw file, cover art, progress, credits and view counts. It knows // nothing about any specific media format; modules register cover extractors // and expose their own metadata endpoints. // // What the landing screen shows is deliberately NOT here. The home shelves are // AGGREGATES over many items rather than one resource, they answer a different // question, and they have different callers, so they live in internal/home. // // Item and file ACCESS does not live here any more — it lives in // internal/catalog, so that the web app, the modules, Jellyfin and Subsonic all // share one implementation of "may this user read this item" instead of five. // The names below are kept as aliases so existing callers do not have to move // in the same step; new code should import catalog directly. package media import ( "context" "database/sql" "github.com/mithral/vellum/internal/catalog" ) // Item is one media item plus the root of its library. See catalog.Item. type Item = catalog.Item // FileEntry is one physical file backing an item, with its codec facts. // See catalog.File. type FileEntry = catalog.File // ErrItemNotFound means no item matched, or the caller may not read it. The two // are deliberately indistinguishable so a handler cannot leak the existence of // another user's library. See catalog.ErrNotFound. var ErrItemNotFound = catalog.ErrNotFound // FileCount returns how many files back an item. func FileCount(ctx context.Context, db *sql.DB, itemID int64) (int, error) { return catalog.FileCount(ctx, db, itemID) }