Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcan/pympv
https://github.com/marcan/pympv
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/marcan/pympv
- Owner: marcan
- License: gpl-3.0
- Fork: true (andre-d/pympv)
- Created: 2016-09-22T15:56:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-29T06:22:47.000Z (about 2 years ago)
- Last Synced: 2024-10-13T14:40:08.961Z (3 months ago)
- Language: Cython
- Size: 222 KB
- Stars: 17
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mpv - py - Another Python interface. (Other)
README
pympv
=====
A python wrapper for libmpv.#### Basic usage
```python
import sys
import mpvdef main(args):
if len(args) != 1:
print('pass a single media file as argument')
return 1try:
m = mpv.Context()
except mpv.MPVError:
print('failed creating context')
return 1m.set_option('input-default-bindings')
m.set_option('osc')
m.set_option('input-vo-keyboard')
m.initialize()m.command('loadfile', args[0])
while True:
event = m.wait_event(.01)
if event.id == mpv.Events.none:
continue
print(event.name)
if event.id in [mpv.Events.end_file, mpv.Events.shutdown]:
breakif __name__ == '__main__':
try:
exit(main(sys.argv[1:]) or 0)
except mpv.MPVError as e:
print(str(e))
exit(1)
```More examples can be found in the [samples](samples) directory.
libmpv is a client library for the media player mpv
For more info see: https://github.com/mpv-player/mpv/blob/master/libmpv/client.h
pympv was originally written by Andre D, and the PyPI package is maintained
by Hector Martin.