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.
  • Loading branch information
MarcelRoozekrans committed Jun 9, 2020
1 parent c90798b commit 6d4f9d7
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 6d4f9d7

Please sign in to comment.