~emersion/drmdb

9e10006451cd753ab55cc2fd062b1387d3e281bf — Simon Ser 6 months ago ea8186c
Merge all property specs
3 files changed, 18 insertions(+), 7 deletions(-)

M public/assets/style.css
M public/property.html
M server.go
M public/assets/style.css => public/assets/style.css +1 -1
@@ 54,7 54,7 @@ td.status-unknown {
    color: gray;
}

td.pre {
td.pre, dd.pre {
    font-family: monospace;
}


M public/property.html => public/property.html +2 -2
@@ 24,8 24,8 @@
    <dd>{{.ObjectType}}</dd>

    <dt>Specification</dt>
    {{if .Prop.Spec}}
    <dd>{{.Prop.Spec}}</dd>
    {{if .Spec}}
    <dd class="pre">{{.Spec}}</dd>
    {{else}}
    <dd class="muted">&lt;none&gt;</dd>
    {{end}}

M server.go => server.go +15 -4
@@ 307,9 307,9 @@ func New() *echo.Echo {
		}
		propertyName := c.Param("name")

		found := false
		var property drmtree.Property

		found := false
		var spec interface{}
		drivers := make(map[string]bool)
		err := database.Walk(func(k string, n *drmtree.Node) error {
			if _, ok := drivers[n.Driver.Name]; !ok {


@@ 321,8 321,18 @@ func New() *echo.Echo {
					return nil
				}
				drivers[n.Driver.Name] = true
				found = true
				property = *p
				found = true

				if spec == nil {
					spec = p.Spec
				} else if p.Spec != nil {
					var err error
					if spec, err = mergeSpec(spec, p.Spec); err != nil {
						return fmt.Errorf("inconsistent property spec: %v", err)
					}
				}

				return nil
			})
		})


@@ 346,8 356,9 @@ func New() *echo.Echo {
			Prop       *drmtree.Property
			ObjectType drm.ObjectType
			Flags      []string
			Spec       interface{}
			Drivers    map[string]bool
		}{propertyName, &property, objectType, flags, drivers})
		}{propertyName, &property, objectType, flags, spec, drivers})
	})

	e.GET("/formats", func(c echo.Context) error {