Make compatible with python-mpv 0.3
This commit is contained in:
parent
cee431495d
commit
7575707703
6
comp
6
comp
|
@ -109,7 +109,7 @@ class Comp(Omp):
|
||||||
add_status_str('/', x=13, X=14)
|
add_status_str('/', x=13, X=14)
|
||||||
add_status_str(self.mp.osd.duration or '00:00:00', x=15, X=23)
|
add_status_str(self.mp.osd.duration or '00:00:00', x=15, X=23)
|
||||||
add_status_str('|' if self.mp.pause else '>', x=24, X=25)
|
add_status_str('|' if self.mp.pause else '>', x=24, X=25)
|
||||||
add_status_str((self.mp.media_title or b'').decode(), x=26,
|
add_status_str(self.mp.media_title or '', x=26,
|
||||||
attr=curses.color_pair(12)|curses.A_BOLD)
|
attr=curses.color_pair(12)|curses.A_BOLD)
|
||||||
add_status_str(_(self.mode), x=-2-len(_(self.mode)))
|
add_status_str(_(self.mode), x=-2-len(_(self.mode)))
|
||||||
self.scr.refresh()
|
self.scr.refresh()
|
||||||
|
@ -199,7 +199,6 @@ class Comp(Omp):
|
||||||
def property_handler(self, name, val): self.update_status()
|
def property_handler(self, name, val): self.update_status()
|
||||||
|
|
||||||
def __init__(self, entries, json_file, mode, mpv_vid, mpv_vo, ytdlf):
|
def __init__(self, entries, json_file, mode, mpv_vid, mpv_vo, ytdlf):
|
||||||
Omp.__init__(self, entries, json_file, mode, mpv_vid, mpv_vo, ytdlf)
|
|
||||||
curses.noecho()
|
curses.noecho()
|
||||||
curses.cbreak()
|
curses.cbreak()
|
||||||
self.scr.keypad(True)
|
self.scr.keypad(True)
|
||||||
|
@ -209,6 +208,7 @@ class Comp(Omp):
|
||||||
for i in range(1, 8): curses.init_pair(i, i, -1)
|
for i in range(1, 8): curses.init_pair(i, i, -1)
|
||||||
curses.init_pair(8, -1, 7)
|
curses.init_pair(8, -1, 7)
|
||||||
for i in range(1, 7): curses.init_pair(i + 8, -1, i)
|
for i in range(1, 7): curses.init_pair(i + 8, -1, i)
|
||||||
|
Omp.__init__(self, entries, json_file, mode, mpv_vid, mpv_vo, ytdlf)
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
||||||
def __enter__(self): return self
|
def __enter__(self): return self
|
||||||
|
@ -369,7 +369,7 @@ with Comp(entries, json_file, mode, vid, vo, ytdlf) as comp:
|
||||||
comp.search()
|
comp.search()
|
||||||
elif c == 60: # <
|
elif c == 60: # <
|
||||||
try:
|
try:
|
||||||
if comp.mp._get_property('time-pos', float) < 1:
|
if comp.mp.time_pos < 1:
|
||||||
comp.next(backward=True)
|
comp.next(backward=True)
|
||||||
else:
|
else:
|
||||||
comp.seek(0, 'absolute')
|
comp.seek(0, 'absolute')
|
||||||
|
|
|
@ -74,8 +74,9 @@ class Omp(object):
|
||||||
if mpv_vo is not None: self.mp['vo'] = mpv_vo
|
if mpv_vo is not None: self.mp['vo'] = mpv_vo
|
||||||
@self.mp.property_observer('mute')
|
@self.mp.property_observer('mute')
|
||||||
@self.mp.property_observer('pause')
|
@self.mp.property_observer('pause')
|
||||||
@self.mp.property_observer('time-pos', force_fmt=MpvFormat.INT64)
|
@self.mp.property_observer('time-pos')
|
||||||
def observer(name, value): self.property_handler(name, value)
|
def observer(name, value): self.property_handler(name, value)
|
||||||
|
self.mp.register_key_binding('q', lambda state, key: None)
|
||||||
|
|
||||||
def __enter__(self): return self
|
def __enter__(self): return self
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ with open('README.rst') as f:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='comp',
|
name='comp',
|
||||||
version='0.3.11',
|
version='0.3.12',
|
||||||
description=('Curses Omni Media Player'),
|
description=('Curses Omni Media Player'),
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
url='https://github.com/McSinyx/comp',
|
url='https://github.com/McSinyx/comp',
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
"title": "David Banner - Play (Dirty version)"
|
"title": "David Banner - Play (Dirty version)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"duration": "00:00:00",
|
"duration": "00:03:55",
|
||||||
"error": false,
|
"error": false,
|
||||||
"filename": "https://youtu.be/NGLxoKOvzu4",
|
"filename": "https://youtu.be/NGLxoKOvzu4",
|
||||||
"playing": false,
|
"playing": false,
|
||||||
|
@ -184,7 +184,7 @@
|
||||||
"title": "Post Malone - Congratulations ft. Quavo"
|
"title": "Post Malone - Congratulations ft. Quavo"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"duration": "00:00:00",
|
"duration": "00:03:51",
|
||||||
"error": false,
|
"error": false,
|
||||||
"filename": "https://youtu.be/nfs8NYg7yQM",
|
"filename": "https://youtu.be/nfs8NYg7yQM",
|
||||||
"playing": false,
|
"playing": false,
|
||||||
|
@ -232,7 +232,7 @@
|
||||||
"title": "Sam Hunt - Body Like A Back Road (Audio)"
|
"title": "Sam Hunt - Body Like A Back Road (Audio)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"duration": "00:00:00",
|
"duration": "00:03:40",
|
||||||
"error": false,
|
"error": false,
|
||||||
"filename": "https://youtu.be/Fq0xEpRDL9Q",
|
"filename": "https://youtu.be/Fq0xEpRDL9Q",
|
||||||
"playing": false,
|
"playing": false,
|
||||||
|
@ -240,10 +240,10 @@
|
||||||
"title": "Chris Brown - Privacy (Explicit Version)"
|
"title": "Chris Brown - Privacy (Explicit Version)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"duration": "00:00:00",
|
"duration": "00:03:36",
|
||||||
"error": false,
|
"error": false,
|
||||||
"filename": "https://youtu.be/7wtfhZwyrcc",
|
"filename": "https://youtu.be/7wtfhZwyrcc",
|
||||||
"playing": false,
|
"playing": true,
|
||||||
"selected": false,
|
"selected": false,
|
||||||
"title": "Imagine Dragons - Believer"
|
"title": "Imagine Dragons - Believer"
|
||||||
},
|
},
|
||||||
|
@ -264,7 +264,7 @@
|
||||||
"title": "DNCE - Kissing Strangers ft. Nicki Minaj"
|
"title": "DNCE - Kissing Strangers ft. Nicki Minaj"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"duration": "00:00:00",
|
"duration": "00:03:18",
|
||||||
"error": false,
|
"error": false,
|
||||||
"filename": "https://youtu.be/AEB6ibtdPZc",
|
"filename": "https://youtu.be/AEB6ibtdPZc",
|
||||||
"playing": false,
|
"playing": false,
|
||||||
|
|
Loading…
Reference in a new issue