Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add json schemas #65

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions content/docs/tools/teddyCloud/tecdoc/edit-local.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: "Edit JSON files with vscode"
description: "edit json files locally"
bookCollapseSection: true
---

# Edit JSON files with vscode

You can use a json schema which can provide you the ability for autocompletion and validation in your favorite editor. This article describes it for vscode.

Schemas:

* [content-json-schema.json](/teddyCloud/tecdoc/content-json-schema.json)
* [tonies-custom-json-schema.json](/teddyCloud/tecdoc/tonies-custom-json-schema.json)
* [tonieboxes-custom-json-schema.json](/teddyCloud/tecdoc/tonieboxes-custom-json-schema.json)
* [plalist-tap-json-schema.json](/teddyCloud/tecdoc/plalist-tap-json-schema.json)

## content.json

Add the Schemaurl to the json file.

Example:

```json
{
"$schema": "{{< siteurl >}}teddyCloud/tecdoc/content-json-schema.json",
"live": false,
"nocloud": false,
"source": "",
"skip_seconds": 0,
"cache": false,
"cloud_ruid": "",
"cloud_auth": "",
"cloud_override": false,
"tonie_model": "",
"_version": 5
}

```

## tonies.custom.json / tonieboxes.custom.json

To configure this for vscode you have to edit `.vscode/settings.json`.

Add the following parts to the `settings.json`:

```json
{
"json.schemaDownload.enable": true,
"json.schemas": [
{
"fileMatch": ["tonies.custom.json"],
"url": "{{< siteurl >}}teddyCloud/tecdoc/tonies-custom-json-schema.json"
},
{
"fileMatch": ["tonieboxes.custom.json"],
"url": "{{< siteurl >}}teddyCloud/tecdoc/tonieboxes-custom-json-schema.json"
}
]
}
```

## Plalist (TAP) Files

```json
{
"$schema": "{{< siteurl >}}teddyCloud/tecdoc/plalist-tap-json-schema.json",
"type": "tap",
"audio_id": 0,
"filepath": "lib://by/tapID/radio.taf",
"name": "Radio",
"files": [
{
"filepath": "lib://by/audioID/1234567890.taf",
"name": "Hörspiel Tonie"
},
{
"filepath": "lib://mp3/album/title.mp3",
"name": "A Song"
},
{
"filepath": "http://nas.intranet/musiclibrary/album/song.mp3",
"name": "Network Audio"
}
]
}
```
1 change: 1 addition & 0 deletions layouts/shortcodes/siteurl.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ .Site.BaseURL }}
63 changes: 63 additions & 0 deletions static/teddyCloud/tecdoc/content-json-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Tonie Configuration Schema",
"type": "object",
"additionalProperties": false,
"properties": {
"live": {
"type": "boolean",
"default": false,
"description": "Always start the content from the beginning and redownload its content"
},
"nocloud": {
"type": "boolean",
"default": false,
"description": "Do not sync the TAF with the boxine cloud"
},
"source": {
"type": "string",
"default": "",
"description": "Use this TAF as content or convert this file into a TAF (supports any ffmpeg-decoded source)"
},
"skip_seconds": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295,
"default": 0,
"description": "Skips the audio by given seconds (source)"
},
"cache": {
"type": "boolean",
"default": false,
"description": "Do not delete the TAF converted via `source` after sending it"
},
"cloud_ruid": {
"type": "string",
"default": "",
"pattern": "^[0-9a-fA-F]*$",
"description": "rUID of the Tonie (hexadecimal string)"
},
"cloud_auth": {
"type": "string",
"default": "",
"description": "Content password of the Tonie"
},
"cloud_override": {
"type": "boolean",
"default": false,
"description": "Reroute a tag to a different one (requires cloud_ruid/cloud_auth)"
},
"tonie_model": {
"type": "string",
"default": "",
"description": "Identify the Tonie"
},
"_version": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295,
"default": 5,
"description": "Version of the file"
}
}
}
51 changes: 51 additions & 0 deletions static/teddyCloud/tecdoc/plalist-tap-json-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Playlist Configuration Schema",
"type": "object",
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"default": "tap",
"description": "Sets the type of playlist"
},
"audio_id": {
"type": "integer",
"minimum": 0,
"maximum": 4294967295,
"default": 0,
"description": "Audio ID for cached files (0 forces recreation)"
},
"filepath": {
"type": "string",
"default": "",
"description": "Output path for TAF file generated by ffmpeg"
},
"name": {
"type": "string",
"default": "",
"description": "Name of the playlist"
},
"files": {
"type": "array",
"default": [],
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"filepath": {
"type": "string",
"default": "",
"description": "Path to audio resource (ffmpeg-compatible)"
},
"name": {
"type": "string",
"default": "",
"description": "Display name for the audio resource"
}
}
},
"description": "List of audio files in the playlist"
}
}
}
39 changes: 39 additions & 0 deletions static/teddyCloud/tecdoc/tonieboxes-custom-json-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Custom Toniebox Configuration Schema",
"type": "array",
"items": {
"type": "object",
"required": ["id", "name", "img_src", "crop"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^\\d{2}-\\d{4}$",
"examples": ["11-0001"],
"description": "Unique model number (must not conflict with existing models)"
},
"name": {
"type": "string",
"examples": ["Customized Toniebox"],
"description": "Display name for the customized Toniebox"
},
"img_src": {
"type": "string",
"format": "uri",
"examples": ["http://.../customToniebox.png"],
"description": "URL of the custom Toniebox image"
},
"crop": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "number"
},
"examples": [[0, 0, 1]],
"description": "Image transformation parameters [x-shift, y-shift, scale]"
}
}
}
}
73 changes: 73 additions & 0 deletions static/teddyCloud/tecdoc/tonies-custom-json-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Custom Tonie Configuration Schema",
"type": "array",
"items": {
"type": "object",
"required": ["model", "series"],
"additionalProperties": false,
"properties": {
"no": {
"type": "string",
"examples": ["0"]
},
"model": {
"type": "string",
"examples": ["123456"]
},
"audio_id": {
"type": "array",
"items": {
"type": "string",
"pattern": "^\\d+$"
},
"examples": [["369519776"]]
},
"hash": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-fA-F0-9]+$"
},
"examples": [["af9e6..b04515"]]
},
"title": {
"type": "string",
"examples": ["Custom Tonie Example Title"]
},
"series": {
"type": "string",
"examples": ["Custom Tonie"]
},
"episodes": {
"type": "string",
"examples": ["This is my custom tonie"]
},
"tracks": {
"type": "array",
"items": {
"type": "string"
},
"examples": [["Title 1", "Title 2"]]
},
"release": {
"type": "string",
"examples": ["0"]
},
"language": {
"type": "string",
"pattern": "^[a-z]{2}-[a-z]{2}$",
"examples": ["de-de"]
},
"category": {
"type": "string",
"examples": ["custom"]
},
"pic": {
"type": "string",
"format": "uri",
"examples": ["https://.../Logo.png"]
}
}
}
}