diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..e3343728 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,33 @@ +name: Publish + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/subliminal + permissions: + id-token: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..a0efadf9 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,19 @@ +# Read the Docs configuration file for Sphinx projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.12" + +python: + install: + - method: pip + path: . + extra_requirements: + - docs + +sphinx: + configuration: docs/conf.py diff --git a/Dockerfile b/Dockerfile index 2927604c..47d065c7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9.19-alpine3.20 +FROM python:3.12-alpine MAINTAINER Antoine Bertin @@ -8,8 +8,7 @@ ARG UNRAR_VERSION=6.2.6 RUN \ if [ "$BUILD_WITH_UNRAR" = true ]; then \ - apk add -U --update --no-cache --virtual=build-dependencies \ - build-base curl && \ + apk add -U --update --no-cache --virtual=build-dependencies build-base curl && \ echo "**** install unrar from source ****" && \ mkdir /tmp/unrar && \ curl -o /tmp/unrar.tar.gz -L "https://www.rarlab.com/rar/unrarsrc-${UNRAR_VERSION}.tar.gz" && \ @@ -19,7 +18,7 @@ if [ "$BUILD_WITH_UNRAR" = true ]; then \ install -v -m755 unrar /usr/local/bin && \ apk del build-dependencies curl && \ rm -rf /tmp/unrar /tmp/unrar.tar.gz; \ - fi +fi RUN mkdir -p /usr/src/app /usr/src/cache diff --git a/HISTORY.rst b/HISTORY.rst index 30f952b6..cf6a65d2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,17 +1,43 @@ Changelog --------- -2.1.1 +2.2.0 ^^^^^ -**release date:** *not released* - -* Change default encoding of downloaded subtitle to 'utf-8' (not the original encoding) -* Switch podnapisi provider to use JSON API -* Add support for episodes with season 0 in podnapisi provider -* Disabled addic7ed provider due to required captcha for authentication -* Disabled shooter provider since it doesn't filter by language +**release date:** 2024-06-24 + +* Drop python2 support, the supported versions are `>=3.8,<=3.12`. +* Load CLI options from a configuration file with the ``--config/-c`` option (`#1084 `_). +* Change default encoding of downloaded subtitles to 'utf-8' (not the original encoding). Use the ``--original-encoding`` cli option to recover the previous default behavior (`#1125 `_). +* Add opensubtitlescom provider +* Add gestdown provider +* Add tmdb refiner (requires a personal API key) +* Fix tvsubtitles provider +* Fix opensubtitles provider +* Fix napiprojekt provider +* Fix podnapisi provider to use JSON API +* Fix addic7ed provider +* Remove thesubdb provider +* Remove argenteam provider +* Remove shooter provider * Remove legendastv provider - +* Use `pyproject.toml` to specify the package configurations.* Add pre-commit hook (`#1115 `_). +* Use ruff to lint and format +* Use mypy to check types +* Add type annotations +* Drop dependencies: pysrt, appdirs, six, pytz +* Add dependencies: + - click-option-group>=0.5.6 + - platformdirs>=4.2 + - pysubs2>=1.7 + - srt>=3.5 + - tomli>=2 +* Bump dependency versions: + - babelfish>=0.6.1 + - chardet>=5.0 + - click>=8.0 + - dogpile.cache>=1.0 + - enzyme>=0.5.0 + - stevedore>=3.0 2.1.0 ^^^^^ diff --git a/MANIFEST.in b/MANIFEST.in index e45e1167..e38b1f56 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,7 @@ include CONTRIBUTING.md include Dockerfile include .dockerignore include .pre-commit-config.yaml +include .readthedocs.yaml include tox.ini graft docs diff --git a/docs/user/how_it_works.rst b/docs/user/how_it_works.rst index 3aa792f9..c73bfa75 100644 --- a/docs/user/how_it_works.rst +++ b/docs/user/how_it_works.rst @@ -47,4 +47,5 @@ Various libraries are used by subliminal and are key to its success: * `dogpile.cache `_ to cache intermediate search results * `stevedore `_ to manage the provider entry point * `chardet `_ to detect subtitles' encoding -* `srt `_ to validate downloaded subtitles +* `srt `_ to validate downloaded SubRip subtitles +* `pysub2 `_ to validate and convert downloaded subtitles to other formats. diff --git a/docs/user/usage.rst b/docs/user/usage.rst index 7ba16380..dae380f9 100644 --- a/docs/user/usage.rst +++ b/docs/user/usage.rst @@ -16,6 +16,14 @@ Download English subtitles:: only. Otherwise you will get banned from the providers for abuse due to too many requests. If subliminal didn't find subtitles for an old video, it's unlikely it will find subtitles for that video ever anyway. +You can use a configuration file in the `TOML `_ format with the ``--config/-c`` option. If no configuration file is +provided, it looks for a ``subliminal.toml`` file in the default configuration folder for the application. This folder is +`OS dependent `_: + +- Linux: ``/home//.config/subliminal/subliminal.toml`` +- MacOS: ``/Users//Library/Application Support/subliminal/subliminal.toml`` +- Windows: ``C:\\Users\\\\AppData\\Local\\Acme\\subliminal\\subliminal.toml`` + See :ref:`cli` for more details on the available commands and options. @@ -23,6 +31,9 @@ Nautilus/Nemo integration ------------------------- See the dedicated `project page `_ for more information. +Dolphin integration +------------------- +See `this Gist `_. High level API -------------- diff --git a/pyproject.toml b/pyproject.toml index 554f0d1c..80f3c82b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,12 +39,11 @@ dependencies = [ "click>=8.0", "click-option-group>=0.5.6", "dogpile.cache>=1.0", - "enzyme>=0.4.1", + "enzyme>=0.5.0", "guessit>=3.0.0", "platformdirs>=4.2", "pysubs2>=1.7", "rarfile>=2.7", - "rebulk>=3.0", "requests>=2.0", "srt>=3.5", "stevedore>=3.0", diff --git a/subliminal/__init__.py b/subliminal/__init__.py index 5ddc52e8..7d4d8bc2 100644 --- a/subliminal/__init__.py +++ b/subliminal/__init__.py @@ -3,7 +3,7 @@ from __future__ import annotations __title__: str = 'subliminal' -__version__: str = '2.1.1-dev' +__version__: str = '2.2.0' __short_version__: str = '.'.join(__version__.split('.')[:2]) __author__: str = 'Antoine Bertin' __license__: str = 'MIT'