DEV Community

Jonas Birmé for Consuo Dev Blog

Posted on

Using the in-built Auto Scheduler

The quickest way to get started and creating a virtual channel is to use the in-built auto-scheduler. In this blog post we will walk you through how this is done.

In the Consuo Schedule micro service, an automatic scheduler is included that can automatically add events to a channel's schedule. The assets for the events are randomly chosen and four events at the time are added back-to-back in the schedule. This can be used to create numerous virtual channel based on a search query in the VOD library. For example a virtual channel for all news clips about a news event that is unfolding.

Using auto-scheduler

When creating a new channel you define that this channel should use the automatic scheduler and you provide an URI to an Atom RSS feed containing the assets the automatic scheduler can choose from. Between your video asset search you build an adapter that translates the response into an Atom RSS xml. The mandatory fields are <id> and <link> but a title is recommended to also be provided.

<feed xmlns="">
  <title>Content from Eyevinn</title>
    <title>Tears of Steel</title>
Enter fullscreen mode Exit fullscreen mode

To create a channel with automatic scheduling enabled you issue an HTTP POST with the following JSON to the /channels endpoint.

  "id": "mychannel",
  "name": "My Automatic Channel",
  "config": {
    "auto_populate": true,
    "auto_populate_content": <RSS_URI>,   
    "auto_cleanup": true
Enter fullscreen mode Exit fullscreen mode

The config parameter auto_populate when set to true enables the automatic scheduler and the auto_populate_content parameter points to the RSS feed.

To verify that the automatic scheduler is working you can fetch the schedule for this channel with an HTTP GET of /channels/mychannel/schedule and you would get something similar to this:

    "channelId": "eyevinn",
    "assetId": "urn:uuid:da80b21b-2e6e-42ae-82b8-3b1b5581b59a",
    "eventId": "735fecc8-cade-410d-993f-9860e4de9efe",
    "id": "urn:uuid:da80b21b-2e6e-42ae-82b8-3b1b5581b59a",
    "title": "TV Plus Joachim",
    "start_time": 1590226668810,
    "end_time": 1590226741810,
    "start": "2020-05-23T09:37:48.810Z",
    "end": "2020-05-23T09:39:01.810Z",
    "uri": "",
    "duration": 73
    "channelId": "eyevinn",
    "assetId": "urn:uuid:b8ff551a-6da3-485a-8a53-b11c5d28753f",
    "eventId": "c25f531a-3bf5-4645-b3f0-cbaf4c7f459d",
    "id": "urn:uuid:b8ff551a-6da3-485a-8a53-b11c5d28753f",
    "title": "TV Plus Johanna",
    "start_time": 1590226741810,
    "end_time": 1590226816810,
    "start": "2020-05-23T09:39:01.810Z",
    "end": "2020-05-23T09:40:16.810Z",
    "uri": "",
    "duration": 75
Enter fullscreen mode Exit fullscreen mode

As you see in the example above the schedule events are all back-to-back and that is taken care of by the automatic scheduler.

The config parameter auto_cleanup specifies whether old events should be automatically removed.

This automatic scheduler is at the moment very basic and does not prevent that same assets in a row are scheduled and if you intend more sophisticated logic you can build your own automatic scheduler using the APIs provided.

And how to do that, we leave room for in another blog post. Stay tune!

Top comments (0)