Пример #1
0
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
}
Пример #2
0
func New(opts ...config.Option) (core.Identifier, error) {
	for _, v := range opts {
		v()
	}
	pronom, err := NewPronom()
	if err != nil {
		return nil, err
	}
	return &Identifier{
		infos: infos(pronom.Infos()),
		Base:  identifier.New(pronom, config.ZipPuid()),
	}, nil
}
Пример #3
0
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
}