func inspectFmt(f string) error { var id core.Identifier var err error fs := expandSets(f) if len(fs) == 0 { return fmt.Errorf("no valid fmt to inspect in %s", f) } opts := append(getOptions(), config.SetDoubleUp()) // speed up by allowing sig double ups if *inspectMI != "" { id, err = mimeinfo.New(opts...) } else if strings.HasPrefix(fs[0], "fdd") || *inspectLOC || (*inspectFDD != "") { if *inspectFDD == "" && !*inspectLOC { opts = append(opts, config.SetLOC("")) } id, err = loc.New(opts...) } else { if !*inspectReports { opts = append(opts, config.SetNoReports()) // speed up by building from droid xml } id, err = pronom.New(opts...) } if err != nil { return err } fmt.Println(id.Inspect(fs...)) return nil }
func inspectSig(f string) error { _, err := pronom.New(config.SetLimit(expandSets(f)), config.SetInspect(), config.SetNoContainer()) if err != nil { return err } return nil }
func TestMakePronomTika(t *testing.T) { s := siegfried.New() config.SetHome(*testhome) p, err := pronom.New() if err != nil { t.Fatal(err) } err = s.Add(p) if err != nil { t.Fatal(err) } m, err := mimeinfo.New(config.SetName("tika"), config.SetMIMEInfo("tika")) if err != nil { t.Fatal(err) } err = s.Add(m) if err != nil { t.Fatal(err) } l, err := loc.New(config.SetName("loc"), config.SetLOC("")) if err != nil { t.Fatal(err) } err = s.Add(l) if err != nil { t.Fatal(err) } sigs := filepath.Join("data", "pronom-tika-loc.sig") err = s.Save(sigs) if err != nil { t.Fatal(err) } }
func makegob(s *siegfried.Siegfried, opts []config.Option) error { p, err := pronom.New(opts...) if err != nil { return err } err = s.Add(p) if err != nil { return err } return s.Save(config.Signature()) }
func TestLoad(t *testing.T) { s := New() config.SetHome("./cmd/roy/data") p, err := pronom.New() if err != nil { t.Fatal(err) } err = s.Add(p) if err != nil { t.Fatal(err) } }
func setup(opts ...config.Option) error { if opts == nil && s != nil { return nil } var err error s = siegfried.New() config.SetHome(*testhome) opts = append(opts, config.SetDoubleUp()) p, err := pronom.New(opts...) if err != nil { return err } return s.Add(p) }
func TestMakeGob(t *testing.T) { s := siegfried.New() config.SetHome(*testhome) p, err := pronom.New() if err != nil { t.Fatal(err) } err = s.Add(p) if err != nil { t.Fatal(err) } sigs := filepath.Join("data", config.SignatureBase()) err = s.Save(sigs) if err != nil { t.Fatal(err) } }
func TestMakeArchivematica(t *testing.T) { s := siegfried.New() config.SetHome(*testhome) p, err := pronom.New( config.SetName("archivematica"), config.SetExtend(expandSets("archivematica-fmt2.xml,archivematica-fmt3.xml,archivematica-fmt4.xml,archivematica-fmt5.xml"))) if err != nil { t.Fatal(err) } err = s.Add(p) if err != nil { t.Fatal(err) } sigs := filepath.Join("data", "archivematica.sig") err = s.Save(sigs) if err != nil { t.Fatal(err) } }
func makegob(s *siegfried.Siegfried, opts []config.Option) error { var id core.Identifier var err error if *mi != "" { id, err = mimeinfo.New(opts...) } else if *locfdd || *fdd != "" { id, err = loc.New(opts...) } else { id, err = pronom.New(opts...) } if err != nil { return err } err = s.Add(id) if err != nil { return err } return s.Save(config.Signature()) }
func graphPriorities(typ int) error { var id core.Identifier var err error opts := append(getOptions(), config.SetDoubleUp()) // speed up by allowing sig double ups if *inspectMI != "" { id, err = mimeinfo.New(opts...) } else if *inspectLOC || (*inspectFDD != "") { id, err = loc.New(opts...) } else { if !*inspectReports { opts = append(opts, config.SetNoReports()) // speed up by building from droid xml } id, err = pronom.New(opts...) } if err != nil { return err } fmt.Println(id.GraphP(typ)) return nil }