I would like to create a view for my kid, where he is presented with a selection of movies he can choose from and play via KoDi.
For this, I am missing one key ingredient:
How can I play a specific movie from my KoDi library? I would need to know if and where I can find a kodi movie ID which command I need to use to play it.
And I actually did find an easier method, by using the HASS kodi call method as script for each movie. So you don’t have to write the RESTful command, but only a script entry for each movie:
movie_xy:
alias: Play Movie XY
sequence:
- service: media_player.kodi_call_method
data:
entity_id: media_player.kodi
method: Player.Open
item:
file: "smb://YOURFILESHAREIP/PATH/FILENAME"
the only caveat with this approach, though, is that you must add the kodi component to the config yaml, whereas the RESTful command, directly would communicate with kodi.
I know this thread is getting old, but I’m trying to take this idea a bit further. I would like to be able to say to my Google Home “Tell Kodi to play XYZ” and this will cause Kodi to play that movie. So far I have two scripts, one that searches for a movie with a given string and returns a single result with the movieid from the database, and another that plays a movie given a specified movieid. These two scripts work perfectly. The issue happens when I try to use an automation to run the second script based on event data from the first script. As far as I can tell the issue is that the template is returning a string instead of an integer but I’ve tried changing it to an integer and it doesn’t help. See relevant code below.
The two scripts
'1593263499843':
alias: Kodi Get Movie
sequence:
- data:
entity_id: media_player.living_room_tv
filter:
field: title
operator: contains
value: minions
limits:
end: 1
start: 0
method: VideoLibrary.GetMovies
service: kodi.call_method
'1593279336491':
alias: Kodi Play Movie
sequence:
- data_template:
entity_id: media_player.living_room_tv
item:
movieid: '{{ movieid|int}}'
method: player.open
service: kodi.call_method
i got @noogs approach to work by returning the file path from the search and modifying the Player.Open call accordingly (maybe there’s a more elegant version out there but this works):
Here is the final get movie script (notice the properties: object )
'1593263499843':
alias: Kodi Get Movie
sequence:
- data:
entity_id: media_player.living_room_tv
filter:
field: title
operator: contains
value: minions
limits:
end: 1
start: 0
properties:
- file
method: VideoLibrary.GetMovies
service: kodi.call_method
the automation just passes the path to the script: