[go: nahoru, domu]

Skip to content

Commit

Permalink
docs: update docs to use hugo >= 0.69
Browse files Browse the repository at this point in the history
  • Loading branch information
shahruk10 committed May 13, 2021
1 parent 05e105d commit 6ec0f98
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 87 deletions.
11 changes: 9 additions & 2 deletions docs-src/config.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
baseURL = "https://cobaltspeech.github.io/sdk-juzu"
relativeURLs = true

languageCode = "en-us"
DefaultContentLanguage = "en"
title = "Juzu SDK -- Cobalt"
theme = "docdock"
pygmentsCodeFences = true
pygmentsStyle = "native"

Expand Down Expand Up @@ -39,3 +38,11 @@ name = "<i class='fa fa-bookmark'></i> <label>Contact us</label>"
identifier = "contactus"
url = "https://www.cobaltspeech.com/contact"
weight = 20

[markup.goldmark.renderer]
unsafe= true

[module]
[[module.imports]]
path = "github.com/cobaltspeech/docdock"
# Project theme
2 changes: 1 addition & 1 deletion docs-src/content/_header.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
![Cobalt's SDK Documentation](/sdk-juzu/images/logo-white.png)
![Cobalt's SDK Documentation](/images/logo-white.png)

Juzu SDK -- Cobalt
57 changes: 21 additions & 36 deletions docs-src/content/using-juzu-sdk/connecting.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ uses our recommended default setup, expecting the server to be listening on a
TLS encrypted connection. Examples showing how to connect to a server not using
TLS is also shown in the [Insecure Connection](#insecure-connection) section.

{{%tabs %}}
{{< tabs >}}

{{% tab "Python" %}}
{{< tab "Python" "py" >}}

```py
import juzu

serverAddress = "127.0.0.1:2727"
Expand All @@ -33,13 +32,10 @@ client = juzu.Client(serverAddress)

resp = client.Version()
print(resp)
```

{{% /tab %}}
{{< /tab >}}

{{% tab "C#" %}}

``` csharp
{{< tab "C#" "csharp" >}}

var serverAddress = "127.0.0.1:2727";

Expand All @@ -50,11 +46,10 @@ var client = new Client (serverAddress, insecure);
// Get Version of the server
var ver = client.Version ();
Console.WriteLine ("Juzu: {0} Server: {1}", ver.Juzu, ver.Server);
```

{{% /tab %}}
{{< /tab >}}

{{%/tabs %}}
{{< /tabs >}}

## Insecure Connection

Expand All @@ -65,26 +60,22 @@ Please note that if the server has TLS enabled, attempting to connect with an
insecure client will fail. To connect to an instance of Juzu server without TLS enabled, you
can use:

{{%tabs %}}
{{< tabs >}}

{{% tab "Python" %}}
{{< tab "Python" "py" >}}

```py
client = juzu.Client(serverAddress, insecure=True)
```

{{% /tab %}}
{{< /tab >}}

{{% tab "C#" %}}
{{< tab "C#" "csharp" >}}

``` csharp
var insecure = true;
var client = new Client (serverAddress, insecure);
```

{{% /tab %}}
{{< /tab >}}

{{%/tabs %}}
{{< /tabs >}}

## Client Authentication

Expand All @@ -102,37 +93,31 @@ Please note that in the client-authentication mode, the client will still also
verify the server's certificate, and therefore this setup uses mutually
authenticated TLS. This can be done with:

{{%tabs %}}
{{< tabs >}}

{{% tab "Python" %}}
{{< tab "Python" "py" >}}

```py
client = juzu.Client(serverAddress, clientCertificate=certPem, clientKey=keyPem)
```

{{% /tab %}}

{{% tab "C#" %}}
{{< /tab >}}

#### Authenticating Server Certificate
{{< tab "C#" "csharp" >}}

``` csharp
// Authenticating Server Certificate
var rootPem = File.ReadAllText("root.pem");
var client = new Client (serverAddress, rootPem);
```

#### Mutual Authentication
// OR

``` csharp
// Mutual Authentication
var rootPem = File.ReadAllText("root.pem");
var certPem = File.ReadAllText("cert.pem");
var keyPem = File.ReadAllText("key.pem");
var client = new Client (serverAddress, rootPem, certPem, keyPem);
```

{{% /tab %}}
{{< /tab >}}

{{%/tabs %}}
{{< /tabs >}}

where rootPem is the bytes of the certificate used to validate the server
certificate and certPem & keyPem are the bytes of the client certificate and key
Expand Down
17 changes: 17 additions & 0 deletions docs-src/content/using-juzu-sdk/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,20 @@ NuGet allows 4 different ways to install. Further instructions can be found on
``` bash
dotnet add package Juzu-SDK
```

You can include the SDK in your *.csproj file as well:

```csharp
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Juzu-SDK" Version="0.9.3" />
</ItemGroup>

</Project>
```
71 changes: 24 additions & 47 deletions docs-src/content/using-juzu-sdk/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ see the protocol buffer specification file in the SDK repository ([grpc/juzu.pro
The examples below use a WAV file as input to the streaming diarization (and
transcription).

{{%tabs %}}
{{< tabs >}}

{{% tab "Python" %}}
{{< tab "Python" "py" >}}

``` py
import juzu

serverAddress = '127.0.0.1:2727'
Expand Down Expand Up @@ -86,15 +85,10 @@ def handleResults(diarizationResp):
for resp in client.StreamingDiarize(cfg, audio):
handleResults(resp)

```
{{< /tab >}}

{{% /tab %}}
{{< tab "C#" "csharp">}}

{{% tab "C#" %}}

#### Program.cs

``` csharp
using System;
using System.IO;
using System.Net;
Expand Down Expand Up @@ -149,28 +143,10 @@ namespace JuzusvrClient {
}
}
}
```

#### JuzusvrClient.csproj

``` csharp
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Juzu-SDK" Version="0.9.3" />
</ItemGroup>

</Project>
```

{{% /tab %}}
{{< /tab >}}

{{%/tabs %}}
{{< /tabs >}}

### Streaming from microphone

Expand All @@ -179,16 +155,15 @@ libraries. There are several options available, and although the examples here u
one, you may choose to use an alternative as long as the recording audio format is
chosen correctly.

{{%tabs %}}
{{< tabs >}}

{{% tab "Python" %}}
{{< tab "Python" "py">}}

This example requires the [pyaudio](http://people.csail.mit.edu/hubert/pyaudio/)
module to stream audio from a microphone. Instructions for installing pyaudio
for different systems are available at the link. On most platforms, this is
simply `pip install pyaudio`
# This example requires the pyaudio (http://people.csail.mit.edu/hubert/pyaudio/)
# module to stream audio from a microphone. Instructions for installing pyaudio
# for different systems are available at the link. On most platforms, this is
# simply `pip install pyaudio`

``` py
import juzu
import pyaudio
import threading
Expand Down Expand Up @@ -294,17 +269,19 @@ audio.stop()
print("Waiting for results ...")
streamThread.join()

```
{{< /tab >}}

{{% /tab %}}
{{< tab "C#" "md" >}}

{{% tab "C#" %}}
// We do not currently have example C# code for streaming from a microphone. Simply
// pass the bytes from the microphone the same as is done from the file in the
// `Streaming from an audio file` example above via a class derived from `Stream.IO`
// (https://docs.microsoft.com/en-us/dotnet/api/system.io.stream) with the
// `int Read(buffer byte[], offset int, count int)` method implemented.
//
// See more at:
// https://docs.microsoft.com/en-us/dotnet/api/system.io.stream.read?view=net-5.0#System_IO_Stream_Read_System_Byte___System_Int32_System_Int32_

We do not currently have example C# code for streaming from a microphone. Simply
pass the bytes from the microphone the same as is done from the file in the
[`Streaming from an audio file`](#streaming-from-an-audio-file) example above via
a class derived from [`Stream.IO`](https://docs.microsoft.com/en-us/dotnet/api/system.io.stream).
with the [`int Read(buffer byte[], offset int, count int)`](https://docs.microsoft.com/en-us/dotnet/api/system.io.stream.read#System_IO_Stream_Read_System_Byte___System_Int32_System_Int32_) method implemented.
{{% /tab %}}
{{< /tab >}}

{{%/tabs %}}
{{< /tabs >}}
5 changes: 5 additions & 0 deletions docs-src/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/cobaltspeech/sdk-juzu/docs-src

go 1.15

require github.com/cobaltspeech/docdock v0.0.0-20201229200658-697712c54b17 // indirect
1 change: 1 addition & 0 deletions docs-src/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github.com/cobaltspeech/docdock v0.0.0-20201229200658-697712c54b17/go.mod h1:zWvQBLhbnPeBM6FClM/fkuVK3s9IC5T526LDJeh9944=
2 changes: 1 addition & 1 deletion docs-src/layouts/shortcodes/tab.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="tab-pane" title="{{ .Get 0 }}">
{{ .Inner }}
{{ highlight .Inner (.Get 1) "" }}
</div>

0 comments on commit 6ec0f98

Please sign in to comment.