func New(opts ...config.Option) (core.Identifier, error) { for _, v := range opts { v() } loc, err := newLOC(config.LOC()) if err != nil { return nil, err } // set updated updated := loc.(fdds).Updated().Format(dateFmt) // add extensions for _, v := range config.Extend() { e, err := newLOC(v) if err != nil { return nil, fmt.Errorf("LOC: error loading extension file %s; got %s", v, err) } loc = identifier.Join(loc, e) } // apply config loc = identifier.ApplyConfig(loc) // return identifier return &Identifier{ infos: infos(loc.Infos()), Base: identifier.New(loc, config.ZipLOC(), updated), }, nil }
// Pronom creates a pronom object func NewPronom() (identifier.Parseable, error) { p := &pronom{ c: identifier.Blank{}, } // apply no container rule if !config.NoContainer() { if err := p.setContainers(); err != nil { return nil, fmt.Errorf("Pronom: error loading containers; got %s\nUnless you have set `-nocontainer` you need to download a container signature file", err) } } if err := p.setParseables(); err != nil { return nil, err } return identifier.ApplyConfig(p), nil }
func New(opts ...config.Option) (core.Identifier, error) { for _, v := range opts { v() } mi, err := newMIMEInfo(config.MIMEInfo()) if err != nil { return nil, err } // add extensions for _, v := range config.Extend() { e, err := newMIMEInfo(v) if err != nil { return nil, fmt.Errorf("MIMEinfo: error loading extension file %s; got %s", v, err) } mi = identifier.Join(mi, e) } // apply config mi = identifier.ApplyConfig(mi) // return identifier return &Identifier{ infos: infos(mi.Infos()), Base: identifier.New(mi, config.ZipMIME()), }, nil }