developer-guide.md 6.41 KB
Newer Older
1
# Aura Engine Development Guide
David Trattnig's avatar
David Trattnig committed
2
3
4

This page gives insights on extending Aura Engine internals or through the API.

David Trattnig's avatar
David Trattnig committed
5
<!-- TOC -->
David Trattnig's avatar
David Trattnig committed
6

7
- [Aura Engine Development Guide](#aura-engine-development-guide)
David Trattnig's avatar
David Trattnig committed
8
    - [AURA Componentes](#aura-componentes)
David Trattnig's avatar
David Trattnig committed
9
    - [Engine Components](#engine-components)
10
    - [API](#api)
11
12
    - [Scheduler](#scheduler)
    - [Docker](#docker)
13
    - [Read more](#read-more)
David Trattnig's avatar
David Trattnig committed
14
15
16

<!-- /TOC -->

David Trattnig's avatar
David Trattnig committed
17
## AURA Componentes
David Trattnig's avatar
David Trattnig committed
18

19
AURA Engine as part of the AURA Radio Suite uses an modulear architecture based on a REST API. All external information is retrieved using JSON data-structures.
David Trattnig's avatar
David Trattnig committed
20
21
22

To get the basic architectural overview, visit the [Aura Meta](https://gitlab.servus.at/autoradio/meta) repository.

David Trattnig's avatar
David Trattnig committed
23
24
25
26
27
28
Starting development of engine can be quite tedious, as it requires all most all other AURA components to be up and running.

For example:

    - Steering, to get the main incredient of an play-out engine: schedules (or "timeslots" in Steering terms), 
      which hold the actual information on playlists and their entries.
29
    - Dashboard, to have a neat interface, being able to programm the timeslots
David Trattnig's avatar
David Trattnig committed
30
31
32
33
    - Tank, to get the references to audio files and other audio sources. Plus the actual files.

If you need to test and develop against the Engine's API you'll also need to get the `engine-api` project running.

34
For a start it's recommended to create a general `aura` project folder. In there you start cloning all the sub-projects. After having all the sub-projects configured, and verified that they are working, take a look at the AURA `meta` project.
David Trattnig's avatar
David Trattnig committed
35
36
37
38
39
40
41

There's a convenience script to start all of the three main dependencies (Steering, Dashboard, Tank) all at once:

```bash
    ~/code/aura/meta$ ./run.sh aura local
```

David Trattnig's avatar
David Trattnig committed
42
## Engine Components
43
44


45
*...TBD...*
46
47
48

## API

David Trattnig's avatar
David Trattnig committed
49
You can find the AURA API definition here: https://gitlab.servus.at/autoradio/meta/blob/master/api-definition.md
David Trattnig's avatar
David Trattnig committed
50

David Trattnig's avatar
David Trattnig committed
51
OpenAPI definition for Engine API: https://app.swaggerhub.com/apis/AURA-Engine/engine-api/
David Trattnig's avatar
David Trattnig committed
52

53
## Scheduler
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

Scheduling is split into multiple phases. Below you see a timeline with one timeslot planned at a certain
point in time and the involved phase before:

```ascii
========================================= [                  Scheduling Window               ] ===========
=======================================================  [        Timeslot Play-out                 ] ====

== (FILESYSTEM A) ========================== [ Preload ] [  Play 4  ] ====================================
== (STREAM A) ========================================== [ Preload ] [ Play 1 ] ==========================
== (LIVE 1) ====================================================== [ Preload ] [ Play 1 ] ================
== (FILESYSTEM B) ========================================================== [ Preload ] [  Play 4  ] ====
```

- **Scheduling Window**: Within the scheduling window any commands for controlling
    the mixer of the soundsystem are prepared and queued.

    Only until the start of the window, timeslots can be updated or removed via external API Endpoints
    (e.g. using Steering or Dashboard). Until here any changes on the timeslot itself will be reflected
    in the actual play-out. This only affects the start and end time of the "timeslot" itself.
    It does not involve related playlists and their entries. Those can still be modified after the
    scheduling window has started.

    The start and the end of the window is defined by the start of the timeslot minus
    a configured amount of seconds (see `scheduling_window_start` and `scheduling_window_end`
    in `engine.ini`). The actual start of the window is calcuated by (timeslot start - window start)
    and the end by (timeslot end - window end)

    During the scheduling window, the external API Endpoints are pulled continiously, to
    check for updated timeslots and related playlists. Also, any changes to playlists and
    its entries are respected within that window (see `fetching_frequency` in `engine.ini`).

    > Important: It's vital that the the scheduling window is wider than the fetching frequency.
    Otherwise one fetch might never hit a scheduling window, hence not being able to schedule stuff.

    > Note: If you delete any existing timeslot in Dashboard/Steering this is only reflected in Engine until the start
    of the scheduling window. The scheduling window is defined by the start of the timeslot minus a configured offset
    in seconds. This is limitation is required to avoid corrupted playout in case audio content has been
    preloaded or started playing already.

- **Queuing and Pre-Loading**: Before any playlist entries of the timeslot can be turned into
    sound, they need to be queued and pre-loaded. Ideally the pre-loading happens somewhat before
    the scheduled play-out time to avoid any delays in timing. Set the maximum time reserved for
    pre-loading in your configuration (compare `preload_offset`in `engine.ini`).

    If there is not enough time to reserve the given amount of time for preloading (i.e. some entry
    should have started in the past already) the offset is ignored and the entry is played as soon as possible.

    > Important: To ensure proper timings, the offset should not exceed the time between the start of
    the scheduling-window and the start of the actual timeslot playout. Practically, of course there
    are scenario where playout start later than planned e.g. during startup of the engine during a timeslot
    or due to some severe connectivity issues to some external stream.

- **Play-out**: Finally the actual play-out is happening. The faders of the virtual mixers are pushed
    all the way up, as soon it's "time to play" for one of the pre-loaded entries.
    Transitions between playlist entries with different types of sources (file, stream and analog
    inputs) are performed automatically. At the end of each timeslot the channel is faded-out,
    no matter if the total length of the playlist entries would require a longer timeslot.

    If for some reason the playout is corrupted, stopped or too silent to make any sense, then
    this <u>triggers a fallback using the silence detector</u>.


117
## Docker
118

119
Build your own, local Docker image
120

121
122
```shell
./run.sh docker:build
David Trattnig's avatar
David Trattnig committed
123
124
```

125
Releasing a new version to DockerHub
David Trattnig's avatar
David Trattnig committed
126

127
128
```shell
./run.sh docker:push
David Trattnig's avatar
David Trattnig committed
129
130
```

131
132
## Read more

133
134
135
- [Bare Metal Installation](docs/bare-metal-installation.md)
- [Developer Guide](docs/developer-guide.md)
- [Setting up the Audio Store [meta]](https://gitlab.servus.at/aura/meta/-/blob/master/docs/setup-audio-store.md)