Skip to content

Commit

Permalink
Add a way to change VLC command-line options + include luaintf as a d…
Browse files Browse the repository at this point in the history
…efault extraintf
  • Loading branch information
EugeneDae committed Sep 19, 2018
1 parent a055ba4 commit e57a775
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/vlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ async def launch(self):

command = [
self.config['path'],
'--extraintf', 'http',
'--extraintf', self.config['extraintf'],
'--http-host', self.config['host'],
'--http-port', str(self.config['port']),
'--http-password', str(self.config['password']),
'--repeat', '--image-duration', '-1'
]
] + self.config['options']

kwargs = {}

Expand Down Expand Up @@ -102,16 +102,21 @@ def _command(self, command, params={}):
# https://forum.videolan.org/viewtopic.php?f=16&t=145695
params = ('command=' + command + '&' +
'&'.join('%s=%s' % (k, v) for k, v in params.items()))

return self._request('requests/status.xml', params=params)

def _format_uri(self, uri):
# VLC only understands urlencoded =
return uri.replace('=', '%3D')

def status(self):
return self._request('requests/status.json').json()

def add(self, uri):
return self._command('in_play', {'input': uri})
return self._command('in_play', {'input': self._format_uri(uri)})

def enqueue(self, uri):
return self._command('in_enqueue', {'input': uri})
return self._command('in_enqueue', {'input': self._format_uri(uri)})

def play(self, uid=None):
if uid:
Expand Down

0 comments on commit e57a775

Please sign in to comment.