Skip to main content

Python bindings for the libmpv library

Project description

A python wrapper for libmpv.

To use:

import sys
import mpv

def main(args):
    if len(args) != 1:
        print('pass a single media file as argument')
        return 1

    try:
        m = mpv.Context()
    except mpv.MPVError:
        print('failed creating context')
        return 1

    m.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]:
            break

if __name__ == '__main__':
    try:
        exit(main(sys.argv[1:]) or 0)
    except mpv.MPVError as e:
        print(str(e))
        exit(1)

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pympv-0.6.0.tar.gz (165.3 kB view details)

Uploaded Source

File details

Details for the file pympv-0.6.0.tar.gz.

File metadata

  • Download URL: pympv-0.6.0.tar.gz
  • Upload date:
  • Size: 165.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.6.6

File hashes

Hashes for pympv-0.6.0.tar.gz
Algorithm Hash digest
SHA256 e364ecc21bc9d438d2902d989767a2d00d70958466154dd9c6a1e395f0ea67b0
MD5 1137414fd8fce39126a46946c7e860d4
BLAKE2b-256 be6fba227d7626ca3611aa350d577f01940002e079d4ca9cad976a9313b0aa7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page