To upgrade the Stream Server to the latest version just replace the executable with the newest from [Downloads](../download-and-run.md#download). There are no dependencies.
@@ -19,21 +19,21 @@ CI pipeline: `.gitlab-ci-docs.yml`
## Server
> `go.mod`, `go.sum`, `cmd/`, `internal/`, `pkg/`
The Stream TV Server is written in [Go](https://golang.org). It uses [Go Modules](https://github.com/golang/go/wiki/Modules).
The Stream Server is written in [Go](https://golang.org). It uses [Go Modules](https://github.com/golang/go/wiki/Modules).
`go.mod` and `go.sum` are for the module system to ensure [Reproducible builds](https://reproducible-builds.org/).
The `cmd/` directory contains only the `stream-tv-server` command. It sets up the HTTP server and forwards requests to the respective `website`, `twitch` and `tv` handlers in `internal/`.
The `cmd/` directory contains only the `stream-server` command. The code of the server is in `internal/server` and the static files for the playback website in `internal/static`.
`pkg/` contains project independent code to access the Twitch API. This separation is done in accordance to the [Standard Go Project Layout](https://github.com/golang-standards/project-layout).
Local development (requires go 1.12 and a twitch client id):
Local development (requires go 1.12 and a Twitch client id):
``` bash tab="bash" linenums="1"
env TWITCH_CLIENT_ID="your client id here" go run ./cmd/stream-tv-server/main.go
env TWITCH_CLIENT_ID="your client id here" go run ./cmd/stream-server
This is a very simple helper to call the Stream TV server. See the [reference](reference.md) for examples (select the `StreamTV.java` example tab).
This is a very simple helper to call the Stream Server. See the [reference](reference.md) for examples (select the `StreamServerClient.java` example tab).
!!! note
The abstraction level is about on the same as the `HttpRequest.java` of the original TV-Server. The students still have to implement AsyncTask and all the other stuff.
Also the package definition in the first line needs to be updated.
[Download](../assets/StreamTV.java) · [View in GitLab](#todo)
## `StreamServerClient.java`
<!-- Insert StreamTV.java -->
[Download](../assets/StreamServerClient.java) · [View in GitLab](https://code.fbi.h-da.de/stream-server/stream-server/blob/master/docs/assets/StreamServerClient.java)
* Reference at <a href="https://simons-nzse-2.h-da.io/stream-tv/server/reference/#tvstate">https://simons-nzse-2.h-da.io/stream-tv/server/reference/#tvstate</a>
* Updates and returns the new state of the display.
* Reference at <a href="https://stream-server.h-da.io/reference#display">https://stream-server.h-da.io/reference#display</a>
*
* @param large_channel Sets the channel name of the large screen.
* This screen is the always visible main screen.
...
...
@@ -118,7 +118,7 @@ public class StreamTV {
* @param show_chat Sets whether the chat should be shown or not.
* Gets the most popular games on Twitch right now.
* Reference at <a href="https://simons-nzse-2.h-da.io/stream-tv/server/reference/#twitchgamestop">https://simons-nzse-2.h-da.io/stream-tv/server/reference/#twitchgamestop</a>
* Reference at <a href="https://stream-server.h-da.io/reference#twitchgettopgames">https://stream-server.h-da.io/reference#twitchgamestop</a>
* Reference at <a href="https://simons-nzse-2.h-da.io/stream-tv/server/reference/#twitchgamessearch">https://simons-nzse-2.h-da.io/stream-tv/server/reference/#twitchgamessearch</a>
* Reference at <a href="https://stream-server.h-da.io/reference#twitchsearchgames">https://stream-server.h-da.io/reference#twitchsearchgames</a>
* Gets the most popular streams on Twitch right now. Optionally filter by channels, game and language.
* Reference at <a href="https://simons-nzse-2.h-da.io/stream-tv/server/reference/#twitchstreamstop">https://simons-nzse-2.h-da.io/stream-tv/server/reference/#twitchstreamstop</a>
* Reference at <a href="https://stream-server.h-da.io/reference#twitchgettopstreams">https://stream-server.h-da.io/reference#twitchgettopstreams</a>
*
* @param channels Specify up to 100 channels separated by `,` that the search should be limited to.
* See the examples in the reference why that would be useful.
...
...
@@ -180,7 +180,7 @@ public class StreamTV {
*
* @param language Specify a language that the search should be limited to.
* Reference at <a href="https://simons-nzse-2.h-da.io/stream-tv/server/reference/#twitchstreamsfeatured">https://simons-nzse-2.h-da.io/stream-tv/server/reference/#twitchstreamsfeatured</a>
* Reference at <a href="https://stream-server.h-da.io/reference#twitchgetfeaturedstreams">https://stream-server.h-da.io/reference#twitchgetfeaturedstreams</a>
To upgrade the Stream TV Server to the latest version just replace the executable with the newest from [Downloads](/server/#download). There are no dependencies.
Stream TV is a project developed at Darmstadt University of Applied Sciences [h-da.de](https://h-da.de) for the User-Centric Software Development hands-on training. In the course the students develop an Android app that remote controls the Stream TV Server.
Stream Server is a project developed at Darmstadt University of Applied Sciences [h-da.de](https://h-da.de) for the User-Centric Software Development hands-on training. In the course the students develop an Android app that remote controls the Stream Server.
This server displays streams of the popular [Twitch.tv](https://twitch.tv) livestream platform on the student's target device (laptop, desktop, tv, smart device, etc.).
The apps can request the server via a simple HTTP API to query the Twitch API for content and to change the state of the display (e.g. control playback).
...
...
@@ -17,14 +17,11 @@ The goal was to
## Documentation layout
-**Project**
_What you are reading right now_ and [Changelog](changelog.md).
-**Server**
[Download and Run](server/index.md), [Options](server/options.md), [Quickstart](server/quickstart.md), [Reference](server/reference.md) and [Java integration](server/streamtv-java.md).
-**Stream Server**
_What you are reading right now_, [Download and Run](download-and-run.md), [Options](options.md), [Quickstart](quickstart.md), [Reference](reference.md) and [Android Integration](android-integration.md).
-**About**
[Contributing info (code layout, build and deploy instructions etc.)](about/contributing.md), [Author's notes](about/authors-notes.md), [Previous considerations](about/previous-considerations.md) and [License](about/license.md).
[Changelog](about/changelog.md), [Contributing info (code layout, build and deploy instructions etc.)](about/contributing.md), [Author's Notes](about/authors-notes.md), [Previous Considerations](about/previous-considerations.md) and [License](about/license.md).
--port value, -p value http port to listen on (default: 8080)
...
...
@@ -27,7 +27,7 @@ GLOBAL OPTIONS:
--version, -v print the version
```
By default stream-tv-server listens on all ip addresses on port 8080. This means that it is exposed to the local network (LAN / WLAN) which is needed if the app is on a phone. Note that the phone must be in the same network as the computer / laptop.
By default stream-server listens on all ip addresses on port 8080. This means that it is exposed to the local network (LAN / WLAN) which is needed if the app is on a phone. Note that the phone must be in the same network as the computer / laptop.
When using the Android Emulator on the same device as the server this exposure is not necessary. Use the `--local` flag to only listen on `127.0.0.1` aka `localhost`. The emulator must then connect to `10.0.2.2` as described here:
Read the documentation at https://simons-nzse-2.h-da.io/stream-tv/server/usage/ on how to use this server.
http://192.168.0.66:8080
Read the quickstart at https://stream-server.h-da.io/quickstart to get started.
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`.
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.66` in this case). Also we assume you use the default port `8080`.
1. Open <http://127.0.0.1:8080> in a browser. Leave this tab / window open while you do the other steps.
2. Get the current state of the tv:
2. Get the current state of the display:
``` md tab="Browser"
> http://127.0.0.1:8080/tv/state
```
``` java tab="StreamTV.java" linenums="1"
StreamTV streamTV = new StreamTV("10.0.2.2:8080");