Organize convenience functions
This commit is contained in:
parent
9a9a8bb2c9
commit
28fdc21a24
1 changed files with 7 additions and 7 deletions
14
mpv.py
14
mpv.py
|
|
@ -530,10 +530,6 @@ 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)
|
||||||
|
|
||||||
@property
|
|
||||||
def playlist_filenames(self):
|
|
||||||
return [element['filename'] for element in self.playlist]
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _encode_options(options):
|
def _encode_options(options):
|
||||||
return ','.join('{}={}'.format(str(key), str(val)) for key, val in options.items())
|
return ','.join('{}={}'.format(str(key), str(val)) for key, val in options.items())
|
||||||
|
|
@ -544,9 +540,6 @@ class MPV(object):
|
||||||
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)
|
||||||
|
|
||||||
def playlist_append(self, filename, **options):
|
|
||||||
self.loadfile(self, filename, 'append', **options)
|
|
||||||
|
|
||||||
def playlist_clear(self):
|
def playlist_clear(self):
|
||||||
self.command('playlist_clear')
|
self.command('playlist_clear')
|
||||||
|
|
||||||
|
|
@ -671,6 +664,13 @@ class MPV(object):
|
||||||
def play(self, filename):
|
def play(self, filename):
|
||||||
self.loadfile(filename)
|
self.loadfile(filename)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def playlist_filenames(self):
|
||||||
|
return [element['filename'] for element in self.playlist]
|
||||||
|
|
||||||
|
def playlist_append(self, filename, **options):
|
||||||
|
self.loadfile(filename, 'append', **options)
|
||||||
|
|
||||||
# Property accessors
|
# Property accessors
|
||||||
def _get_property(self, name, proptype=str, decode_str=False):
|
def _get_property(self, name, proptype=str, decode_str=False):
|
||||||
fmt = {int: MpvFormat.INT64,
|
fmt = {int: MpvFormat.INT64,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue