Skip to content

Automation

Dag Wieers edited this page Oct 31, 2020 · 30 revisions

De Nederlandse vertaling is beschikbaar via Automatisatie.

Starting the VRT NU add-on on Kodi startup

You can make Kodi perform actions on startup by creating an autoexec.py file in your Kodi userdata directory.

On a typical Linux system this path would be:

  • ~/.kodi/userdata/autoexec.py

On a typical Windows system this path would be:

  • C:\Users\your-user\AppData\Roaming\Kodi\userdata\autoexec.py
  • %AppData%\Roaming\Kodi\userdata\autoexec.py

Add the statements below to this autoexec.py file.

import xbmc
xbmc.executebuiltin('RunAddon(plugin.video.vrt.nu)')

Starting within a menu

You can also go directly inside one of the menus, by specifying an action:

import xbmc
xbmc.executebuiltin('RunAddon(plugin.video.vrt.nu,/livetv)')

Start playing live TV

If you would rather like to start playing a specific Live TV stream, you can use:

import xbmc
xbmc.executebuiltin('PlayMedia(plugin://plugin.video.vrt.nu/play/id/vualto_een_geo)')

Jumping to a specific menu (JSON-RPC)

If you like to jump to a specific menu remotely, you can use JSON-RPC for running a menu. There are two calls that can be used for this, Addons.ExecuteAddon or GUI.ActivateWindow.

Using Addons.ExecuteAddon:

{
    "jsonrpc": "2.0",
    "method": "Addons.ExecuteAddon",
    "params": {
        "addonid": "plugin.video.vrt.nu",
        "params": ["/programs/tik-tak/2019/"]
    },
    "id": 1
}

Or when using curl:

$ curl -X POST -H "content-type:application/json" http://kodi01:8080/jsonrpc -d '{"jsonrpc": "2.0", "method": "Addons.ExecuteAddon", "params": {"addonid": "plugin.video.vrt.nu", "params": ["/programs/tik-tak/2019/"] }, "id": 1}'

Using GUI.ActivateWindow:

{
    "jsonrpc": "2.0",
    "method": "GUI.ActivateWindow",
    "params": {
        "window": "videos",
        "parameters": ["plugin://plugin.video.vrt.nu/programs/tik-tak/allseasons"]
    },
    "id": 1
}

Or when using curl:

$ curl -X POST -H "content-type:application/json" http://kodi01:8080/jsonrpc -d '{"jsonrpc": "2.0", "method": "GUI.ActivateWindow", "params": {"window": "videos", "parameters": [ "plugin://plugin.video.vrt.nu/programs/tik-tak/allseasons" ]}, "id": 1}'

Playing the latest episode of a tv show (JSON-RPC)

We implemented a function that plays the latest episode of a tv show or program. You can call this function through the Kodi JSON-RPC API

Using JSON-RPC the payload would be:

{
    "jsonrpc": "2.0",
    "method": "Player.Open",
    "params": {
        "item": {
            "file": "plugin://plugin.video.vrt.nu/play/latest/het-journaal"
        }
    },
    "id": 1
}

For instance with curl:

$ curl -X POST -H "content-type:application/json" http://localhost:8080/jsonrpc -d '{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"file": "plugin://plugin.video.vrt.nu/play/latest/het-journaal" }}, "id": 1}'

You can call this method with every tv show on VRT NU. You can find tv show names in the VRT NU URLs. For instance:

The tvshow name is the part right after /a-z/, in this case de-columbus

Playing a program by channel and airdate (JSON-RPC)

You can also play a program by providing the channel and date/time it was aired. You can just provide a channel with a start date/time and the program that matches best is returned. Providing a stop date/time is optional.

  • timestamp format: ISO 8601 Notation yyyy-mm-ddThh:mm:ss (example: 2019-09-29T11:00:00)
  • channels: een, canvas, ketnet

Using JSON-RPC the payload would become:

{
    "jsonrpc": "2.0",
    "method": "Player.Open",
    "params": {
        "item": {
            "file": "plugin://plugin.video.vrt.nu/play/airdate/een/2019-09-29T11:00:00"
        }
    },
    "id": 1
}

For instance with curl:

$ curl -X POST -H "content-type:application/json" http://localhost:8080/jsonrpc -d '{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"file": "plugin://plugin.video.vrt.nu/play/airdate/een/2019-09-29T11:00:00" }}, "id": "1"}'

Plugin API

The different actions are found in the main plugin entry source code: https://github.com/add-ons/plugin.video.vrt.nu/blob/master/resources/lib/addon.py

Possible actions include:

This API is included in v2.0.0

Interface Action Added/Removed
Main menu /
My programs /favorites
My A-Z /favorites/programs
My recently added /favorites/recent
My recently added (by page) /favorites/recent/<page>
My soon offline /favorites/offline
My soon offline (by page) /favorites/offline/<page>
My documentaries /favorites/docu
Refresh favorites /favorites/refresh
Continue watching /resumepoints/continue Added in v2.3.0
Watch later /resumepoints/watchlater Added in v2.3.0
Refresh resumepoints /resumepoints/refresh Added in v2.3.0
A-Z /programs
Episodes/Seasons listing /programs/<program>
Season listing /programs/<program>/<season>
All seasons listings /programs/<program>/allseasons
Categories /categories
Category tv-show listing /categories/<category>
Channels /channels
Channel tv-show listing /channels/<channel>
Live TV /livetv
Play Canvas live TV /play/id/vualto_canvas_geo
Recently added /recent
Recently added (by page) /recent/<page>
Soon offline /offline
Soon offline (by page) /offline/<page>
Featured content /featured
Feature content by feature /featured/<feature>
TV guide /tvguide Added in v2.2.0
Date menu /tvguide/channel Added in v2.2.0
Date menu by channel /tvguide/channel/<channel> Added in v2.2.0
Program listing /tvguide/channel/<channel>/<date> Added in v2.2.0
Channel menu /tvguide/date Added in v2.2.0
Channel menu by date /tvguide/date/<date> Added in v2.2.0
Today's TV guide /tvguide/date/today Added in v2.2.0
Program listing /tvguide/date/<date>/<channel> Added in v2.2.0
Tomorrow's Canvas TV guide /tvguide/date/tomorrow/canvas Added in v2.2.0
Search /search
Enter search keywords /search/query
Search results /search/query/<keywords>
Search results (by page) /search/query/<keywords>/<page>
Add search keyword /search/add/<keywords> Added in v2.2.0
Remove search keyword /search/remove/<keywords> Added in v2.2.0
Clear search history /search/clear
Play actions
Play a video by video_id /play/id/<video_id>
Play a video by pub_id /play/id/<video_id>/<publication_id>
Play a video by URL /play/url/<video_url>
Play the latest episode /play/latest/<program>
Play a video by airdate /play/airdate/<channel>/<start> Added in v2.1.0
Play a video by airdate /play/airdate/<channel>/<start>/<stop> Added in v2.1.0
Other actions
Delete cache /cache/delete
Delete cache by file /cache/delete/<file>
Delete tokens /tokens/delete
Install Widevine /widevine/install Removed in v2.2.2
Follow program /follow/<program>/<title>
Unfollow program /unfollow/<program>/<title>
Watch later episode /watchlater/<url>/<uuid>/<title> Added in v2.3.0
Unwatch later episode /unwatchlater/<url>/<uuid>/<title> Added in v2.3.0

Related information