diff --git a/Makefile b/Makefile index 940d98c..a31dbd8 100644 --- a/Makefile +++ b/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 diff --git a/README.md b/README.md index cb1ce54..7315af5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/delarte.py b/delarte.py index e0b0cb8..16528f3 100755 --- a/delarte.py +++ b/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 = [ diff --git a/requirements-dev.txt b/requirements-dev.txt index 7e66a17..b709a81 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1 +1,3 @@ black +pydocstyle +toml