Pimp loadfile to accept per-file options
This commit is contained in:
parent
669c4bbfec
commit
1ee4361bdd
2 changed files with 7 additions and 3 deletions
|
|
@ -197,7 +197,7 @@ class TestLifecycle(unittest.TestCase):
|
||||||
m.wait_for_playback()
|
m.wait_for_playback()
|
||||||
del m
|
del m
|
||||||
handler.assert_has_calls([
|
handler.assert_has_calls([
|
||||||
mock.call('info', 'cplayer', 'Playing: ./test.webm'),
|
mock.call('info', 'cplayer', 'Playing: test.webm'),
|
||||||
mock.call('info', 'cplayer', ' Video --vid=1 (*) (vp8)'),
|
mock.call('info', 'cplayer', ' Video --vid=1 (*) (vp8)'),
|
||||||
mock.call('fatal', 'cplayer', 'No video or audio streams selected.')])
|
mock.call('fatal', 'cplayer', 'No video or audio streams selected.')])
|
||||||
|
|
||||||
|
|
|
||||||
8
mpv.py
8
mpv.py
|
|
@ -495,8 +495,12 @@ class MPV(object):
|
||||||
def playlist_prev(self, mode='weak'):
|
def playlist_prev(self, mode='weak'):
|
||||||
self.command('playlist_prev', mode)
|
self.command('playlist_prev', mode)
|
||||||
|
|
||||||
def loadfile(self, filename, mode='replace'):
|
@staticmethod
|
||||||
self.command('loadfile', filename.encode(fs_enc), mode)
|
def _encode_options(options):
|
||||||
|
return ','.join('{}={}'.format(str(key), str(val)) for key, val in options.items())
|
||||||
|
|
||||||
|
def loadfile(self, filename, mode='replace', **options):
|
||||||
|
self.command('loadfile', filename.encode(fs_enc), mode, MPV._encode_options(options))
|
||||||
|
|
||||||
def loadlist(self, playlist, mode='replace'):
|
def loadlist(self, playlist, mode='replace'):
|
||||||
self.command('loadlist', playlist.encode(fs_enc), mode)
|
self.command('loadlist', playlist.encode(fs_enc), mode)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue