Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for opengl-cb API, setup updates, misc. #7

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
739624f
Remove enum values
marcan Sep 22, 2016
91fe73b
Fix support for UTF-8 strings in python2
marcan Sep 22, 2016
ff5ace1
Add support for the opengl-cb API
marcan Sep 22, 2016
060fb30
Better setup file.
Nov 14, 2016
6043127
Add .gitignore
marcan Dec 12, 2016
82c735f
Bump version to v0.4.0
marcan Dec 12, 2016
4c7da26
Update changelog for v0.4.0
marcan Dec 12, 2016
06c8ebc
Improve package metadata
marcan Dec 12, 2016
32380ba
Update .gitignore for setuptools stuff
marcan Dec 12, 2016
2a5401b
Bump to v0.4.1
marcan Dec 12, 2016
d10c048
Add authorship info to README
marcan Dec 12, 2016
07f27d1
Rename async -> asynchronous for python 3.7 compat.
marcan Sep 2, 2018
b1674c5
setup.py: Force Cython rebuilds if Cython is installed
marcan Sep 2, 2018
cc6c70a
Bump to 0.5.1
marcan Sep 2, 2018
cbc7193
Version 0.6.0: Add support for the render API and deprecate opengl-cb
marcan Sep 4, 2018
a258e69
Update CHANGELOG.md
marcan Sep 4, 2018
8055feb
Deploy pympv on Windows and automate pypi uploads
Luni-4 Jun 30, 2020
ca6721b
Add syntax highlighting on usage sample
Jan 2, 2020
7256f64
Add PyGObject usage sample
Jan 2, 2020
e10c640
Extract examples into its own directory
Jun 19, 2020
6099c67
deploy: add branch to deploy to TestPyPi
marcan Jun 30, 2020
6b32a83
setup.py: Don't break pypi builds when Cython is installed
marcan Jun 22, 2022
5afae99
Bump to v0.7.1
marcan Jun 22, 2022
fc41055
deploy.yml: Fix Windows action
marcan Jun 22, 2022
a680e85
Simplify string conversions, since python2 is no more
linkmauve Nov 26, 2020
86ed671
Give str its Python 3 meaning
linkmauve Nov 26, 2020
8fe1a91
Optimise string conversion functions with Cython
linkmauve Nov 26, 2020
2035943
Add a note to remove PyEval_InitThreads() after 3.6 is EOL
linkmauve Nov 26, 2020
2044419
Actually type the two dicts
linkmauve Nov 26, 2020
449f0c7
setup.py: Bump to 0.8.0
marcan Jun 22, 2022
dc2f2f0
Update to libmpv API 2.0
mia-0 Dec 14, 2022
a971cf4
Update CHANGELOG.md
mia-0 Dec 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: deploy

on:
push:
tags:
- 'v*.*.*'
branches:
- 'publish-test'

jobs:

create-windows-wheel:

runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Download libmpv
run: |
$VERSION = "libmpv/mpv-dev-x86_64-20200524-git-685bd6a.7z"
$URL = "https://sourceforge.net/projects/mpv-player-windows/files"
curl -L -o libmpv.7z "$URL/$VERSION"
7z x libmpv.7z

- name: Set VS environment variables
run: |
$VsPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer"
echo "$VsPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Set MSVC x86_64 linker path
run: |
$LinkGlob = "VC\Tools\MSVC\*\bin\Hostx64\x64"
$LinkPath = vswhere -latest -products * -find "$LinkGlob" |
Select-Object -Last 1
echo "$LinkPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Create the libmpv zip
shell: cmd
run: |
lib /def:mpv.def /machine:x64 /out:mpv.lib
ren mpv-1.dll mpv.dll
ren include mpv
7z a libmpv.zip mpv/ mpv.dll mpv.lib

- name: Install Python 3.7 version
uses: actions/setup-python@v1
with:
python-version: '3.7'
architecture: 'x64'

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install --upgrade cython

- name: Create Python wheel
run: |
python setup.py bdist_wheel --plat-name win_amd64 --python-tag cp37

- name: Upload Windows wheel
uses: actions/upload-artifact@v2
with:
name: dist
path: dist

deploy-binaries:

needs: create-windows-wheel

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Download Windows wheel
uses: actions/download-artifact@v2

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools twine
pip install --upgrade cython

- name: Release source code
run: |
python setup.py sdist

- name: Twine check
run: |
python -m twine check dist/*

- name: Publish distribution to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_token }}

- name: Publish distribution to TestPyPI
if: github.event_name == 'push' && github.ref == 'refs/heads/publish-test'
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.testpypi_token }}
repository_url: https://test.pypi.org/legacy/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
pympv.egg-info
dist
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
pympv
=====

## 0.8.0
- Update to libmpv API 2.0, removing previously deprecated APIs
- Optimise string conversion functions with Cython
- Give str its Python 3 meaning
- Simplify string conversions, since python2 is no more

## 0.7.1
- Extract examples into its own directory

## 0.6.0
- Add support for the render API
- Deprecate the legacy opengl-cb API

## 0.5.1
- Rename async -> asynchronous for Python 3.7 compatibility
- Force Cython rebuilds if Cython is installed

## 0.4.1

- Prepare packaging for PyPI

## 0.4.0
- Fix string support in Python2
- Add opengl-cb support
- Improve packaging/setup.py

## 0.3.0

- Fix various failures of data and callbacks
Expand Down
81 changes: 44 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,51 @@ pympv
=====
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)
#### Basic usage
```python
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)
```

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.
Loading