Skip to content

Commit

Permalink
Bugfix: ContextMenu.Play Format uri string if there is a duration pre…
Browse files Browse the repository at this point in the history
…sent. (#32)
  • Loading branch information
MarcelRoozekrans authored Jun 10, 2020
1 parent 7830d2d commit b0b33d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions resources/lib/modules/contextmenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,15 @@ def play(cls, program):
@classmethod
def _play(cls, uri, program):
"""Play the selected program with the specified URI."""
format_params = {}
if '{date}' in uri:
uri = uri.format(date=program.get('start').isoformat())
format_params.update({'date': program.get('start').isoformat()})

if '{duration}' in uri:
uri = uri.format(date=program.get('duration').isoformat())
format_params.update({'duration': program.get('duration')})

if format_params:
uri = uri.format(**format_params)

_LOGGER.debug('Executing "%s"', uri)
kodiutils.execute_builtin('PlayMedia', uri)
Expand Down

0 comments on commit b0b33d5

Please sign in to comment.