Documentation
¶
Overview ¶
Package creators reads the creators.d directory: one YAML file per creator, binding the several storefronts one person sells the same catalogue on.
It is deliberately a directory of single-creator files rather than a block in config.yaml. The files carry no secrets, so a set of them can live in a git repository and be shared; and because each creator is its own file, two people adding creators never touch the same lines.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDir ¶
func DefaultDir() string
DefaultDir returns the conventional creators.d location for this platform. The directory need not exist — an absent one simply means no creators.
func Filename ¶
Filename returns the conventional file name for a creator: the name as a lowercase hyphenated slug. Only a convention — Load reads the `name:` field, never the file name, so renaming a file changes nothing.
func Key ¶
Key canonicalises a creator name for comparison: lowercased, with everything that is not a letter or digit removed.
It is deliberately tighter than match.NormalizeName, which keeps spaces. The same person is spelled "Vera Quill", "VeraQuill" and "Vera Quill Films" across three storefronts, and only a key that ignores spacing treats the first two as one name.
Types ¶
type Canon ¶
type Canon struct {
// contains filtered or unexported fields
}
Canon rewrites the performer names a storefront publishes into the spelling its creator is filed under.
Storefronts routinely credit their own branding as the performer: a shop trading as "<Name> Films" lists "<Name> Films" as the performer on every scene. Stored verbatim, one person becomes several performers, and every cross-store view — `fss compare`, a Stash import, and `suggest`'s own shared-performer signal — fragments along with them.
A credit is branding when it matches either of two things, both already known without any extra configuration:
- the scene's own Studio value. A storefront that credits itself as the performer says so in both fields at once, and on a creator's store the storefront is the creator. This is the dominant case by a wide margin, and it needs nothing written down.
- one of the creator's declared aliases. The escape hatch for the residue, where a store spells its own name one way in the studio field and another in the credit.
Everything is scoped to the stores a creator file lists, which is what makes it safe: a co-star is never touched, however much their name resembles the creator's, because neither rule can fire on a name that is neither the shop nor a spelling of it.
It deliberately holds no fuzzy matching. Deciding that an unfamiliar name is really this creator needs evidence a single scene does not carry — which storefronts credit it, and nothing else — so that judgement lives in `fss creators suggest`, which has the whole library to reason over and writes its conclusion to the file for review.
func NewCanon ¶
NewCanon builds the rewrite table from loaded creator files.
Every store of every creator gets an entry, including creators that declare no aliases at all: the studio-match rule needs only the name and the links a file already carries, so the common case costs the operator nothing to configure.
A store listed under two creators is left out entirely rather than assigned to whichever file loaded first: Load already warns about the duplicate, and silently relabelling a shared storefront's performers to one of the two names would be a guess dressed as a fact.
func (Canon) For ¶
func (c Canon) For(studioURL string) StoreCanon
For returns the rewrite that applies to one storefront. The result is safe to use whether or not the URL belongs to a creator.
type Creator ¶
type Creator struct {
Name string `yaml:"name"`
Aliases []string `yaml:"aliases,omitempty"`
Stores []Store `yaml:"stores"`
// Path is the file this came from, for error messages. Not serialised.
Path string `yaml:"-"`
}
Creator is one person's storefronts, as read from a single file.
func Find ¶
Find resolves a --creator value against a loaded set.
An exact key match wins outright. Failing that, a value that is a prefix of exactly one creator's key resolves to it, so `--creator mara` reaches "Mara Vance"; a prefix matching several is an error naming them, never a silent pick.
func Load ¶
Load reads every *.yaml / *.yml file in dir, one creator per file.
A missing directory is not an error: creators are opt-in, and every command that consults them must work for an operator who has never made one. Files that are not YAML are skipped, so a shared repository can carry a README, a LICENSE and a .git directory without special handling.
func (Creator) EnabledStores ¶
EnabledStores returns only the stores a creator-driven scrape should visit.
func (Creator) Keys ¶
Keys returns the lookup keys a --creator value may match: the name and every alias, canonicalised.
type Store ¶
type Store struct {
URL string `yaml:"url"`
// Delay overrides the per-request delay in milliseconds for this store
// only. Nil inherits the site or global delay.
Delay *int `yaml:"delay,omitempty"`
// Enabled set to false skips the store on --all-creators and --creator
// runs, for a storefront that is login-walled or otherwise not scrapeable
// unattended. Nil means enabled.
Enabled *bool `yaml:"enabled,omitempty"`
// Note is a free-text reminder, shown by `fss creators`.
Note string `yaml:"note,omitempty"`
}
Store is one storefront belonging to a creator.
type StoreCanon ¶
type StoreCanon struct {
// contains filtered or unexported fields
}
StoreCanon is the rewrite for one storefront. The zero value is valid and rewrites nothing, so a caller with no creators defined needs no special case.
func (StoreCanon) Active ¶
func (s StoreCanon) Active() bool
Active reports whether this storefront has any rewrite to apply.
func (StoreCanon) Apply ¶
func (s StoreCanon) Apply(studio string, names []string) []string
Apply rewrites one scene's performer list, given the studio that scene was published under.
A credit becomes the creator's name when it matches the scene's own studio, or one of the creator's declared spellings. Everything else passes through untouched — the co-stars on a scene are not this function's business.
The result is deduplicated by key, because a scene crediting the shop and the person separately names one performer and must not be stored as two.
The input slice is never modified.
func (StoreCanon) Name ¶
func (s StoreCanon) Name() string
Name is the creator's canonical spelling.