improve quickstart tutorial

This commit is contained in:
boyska 2022-01-30 14:38:43 +01:00
parent e8f97b8cae
commit 9d2db78c98

View file

@ -7,23 +7,16 @@ console.log(radio.getName())
```
Now we have `radio`, a {@link Radio} object, which can be seen as the "center" of our data. From here, we can
get more data. How about this?
```javascript
const show = radio.getShowAtTime()
if (show !== null) {
console.log(show.getName())
} else {
console.log("Nothing special going on right now, sorry")
}
```
get more data.
## Streaming
The first thing we could want to do is just to *play* the radio.
The first thing we could want to do is just to *play* the radio. Let's use the {@link RadioStreaming#pickURLs
RadioStreaming.pickURLs} method then
```javascript
var urls = await radio.pickURLs()
var streaming = radio.getStreaming()
var urls = await streaming.pickURLs()
console.log(urls)
```
@ -40,6 +33,20 @@ for more details.
var shows = radio.getShows()
console.log(shows.map(s => s.getName()))
```
## Schedule
```javascript
const show = radio.getShowAtTime()
if (show !== null) {
console.log(show.getName())
} else {
console.log("Nothing special going on right now, sorry")
}
```
{@link Radio#getShowAtTime getShowAtTime} is a shortcut, but using {@link Radio#getSchedule} you'll get a nice
{@link RadioSchedule}, which has many useful methods to get meaningful information about what's going on right
now and {@link RadioSchedule#getNextShow what will go on next}
## Conclusions