Giter VIP home page Giter VIP logo

aio-mpv-jsonipc's People

Contributors

marios8543 avatar tonycpsu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

tonycpsu

aio-mpv-jsonipc's Issues

Small usage example - command input

Hello,

I have tried to play around with this project but I didn't manage to input commands into mpv.
Could you help me figuring out how it works ?

I have this setup
MacOS 11.6.2
Python 3.8.5
aio_mpv_jsonipc cloned from master branch

And here is the snippet I ran

import asyncio
import logging

from aio_mpv_jsonipc import MPV

logging.basicConfig(level=logging.DEBUG)
mpv = MPV(mpv_path="mpv", media="https://www.youtube.com/watch?v=vl_AaCgudcY")


async def main():
    await mpv.start()
    print(await mpv.command("get_property", "speed"))


asyncio.run(main(), debug=True)

This successfully opened the url in MPV but the get-property command didn't seem to work
Here is the associated output

DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:asyncio:Using selector: KqueueSelector
DEBUG:asyncio:execute program 'mpv' stdout=-3 stderr=-3
DEBUG:asyncio:process 'mpv' created: pid 85573
INFO:asyncio:execute program 'mpv': <_UnixSubprocessTransport pid=85573 running>
DEBUG:aio_mpv_jsonipc.MPV:command: {"command": ["get_property", "property-list"], "request_id": 1}

^CDEBUG:asyncio:Close <_UnixSelectorEventLoop running=False closed=False debug=True>
Traceback (most recent call last):
  File "sdkdkjds.py", line 15, in <module>
    asyncio.run(main(), debug=True)
  File "/Users/Nassim/opt/anaconda3/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Users/Nassim/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 603, in run_until_complete
    self.run_forever()
  File "/Users/Nassim/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 570, in run_forever
    self._run_once()
  File "/Users/Nassim/opt/anaconda3/lib/python3.8/asyncio/base_events.py", line 1823, in _run_once
    event_list = self._selector.select(timeout)
  File "/Users/Nassim/opt/anaconda3/lib/python3.8/selectors.py", line 558, in select
    kev_list = self._selector.control(None, max_ev, timeout)
KeyboardInterrupt
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending name='Task-6' coro=<MPV.stop() running at /Users/Nassim/opt/anaconda3/lib/python3.8/site-packages/aio_mpv_jsonipc/MPV.py:311>>
/Users/Nassim/opt/anaconda3/lib/python3.8/asyncio/base_events.py:641: RuntimeWarning: coroutine 'MPV.stop' was never awaited
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending name='Task-4' coro=<MPV._event_dispatcher() running at /Users/Nassim/opt/anaconda3/lib/python3.8/site-packages/aio_mpv_jsonipc/MPV.py:102>>
ERROR:asyncio:Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<MPV._process_events() running at /Users/Nassim/opt/anaconda3/lib/python3.8/site-packages/aio_mpv_jsonipc/MPV.py:85>>
sys:1: RuntimeWarning: coroutine 'MPV._event_dispatcher' was never awaited
sys:1: RuntimeWarning: coroutine 'MPV._process_events' was never awaited

I tried to debug a little and it seems like the task _process_events is never entered but don't know why

Thanks in advance !

Additional functionality for property observers, key bindings, etc.

I've been using python-mpv-jsonipc for a project, but the use of threads is causing some interoperability problems with asyncio. This package came up in a search, and looks like a great start, but is missing some handy functionality found in that package, such as bind_property_observer and bind_key_press. These can obviously be done using raw commands, but I was wondering you had any interest in adding this kind of functionality, or would accept a PR to add it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.