Skip to content

Commit 4fb8764

Browse files
GH-11: Complete the missing parts of the REAMDE (GH-44)
* Improve the "Development" and "Contribute" sections * Change labels of the status badges * Document the usage with examples * Overwrite the "Goals" section with "Features"
1 parent c927266 commit 4fb8764

File tree

2 files changed

+58
-38
lines changed

2 files changed

+58
-38
lines changed

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests
1+
name: Tests Ubuntu | MacOS
22

33
on:
44
- pull_request

README.md

+57-37
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,89 @@
11
# Thumbnails <img src="https://github.com/pysnippet.png" align="right" height="64" />
22

33
[![PyPI](https://img.shields.io/pypi/v/thumbnails.svg)](https://pypi.org/project/thumbnails/)
4-
[![Tests](https://github.com/pysnippet/thumbnails/actions/workflows/tests.yml/badge.svg)](https://github.com/pysnippet/thumbnails/actions/workflows/tests.yml)
4+
[![Tests Ubuntu | MacOS](https://github.com/pysnippet/thumbnails/actions/workflows/tests.yml/badge.svg)](https://github.com/pysnippet/thumbnails/actions/workflows/tests.yml)
5+
[![Tests Windows](https://img.shields.io/circleci/build/gh/pysnippet/thumbnails?token=c63e2b94c69393ab3e47a0f20de802fe6265ecf4&label=Tests%20Windows&logo=circleci&logoColor=959da5&labelColor=3e464f)](https://app.circleci.com/pipelines/github/pysnippet/thumbnails)
56
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ab5414af4c9546fe97ad64365e2a66f0)](https://www.codacy.com?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=pysnippet/thumbnails&amp;utm_campaign=Badge_Grade)
67
[![License](https://img.shields.io/pypi/l/thumbnails.svg)](https://github.com/pysnippet/thumbnails/blob/master/LICENSE)
78

9+
This tool stands out for its unparalleled optimization for lightning-fast thumbnail generation. By utilizing minimal
10+
resources, you can generate more in less time. And with a user-friendly CLI and a convenient Python API, this tool is
11+
the ultimate solution for efficient and streamlined thumbnail creation.
12+
13+
## Compatible with Major Video Players
14+
815
Modern web video players use the **WebVTT** formatted files to preview thumbnails at a pointed time.
916
[WebVTT](https://www.w3.org/TR/webvtt1/) is a format for displaying timed text tracks (such as subtitles or captions).
1017
Open-source video players such as [Plyr](https://github.com/sampotts/plyr), [Video.js](https://github.com/videojs/video.js),
1118
[Flowplayer](https://github.com/flowplayer/flowplayer), [Fluid Player](https://github.com/fluid-player/fluid-player),
12-
etc. use this format for showing the thumbnails. Using [external plugins](https://github.com/brightcove/videojs-thumbnails),
13-
Video.js also can handle **JSON** formatted thumbnails' metadata, and this tool can also generate the corresponding JSON.
19+
and more, use this format for showing the thumbnails. And, with the use of [external plugins](https://github.com/brightcove/videojs-thumbnails),
20+
Video.js even has the capability to handle **JSON** formatted thumbnail metadata. This is where our tool comes in,
21+
offering the ability to generate the perfect thumbnails to match your needs.
1422

15-
## Goals
23+
## Features
1624

17-
[//]: # (TODO: replace this whole section with a "Why use this tool?" section by describing the below clauses.)
25+
- Wide-ranging video format compatibility, accommodating all major video formats as input files. (mp4, mkv, avi, mov, ogv, webm, mpeg, mpg, wmv, etc.)
26+
- Flexible output options, supporting both WebVTT and JSON formats.
27+
- Generating video thumbnails through the CLI and the Python API.
28+
- Customize your thumbnail creation to fit your specific needs with various options.
29+
- Image compression technology, ensuring optimized file sizes for quick and efficient loading times.
1830

19-
- [x] Support multiple video formats as an input file
20-
- [x] Support WebVTT/json output formats
21-
- [x] Set an interval, etc (options).
22-
- [ ] [Image compression opportunity.](https://github.com/pysnippet/thumbnails/issues/29)
23-
- [ ] [Provide a well documented python API.](https://github.com/pysnippet/thumbnails/issues/11)
24-
- [ ] [Use like a linux command or as a python library.](https://github.com/pysnippet/thumbnails/issues/18)
25-
- [x] Deliver a high performance result.
31+
## How to Use?
2632

27-
## Usage
33+
### CLI Tool Usage
34+
35+
The CLI is a convenient way to generate thumbnails for a video file. And it accepts files or directories as arguments.
36+
For the complete list of options, run `thumbnails --help`.
2837

2938
```bash
30-
thumbnails --help
39+
thumbnails --base /media/ --output /var/www/movie.com/media/thumbnails/ --interval 5 ~Videos/movies
3140
```
3241

33-
[//]: # (TODO: usage for CLI and python API)
42+
### Python API Usage
3443

35-
## Development
44+
The Python API provides a flexible way to integrate video thumbnail generation into your existing applications.
45+
Both the CLI and the Python API share the same set of options.
3646

37-
### Install the dependencies
38-
```bash
39-
python3 -m pip install -r requirements.txt
40-
```
47+
```python
48+
from thumbnails import Generator
4149

42-
### Install the development dependencies
43-
```bash
44-
python3 -m pip install -r tests/requirements.txt
45-
```
50+
inputs = (
51+
"~Downloads/movie.mp4",
52+
"~Videos/movies/1.avi",
53+
"~Videos/movies/2.ogv",
54+
)
4655

47-
### Install the package in editable mode
48-
```bash
49-
python3 -m pip install -e .
56+
generator = Generator(inputs)
57+
generator.base = "/media/"
58+
generator.skip = True # skip existing thumbnails
59+
generator.output = "/var/www/movie.com/media/thumbnails/"
60+
generator.interval = 5
61+
generator.generate()
5062
```
51-
If you are using a non-default version of Python (for example, you work with a virtual environment), you may get an error with `distutils`. See how to [fix](https://askubuntu.com/questions/1261162) the issue.
5263

53-
### Run the tests
54-
Run this in the local environment to ensure everything is working before opening a PR
64+
## Development
65+
66+
Run the following command in the package's root directory to install it in editable mode.
5567
```bash
56-
tox
68+
python3 -m pip install -e .
5769
```
70+
This command will install the package in your local environment and allow you to make changes to the code and see the
71+
updates immediately. It will also install all the required dependencies listed in the [requirements.txt](requirements.txt) file.
5872

5973
## Contribute
6074

61-
Everyone is welcome to contribute to this project. Please read the [contribution guidelines](https://github.com/pysnippet/instructions#readme)
62-
before you start. Contributions can be considered
63-
- Reporting an issue
64-
- Opening a pull-request
65-
- Suggesting an idea at discussions
66-
- Starring the repository if it was helpful
75+
Everyone is welcome to contribute to this project. Please read and follow the [contribution guidelines](https://github.com/pysnippet/instructions#readme)
76+
before you start. Contributions can be considered:
77+
- Reporting an issue
78+
- Opening a pull-request
79+
- Suggesting an idea at [discussions](https://github.com/pysnippet/thumbnails/discussions)
80+
- Starring the repository if you like it
81+
82+
Before you open a PR, please run the unit tests in the local environment to ensure everything is working. You need to
83+
install [tox](https://github.com/tox-dev/tox) and run the tests for configured environments.
84+
```bash
85+
python3 -m pip install tox && tox
86+
```
6787

6888
## License
6989

0 commit comments

Comments
 (0)