Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 531b46f

Browse files
committed
updated docs and tests
1 parent 302f3b9 commit 531b46f

File tree

5 files changed

+62
-43
lines changed

5 files changed

+62
-43
lines changed

.github/workflows/test_n_pub.yml

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,9 @@ jobs:
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
16-
python-version: [3.7, 3.8, 3.9, "3.10"]
17-
os: [ubuntu-latest, macos-latest, windows-latest]
18-
# python-version: [3.7, 3.8, 3.9]
19-
# os: [windows-latest]
20-
exclude:
21-
- os: macos-latest
22-
python-version: 3.7
23-
- os: windows-latest
24-
python-version: 3.7
25-
- os: macos-latest
26-
python-version: 3.8
27-
- os: windows-latest
28-
python-version: 3.8
29-
- os: macos-latest
30-
python-version: 3.9
31-
- os: windows-latest
32-
python-version: 3.9
16+
python-version: ["3.10"]
17+
os: [macos-latest, windows-latest]
18+
# os: [ubuntu-latest, macos-latest, windows-latest]
3319

3420
steps:
3521
- run: echo ${{github.ref}}
@@ -44,11 +30,13 @@ jobs:
4430

4531
- name: Setup Python dependencies
4632
run: |
47-
python -m pip install -U pip
48-
pip install -U build pytest pytest-github-actions-annotate-failures
33+
python -m pip install -U pip setuptools wheel
34+
pip install -r requirements.txt
4935
50-
- name: Install ffmpegio-plugin-static-ffmpeg package
51-
run: pip install -q .
36+
- name: Install ffmpegio-plugin-downloader package
37+
run: |
38+
pip install -q .
39+
pip list
5240
5341
- name: Run tests
5442
run: pytest -vv
@@ -68,8 +56,7 @@ jobs:
6856

6957
- name: Setup Python dependencies
7058
run: |
71-
python -m pip install -U pip setuptools
72-
pip install -U build
59+
python -m pip install -U pip setuptools wheel build
7360
7461
- name: Build a binary wheel and a source tarball
7562
run: python -m build --sdist --wheel --outdir dist/ .
@@ -89,6 +76,9 @@ jobs:
8976
# skip_existing: true
9077

9178
- name: Publish distribution 📦 to PyPI
79+
env:
80+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
81+
if: env.PYPI_API_TOKEN != null
9282
uses: pypa/gh-action-pypi-publish@master
9383
with:
9484
password: ${{ secrets.PYPI_API_TOKEN }}

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.rst

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
`ffmpegio-plugin-plugin-static-ffmpeg`: A Python `ffmpegio` plugin to use FFmpeg binaries in `static-ffmpeg` package
2-
====================================================================================================================
1+
`ffmpegio-plugin-static-ffmpeg`: A Python `ffmpegio` plugin to use FFmpeg binaries in `static-ffmpeg` package
2+
=============================================================================================================
33

44
|pypi| |pypi-status| |pypi-pyvers| |github-license| |github-status|
55

@@ -14,16 +14,37 @@
1414
.. |github-status| image:: https://img.shields.io/github/workflow/status/python-ffmpegio/python-ffmpegio-plugin-static-ffmpeg/Run%20Tests
1515
:alt: GitHub Workflow Status
1616

17-
Python `ffmpegio` package aims to bring the full capability of `FFmpeg <https://ffmpeg.org>`__
18-
to read, write, and manipulate multimedia data to Python. FFmpeg is an open-source cross-platform
19-
multimedia framework, which can handle most of the multimedia formats available today.
17+
`Python ffmpegio <https://python-ffmpegio.github.io/python-ffmpegio/>`__ package aims to bring
18+
the full capability of `FFmpeg <https://ffmpeg.org>`__ to read, write, and manipulate multimedia
19+
data to Python. FFmpeg is an open-source cross-platform multimedia framework, which can handle
20+
most of the multimedia formats available today.
2021

21-
`ffmpegio-plugin-static-ffmpeg` adds a capability to use the FFmpeg and FFprobe executable
22-
distributed in `static-ffmpeg` Python package.
22+
One caveat of FFmpeg is that there is no official program installer for Windows and MacOS (although
23+
`homebrew` could be used for the latter). `ffmpegio-plugin-static-ffmpeg` enables the `ffmpegio` package to
24+
use the build of FFmpeg distributed by the `static-ffmpeg <https://github.com/zackees/static_ffmpeg>`__
25+
package.
2326

24-
To use the plugin, it just needs to be installed via `pip`, and `ffmpegio` will automatically detect
25-
the paths to FFmpeg and FFprobe when it is imported in a Python script.
27+
Use
28+
===
29+
30+
Simply install the package:
2631

2732
.. code-block:: bash
2833
29-
pip install ffmpegio-plugin-static-ffmpeg
34+
pip install ffmpegio-core ffmpegio-plugin-static-ffmpeg
35+
36+
Then `ffmpegio` will auto-detect the plugin and `static-ffmpeg`'s executables:
37+
38+
.. code-block:: python
39+
40+
import ffmpegio
41+
42+
print(ffmpegio.path.FFMPEG_BIN) # ...\site-packages\static_ffmpeg\bin\win32\ffmpeg.exe
43+
print(ffmpegio.path.FFPROBE_BIN) # ...\site-packages\static_ffmpeg\bin\win32\ffprobe.exe
44+
45+
Because the `static-ffmpeg` package downloads its binaries on demand, the first
46+
time importing `ffmpegio` with this plugin enabled may take a while.
47+
48+
.. note::
49+
`ffmpegio-plugin-static-ffmpeg` will *not* be activated if `ffmpeg` and `ffprobe` are
50+
already available on the system PATH.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[metadata]
22
name = ffmpegio-plugin-static-ffmpeg
33
version = attr: ffmpegio_plugin_static_ffmpeg.__version__
4-
description = ffmpegio finder plugin to use static-ffmpeg executable from static-ffmpeg package
4+
description = ffmpegio finder plugin to use FFmpeg executables from static-ffmpeg package
55
long_description_content_type = text/x-rst
66
long_description = file: README.rst
77
keywords = multimedia, ffmpeg

tests/test_base.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
1-
from ffmpegio import plugins
1+
from ffmpegio import plugins, path
2+
import ffmpegio_plugin_static_ffmpeg
3+
from static_ffmpeg import run
24

35

4-
def test_hooks():
5-
hook = plugins.get_hook().finder
6-
print(hook)
7-
print(plugins.pm.get_plugins())
6+
def test_plugin():
7+
assert ffmpegio_plugin_static_ffmpeg in plugins.pm.get_plugins()
8+
9+
10+
def test_operation():
11+
ffmpeg_bin, ffprobe_bin = run.get_or_fetch_platform_executables_else_raise()
12+
path.find()
13+
assert path.get_ffmpeg() == ffmpeg_bin
14+
assert path.get_ffmpeg(True) == ffprobe_bin
815

916

1017
if __name__ == "__main__":
11-
test_hooks()
18+
test_plugin()
19+
test_operation
20+
21+
print(path.FFMPEG_BIN)
22+
print(path.FFPROBE_BIN)

0 commit comments

Comments
 (0)