forked from fcode/delarte
🔨 Apply pydocstyle to project
This commit is contained in:
parent
e221555e94
commit
e3791e847e
1
Makefile
1
Makefile
|
@ -20,6 +20,7 @@ init-pre_commit: # Set up git pre-commit hook
|
|||
|
||||
lint: # Lint code
|
||||
${VBIN}/black --quiet --check *.py && echo "✅ black" || echo "🚨 black"
|
||||
${VBIN}/pydocstyle && echo "✅ pydocstyle" || echo "🚨 pydocstyle"
|
||||
|
||||
open_all: # Open all projects files
|
||||
${EDITOR} ${VBIN}/activate
|
||||
|
|
|
@ -46,7 +46,7 @@ Rajouter le code sous-titre en paramètre:
|
|||
### 🚀 Chauffe Marcel!
|
||||
|
||||
- `Python 3.10` à été utilisé
|
||||
- Code formaté avec [`black`](https://pypi.org/project/black)
|
||||
- Code formaté avec [`black`](https://pypi.org/project/black) & [`pydocstyle`](https://pypi.org/project/pydocstyle/)
|
||||
- Installation des outils de développement:
|
||||
* `pip install -r requirements-dev.txt`
|
||||
- Un `Makefile` équipé: executer `make help` pour le détail
|
||||
|
|
15
delarte.py
15
delarte.py
|
@ -1,3 +1,16 @@
|
|||
#!/usr/bin/env python3
|
||||
# coding:utf-8
|
||||
|
||||
"""delarte.
|
||||
|
||||
Retrieve video stream in a local file, including sub-titles
|
||||
|
||||
Licence: GNU AGPL v3: http://www.gnu.org/licenses/
|
||||
|
||||
This file is part of [`delarte`](https://git.afpy.org/fcode/delarte)
|
||||
"""
|
||||
|
||||
|
||||
import json
|
||||
import sys
|
||||
import re
|
||||
|
@ -17,6 +30,7 @@ FFMPEG = environ.get("PATH_FFMPEG", "ffmpeg path not found")
|
|||
|
||||
|
||||
def call_api(api_url):
|
||||
"""Retrieve subtitles versions available for a given URL."""
|
||||
http_response = urlopen(api_url)
|
||||
|
||||
if http_response.status != HTTPStatus.OK:
|
||||
|
@ -35,6 +49,7 @@ def call_api(api_url):
|
|||
|
||||
|
||||
def write_subtitles(m3u8_url, base_name):
|
||||
"""Convert distant vtt subtitles to local srt."""
|
||||
main = m3u8.load(m3u8_url)
|
||||
|
||||
sub_m3u8_urls = [
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
black
|
||||
pydocstyle
|
||||
toml
|
||||
|
|
Loading…
Reference in New Issue