Commit 96e704af authored by Simon Kirsten's avatar Simon Kirsten
Browse files

Improved and progressed on documentation

parent 8c9261ff
Pipeline #22272 passed with stages
in 1 minute and 28 seconds
# Remote
!!! example "*TODO*"
* idk what to put here
The following needs to be somewhere but idk where at the moment. Maybe in the Server doc. Maybe here.
## Games
### Game Data Structure
```json
{
"name": "League of Legends",
"viewers": 123456,
"box_img_url": "https://static-cdn.jtvnw.net/ttv-boxart/League%20of%20Legends-272x380.jpg",
"logo_img_url": "https://static-cdn.jtvnw.net/ttv-logoart/League%20of%20Legends-240x144.jpg"
}
```
### Top Games
Gets games sorted by number of current viewers on Twitch, most popular first.
returns `list(Game)`
### Search Games
Searches for games by name. A game is returned if the query parameter is matched entirely or partially, in the game name.
#### filter by
- `query` e.g. `over` will find *"Overwatch"*, *"Overcooked! 2"*, etc.
returns `list(Game)`
## Streams
### Stream Data Structure
```json
{
"average_fps": 60,
"started_at": "2019-06-21T08:45:54Z",
"game": "Hearthstone",
"preview_img_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_playhearthstone-640x360.jpg",
"video_height": 1080,
"viewers": 8331,
"status": "Hearthstone Grandmasters Asia-Pacific - Week 5 Day 1 | Staz vs che0nsu",
"language": "en",
"mature": false,
"channel_name": "playhearthstone",
"channel_display_name": "PlayHearthstone",
"channel_logo_img_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/9c71609c-26ce-4bde-986f-567e202e0dbc-profile_image-300x300.jpeg"
}
```
### Top Streams
Gets streams sorted by number of current viewers on Twitch, most popular first.
#### filter by
- `channels` - Constrains the channel(s) of the streams returned. (max 100 per request)
- `game` - Constraint by game e.g. `Overwatch`
- `language` - Constraint by language e.g. `de`
returns `list(Stream)`
### Featured Streams
Gets a list of all featured live streams. (Featured streams are shown on the front page)
returns `list(Stream)`
<small>TODO</small>
\ No newline at end of file
# Test Page
TODO
<small>TODO</small>
\ No newline at end of file
......@@ -54,6 +54,7 @@ Darwin (macOS) | x86 (64-bit) | [stream-tv-server-darwin-x86_64](https://code.f
## Common Errors
<small>TODO</small>
```
listen tcp :80: bind: permission denied
```
......@@ -62,6 +63,7 @@ listen tcp :80: bind: permission denied
```
listen tcp :80: bind: address already in use
listen tcp 0.0.0.0:8080: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
```
: Something is already using the port. This could be another Stream TV Server instance or some other application (like a webserver).
Close / disable the other service or change the port via the [command-line options](options.md).
......
# Quickstart <small>(learning by doing)</small>
```bash
$ ./stream-tv-server
```
```
Serving on
http://127.0.0.1:8080
http://192.168.0.136:8080
Read the documentation at https://simons-nzse-2.h-da.io/stream-tv/server/usage/ on how to use this server.
Stop with Ctrl-C or close this terminal.
```
!!! note
In the examples of this documentation only the local address is used. If you want to connect from your phone or the emulator you need to use the network address (`192.168.0.136` in this case). Also we assume you use the default port `8080`.
1. Open http://127.0.0.1:8080 in a browser.
2. Get the current state of the tv:
``` tab="Browser"
http://127.0.0.1:8080/tv/state
```
``` bash tab="Bash"
curl "http://127.0.0.1:8080/tv/state"
```
``` java tab="Java"
TODO
```
!!! example
``` json
{
"large_channel": null,
"small_channel": null,
"volume": 0.5,
"small_scale": 0.5,
"show_chat": false
}
```
3. Find some stream on twitch:
``` tab="Browser"
http://127.0.0.1:8080/twitch/streams/top
```
``` bash tab="Bash"
curl "http://127.0.0.1:8080/twitch/streams/top"
```
``` java tab="Java"
TODO
```
!!! example
``` json
[
{
"average_fps": 60,
"started_at": "2019-08-18T17:29:55Z",
"game": "League of Legends",
"preview_img_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_riotgames-640x360.jpg",
"video_height": 1080,
"viewers": 226699,
"status": "TL vs. CG | Semifinals Day 2 | LCS Summer Split | Team Liquid vs. Clutch Gaming (2019)",
"language": "en",
"mature": false,
"channel_name": "riotgames",
"channel_display_name": "Riot Games",
"channel_logo_img_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/889e7697-b636-48d9-be15-a9a39e286a64-profile_image-300x300.png"
},
...
]
```
4. Start playback of some stream with chat and muted volume:
``` tab="Browser"
http://127.0.0.1:8080/tv/state?large_channel={channel here}&volume=0&show_chat=true
```
``` bash tab="Bash"
curl "http://127.0.0.1:8080/tv/state?large_channel={channel here}&volume=0&show_chat=true"
```
``` java tab="Java"
TODO
```
!!! example
``` json
{
"large_channel": "riotgames",
"small_channel": null,
"volume": 0.5,
"small_scale": 0.5,
"show_chat": false
}
```
5. Read the [Reference](reference.md).
\ No newline at end of file
# Usage
```bash
$ ./stream-tv-server
```
```
Serving on
http://127.0.0.1:8080
http://192.168.0.136:8080
Read the documentation at https://simons-nzse-2.h-da.io/stream-tv/server/usage/ on how to use this server.
Stop with Ctrl-C or close this terminal.
```
## Quickstart
!!! note
In the examples of this documentation only the local address is used. If you want to connect from your phone or the emulator you need to use the network address (`192.168.0.136` in this case). Also we assume you use the default port `8080`.
1. Open http://127.0.0.1:8080 in a browser.
2. Get the current state of the tv:
``` tab="Browser"
http://127.0.0.1:8080/tv/state
```
``` bash tab="Bash"
curl "http://127.0.0.1:8080/tv/state"
```
``` java tab="Java"
TODO
```
``` json
{
"large_channel": null,
"small_channel": null,
"volume": 0.5,
"small_scale": 0.5,
"show_chat": false
}
```
3. Find some stream on twitch:
``` tab="Browser"
http://127.0.0.1:8080/twitch/streams/top
```
``` bash tab="Bash"
curl "http://127.0.0.1:8080/twitch/streams/top"
```
``` java tab="Java"
TODO
```
``` json
[
{
"average_fps": 60,
"started_at": "2019-08-18T17:29:55Z",
"game": "League of Legends",
"preview_img_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_riotgames-640x360.jpg",
"video_height": 1080,
"viewers": 226699,
"status": "TL vs. CG | Semifinals Day 2 | LCS Summer Split | Team Liquid vs. Clutch Gaming (2019)",
"language": "en",
"mature": false,
"channel_name": "riotgames",
"channel_display_name": "Riot Games",
"channel_logo_img_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/889e7697-b636-48d9-be15-a9a39e286a64-profile_image-300x300.png"
},
...
]
```
4. Start playback of that stream:
``` tab="Browser"
http://127.0.0.1:8080/tv/state?large_channel=riotgames
```
``` bash tab="Bash"
curl "http://127.0.0.1:8080/tv/state?large_channel=riotgames"
```
``` java tab="Java"
TODO
```
``` json
{
"large_channel": "riotgames",
"small_channel": null,
"volume": 0.5,
"small_scale": 0.5,
"show_chat": false
}
```
# Reference
## `/tv`
......@@ -119,13 +19,15 @@ Optional Query String Parameter:
!!! note
All parameters are optional. If none are supplied no updates are done and the current state gets returned. Also empty parameters like `?large_channel=&volume=` are simply ignored. This makes the Java integration a lot simpler.
Returns: [`TVState`](#TVState).
Returns: [`TVState`](#tvstate_1).
Examples:
* `http://127.0.0.1:8080/tv/state?large_channel=riotgames&small_channel=&volume=0.75&show_chat=true`
* <small>TODO</small>
---
## `/twitch`
### `/twitch/games/top`
......@@ -134,7 +36,19 @@ Examples:
*No Parameters*
Returns: [`Game`](#Game) array.
Returns: [`Game`](#game) array.
---
### `/twitch/games/search`
<small>TODO: fix this</small>
> Searches games by query.
Query String Parameter:
| Name | Type | Description |
| --------------- | ------ | --- |
| `query` | string | What should be searched e.g. `query=Talk%20Shows` |
### `/twitch/streams/top`
......@@ -152,17 +66,62 @@ Optional Query String Parameter:
All parameters are optional. Empty parameters like `?channels=&language=` are simply ignored. This makes the Java integration a lot simpler.
The `channels` option can be very usefull: If for example your app implements a favorite list you can very easily query these channels `http://127.0.0.1:8080/twitch/streams/top?channels={comma seperated list of favorite channels here}` and see who is streaming and other metadata.
Returns: [`Stream`](#Stream) array.
Returns: [`Stream`](#stream) array.
Examples:
* `http://127.0.0.1:8080/twitch/streams/top?game=Overwatch&language=en`
* `http://127.0.0.1:8080/twitch/streams/top?game=Talk%20Shows%20%26%20Podcasts&language=en`
* <small>TODO</small>
---
### `/twitch/streams/featured`
> Gets the featured games on twitch's homepage.
*No Parameters*
Returns: [`Stream`](#Stream) array.
\ No newline at end of file
Returns: [`Stream`](#stream) array.
---
## Structures <small>(by Example)</small>
### TVState
``` json
{
"large_channel": "xqcow",
"small_channel": "jackdire",
"volume": 0.75,
"small_scale": 0.25,
"show_chat": true
}
```
### Game
``` json
{
"name": "Grand Theft Auto V",
"viewers": 118716,
"box_img_url": "https://static-cdn.jtvnw.net/ttv-boxart/Grand%20Theft%20Auto%20V-272x380.jpg",
"logo_img_url": "https://static-cdn.jtvnw.net/ttv-logoart/Grand%20Theft%20Auto%20V-240x144.jpg"
}
```
### Stream
``` json
{
"average_fps": 60,
"started_at": "2019-08-20T19:54:47Z",
"game": "Fortnite",
"preview_img_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_tfue-640x360.jpg",
"video_height": 1080,
"viewers": 42870,
"status": "High Kill Solos",
"language": "en",
"mature": false,
"channel_name": "tfue",
"channel_display_name": "Tfue",
"channel_logo_img_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/2470b5c6-a737-4ba6-8987-c28e0ca839e1-profile_image-300x300.jpg"
}
```
\ No newline at end of file
......@@ -81,13 +81,14 @@ nav:
- Project:
- Stream TV Project: index.md
- Project Structure: project/project-structure.md
- Quickstart: project/quickstart.md
# - Quickstart: project/quickstart.md
- Twitch: project/twitch.md
- Server:
- Stream TV Server: server/index.md
- Options: server/options.md
- Usage: server/usage.md
- Quickstart: server/quickstart.md
- Reference: server/reference.md
- Release notes: server/release-notes.md
- Contributing: server/contributing.md
- License: server/license.md
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment