diff --git a/documentation/reference/MODULES.md b/documentation/reference/MODULES.md deleted file mode 100644 index 6a87420..0000000 --- a/documentation/reference/MODULES.md +++ /dev/null @@ -1,12 +0,0 @@ -# Tstickers Modules - -> Auto-generated documentation modules index. - -Full list of [Tstickers](README.md#tstickers-index) project modules. - -- [Tstickers Index](README.md#tstickers-index) -- [Tstickers](tstickers/index.md#tstickers) - - [Module](tstickers/module.md#module) - - [Caching](tstickers/caching.md#caching) - - [Convert](tstickers/convert.md#convert) - - [Downloader](tstickers/downloader.md#downloader) diff --git a/documentation/reference/README.md b/documentation/reference/README.md index 6a87420..7db7283 100644 --- a/documentation/reference/README.md +++ b/documentation/reference/README.md @@ -1,10 +1,9 @@ -# Tstickers Modules +# Tstickers Index -> Auto-generated documentation modules index. +> Auto-generated documentation index. -Full list of [Tstickers](README.md#tstickers-index) project modules. +A full list of `Tstickers` project modules. -- [Tstickers Index](README.md#tstickers-index) - [Tstickers](tstickers/index.md#tstickers) - [Module](tstickers/module.md#module) - [Caching](tstickers/caching.md#caching) diff --git a/documentation/reference/tstickers/caching.md b/documentation/reference/tstickers/caching.md index cfc8de5..95cefd1 100644 --- a/documentation/reference/tstickers/caching.md +++ b/documentation/reference/tstickers/caching.md @@ -1,24 +1,23 @@ # Caching +[Tstickers Index](../README.md#tstickers-index) / +[Tstickers](./index.md#tstickers) / +Caching + > Auto-generated documentation for [tstickers.caching](../../../tstickers/caching.py) module. -Sticker caching functionality used by the downloader. +#### Attributes -- [Tstickers](../README.md#tstickers-index) / [Modules](../MODULES.md#tstickers-modules) / [Tstickers](index.md#tstickers) / Caching - - [createConverted](#createconverted) - - [verifyConverted](#verifyconverted) +- `cachedSession` - requests_cache: `CachedSession('.cache/tstickers.requests.sqlite', backend='sqlite', expire_after=60 * 60 * 12, allowable_codes=(200), allowable_methods=('GET', 'POST'))` -#### Attributes -- `cachedSession` - requests_cache: `CachedSession('.cache/tstickers.requests.sqlite...` +- [Caching](#caching) + - [createConverted](#createconverted) + - [verifyConverted](#verifyconverted) ## createConverted -[[find in source code]](../../../tstickers/caching.py#L60) - -```python -def createConverted(packName: str, data: dict): -``` +[Show source in caching.py:60](../../../tstickers/caching.py#L60) Write cache data to a file identified by packName @@ -27,14 +26,19 @@ Write cache data to a file identified by packName - `packName` *str* - name of the sticker pack eg. "DonutTheDog" - `data` *dict* - packName cache data to write to cache -## verifyConverted - -[[find in source code]](../../../tstickers/caching.py#L21) +#### Signature ```python -def verifyConverted(packName: str) -> bool: +def createConverted(packName: str, data: dict): + ... ``` + + +## verifyConverted + +[Show source in caching.py:21](../../../tstickers/caching.py#L21) + Verify the cache for a packName eg. "DonutTheDog". Uses the cache "version" to call the verify function for that version @@ -45,3 +49,12 @@ to call the verify function for that version #### Returns - `bool` - if the converted cache has been verified + +#### Signature + +```python +def verifyConverted(packName: str) -> bool: + ... +``` + + diff --git a/documentation/reference/tstickers/convert.md b/documentation/reference/tstickers/convert.md index 05db11d..c702be0 100644 --- a/documentation/reference/tstickers/convert.md +++ b/documentation/reference/tstickers/convert.md @@ -1,22 +1,20 @@ # Convert -> Auto-generated documentation for [tstickers.convert](../../../tstickers/convert.py) module. +[Tstickers Index](../README.md#tstickers-index) / +[Tstickers](./index.md#tstickers) / +Convert -Sticker convert functions used by the downloader. +> Auto-generated documentation for [tstickers.convert](../../../tstickers/convert.py) module. -- [Tstickers](../README.md#tstickers-index) / [Modules](../MODULES.md#tstickers-modules) / [Tstickers](index.md#tstickers) / Convert - - [assureDirExists](#assuredirexists) - - [convertTgs](#converttgs) - - [convertWebp](#convertwebp) - - [convertWithPIL](#convertwithpil) +- [Convert](#convert) + - [assureDirExists](#assuredirexists) + - [convertTgs](#converttgs) + - [convertWebp](#convertwebp) + - [convertWithPIL](#convertwithpil) ## assureDirExists -[[find in source code]](../../../tstickers/convert.py#L13) - -```python -def assureDirExists(root: Path, directory: Path | str) -> Path: -``` +[Show source in convert.py:13](../../../tstickers/convert.py#L13) make the dir if not exists @@ -29,19 +27,19 @@ make the dir if not exists - `Path` - the full path -## convertTgs - -[[find in source code]](../../../tstickers/convert.py#L72) +#### Signature ```python -def convertTgs( - swd: Path, - threads: int = 4, - frameSkip: int = 1, - scale: float = 1, -) -> int: +def assureDirExists(root: Path, directory: Path | str) -> Path: + ... ``` + + +## convertTgs + +[Show source in convert.py:72](../../../tstickers/convert.py#L72) + Convert animated stickers to webp, gif and png #### Arguments @@ -57,14 +55,19 @@ for optimisation with a quality trade-off. Defaults to 1. - `int` - number of stickers successfully converted -## convertWebp - -[[find in source code]](../../../tstickers/convert.py#L44) +#### Signature ```python -def convertWebp(swd: Path, threads: int = 4) -> int: +def convertTgs(swd: Path, threads: int = 4, frameSkip: int = 1, scale: float = 1) -> int: + ... ``` + + +## convertWebp + +[Show source in convert.py:44](../../../tstickers/convert.py#L44) + Convert static stickers to png and gif #### Arguments @@ -76,14 +79,19 @@ Convert static stickers to png and gif - `int` - number of stickers successfully converted -## convertWithPIL - -[[find in source code]](../../../tstickers/convert.py#L27) +#### Signature ```python -def convertWithPIL(inputFile: str) -> str: +def convertWebp(swd: Path, threads: int = 4) -> int: + ... ``` + + +## convertWithPIL + +[Show source in convert.py:27](../../../tstickers/convert.py#L27) + Convert the webp file to png #### Arguments @@ -93,3 +101,12 @@ Convert the webp file to png #### Returns - `str` - path to input file + +#### Signature + +```python +def convertWithPIL(inputFile: str) -> str: + ... +``` + + diff --git a/documentation/reference/tstickers/downloader.md b/documentation/reference/tstickers/downloader.md index 27aa39a..74ed443 100644 --- a/documentation/reference/tstickers/downloader.md +++ b/documentation/reference/tstickers/downloader.md @@ -1,70 +1,71 @@ # Downloader -> Auto-generated documentation for [tstickers.downloader](../../../tstickers/downloader.py) module. +[Tstickers Index](../README.md#tstickers-index) / +[Tstickers](./index.md#tstickers) / +Downloader -Sticker download functions used by the module entry point. +> Auto-generated documentation for [tstickers.downloader](../../../tstickers/downloader.py) module. -- [Tstickers](../README.md#tstickers-index) / [Modules](../MODULES.md#tstickers-modules) / [Tstickers](index.md#tstickers) / Downloader - - [Sticker](#sticker) - - [Sticker().emojiName](#stickeremojiname) - - [StickerDownloader](#stickerdownloader) - - [StickerDownloader().convertPack](#stickerdownloaderconvertpack) - - [StickerDownloader().doAPIReq](#stickerdownloaderdoapireq) - - [StickerDownloader().downloadPack](#stickerdownloaderdownloadpack) - - [StickerDownloader().downloadSticker](#stickerdownloaderdownloadsticker) - - [StickerDownloader().getPack](#stickerdownloadergetpack) - - [StickerDownloader().getSticker](#stickerdownloadergetsticker) +- [Downloader](#downloader) + - [Sticker](#sticker) + - [Sticker().emojiName](#sticker()emojiname) + - [StickerDownloader](#stickerdownloader) + - [StickerDownloader().convertPack](#stickerdownloader()convertpack) + - [StickerDownloader().doAPIReq](#stickerdownloader()doapireq) + - [StickerDownloader().downloadPack](#stickerdownloader()downloadpack) + - [StickerDownloader().downloadSticker](#stickerdownloader()downloadsticker) + - [StickerDownloader().getPack](#stickerdownloader()getpack) + - [StickerDownloader().getSticker](#stickerdownloader()getsticker) ## Sticker -[[find in source code]](../../../tstickers/downloader.py#L19) +[Show source in downloader.py:19](../../../tstickers/downloader.py#L19) + +Sticker instance attributes + +#### Signature ```python -class Sticker(): +class Sticker: def __init__( - name: str = 'None', - link: str = 'None', - emoji: str = '😀', - fileType='webp', + self, name: str = "None", link: str = "None", emoji: str = "😀", fileType="webp" ): + ... ``` -Sticker instance attributes - ### Sticker().emojiName -[[find in source code]](../../../tstickers/downloader.py#L37) +[Show source in downloader.py:37](../../../tstickers/downloader.py#L37) + +get the emoji as a string + +#### Signature ```python -def emojiName() -> str: +def emojiName(self) -> str: + ... ``` -get the emoji as a string -## StickerDownloader -[[find in source code]](../../../tstickers/downloader.py#L42) +## StickerDownloader -```python -class StickerDownloader(): - def __init__(token, session=None, multithreading=4): -``` +[Show source in downloader.py:42](../../../tstickers/downloader.py#L42) The StickerDownloader sets up the api and makes requests -### StickerDownloader().convertPack - -[[find in source code]](../../../tstickers/downloader.py#L187) +#### Signature ```python -def convertPack( - packName: str, - frameSkip: int = 1, - scale: float = 1, - noCache=False, -): +class StickerDownloader: + def __init__(self, token, session=None, multithreading=4): + ... ``` +### StickerDownloader().convertPack + +[Show source in downloader.py:187](../../../tstickers/downloader.py#L187) + Convert the webp to gif and png; tgs to gif, webp (webp_animated) and png. #### Arguments @@ -76,14 +77,19 @@ optimisation with a quality trade-off. Defaults to 1. for optimisation with a quality trade-off. Defaults to 1. - `noCache` *bool, optional* - set to true to disable cache. Defaults to False. -### StickerDownloader().doAPIReq - -[[find in source code]](../../../tstickers/downloader.py#L61) +#### Signature ```python -def doAPIReq(function: str, params: dict[Any, Any]) -> dict[Any, Any] | None: +def convertPack( + self, packName: str, frameSkip: int = 1, scale: float = 1, noCache=False +): + ... ``` +### StickerDownloader().doAPIReq + +[Show source in downloader.py:61](../../../tstickers/downloader.py#L61) + Use the telegram api #### Arguments @@ -99,14 +105,17 @@ params (dict[Any, Any]): function parameters - `Optional[dict[Any,` *Any]]* - api response -### StickerDownloader().downloadPack - -[[find in source code]](../../../tstickers/downloader.py#L152) +#### Signature ```python -def downloadPack(pack: dict[str, Any]) -> list[str]: +def doAPIReq(self, function: str, params: dict[Any, Any]) -> dict[Any, Any] | None: + ... ``` +### StickerDownloader().downloadPack + +[Show source in downloader.py:152](../../../tstickers/downloader.py#L152) + Download a sticker pack. #### Arguments @@ -117,14 +126,17 @@ pack (dict[str, Any]): dictionary representing a sticker pack - `list[str]` - list of file paths each sticker is written to -### StickerDownloader().downloadSticker - -[[find in source code]](../../../tstickers/downloader.py#L140) +#### Signature ```python -def downloadSticker(path: Path, link: str) -> int: +def downloadPack(self, pack: dict[str, Any]) -> list[str]: + ... ``` +### StickerDownloader().downloadSticker + +[Show source in downloader.py:140](../../../tstickers/downloader.py#L140) + Download a sticker from the server. #### Arguments @@ -136,14 +148,17 @@ Download a sticker from the server. - `int` - path.write_bytes(res.content) -### StickerDownloader().getPack - -[[find in source code]](../../../tstickers/downloader.py#L107) +#### Signature ```python -def getPack(packName: str) -> dict[str, Any] | None: +def downloadSticker(self, path: Path, link: str) -> int: + ... ``` +### StickerDownloader().getPack + +[Show source in downloader.py:107](../../../tstickers/downloader.py#L107) + Get a list of File objects. #### Arguments @@ -154,14 +169,17 @@ Get a list of File objects. - `dict[str,` *Any]* - dictionary containing sticker data -### StickerDownloader().getSticker - -[[find in source code]](../../../tstickers/downloader.py#L86) +#### Signature ```python -def getSticker(fileData: dict[Any, Any]) -> Sticker: +def getPack(self, packName: str) -> dict[str, Any] | None: + ... ``` +### StickerDownloader().getSticker + +[Show source in downloader.py:86](../../../tstickers/downloader.py#L86) + Get sticker info from the server #### Arguments @@ -170,8 +188,17 @@ fileData (dict[Any, Any]): sticker id #### Returns -- `Sticker` - Sticker instance +- [Sticker](#sticker) - Sticker instance + +#### Signature + +```python +def getSticker(self, fileData: dict[Any, Any]) -> Sticker: + ... +``` #### See also - [Sticker](#sticker) + + diff --git a/documentation/reference/tstickers/index.md b/documentation/reference/tstickers/index.md index 48cd658..df91cff 100644 --- a/documentation/reference/tstickers/index.md +++ b/documentation/reference/tstickers/index.md @@ -1,23 +1,32 @@ # Tstickers -> Auto-generated documentation for [tstickers](../../../tstickers/__init__.py) module. +[Tstickers Index](../README.md#tstickers-index) / +Tstickers -Download sticker packs from Telegram +> Auto-generated documentation for [tstickers](../../../tstickers/__init__.py) module. -- [Tstickers](../README.md#tstickers-index) / [Modules](../MODULES.md#tstickers-modules) / Tstickers - - [cli](#cli) - - Modules - - [Module](module.md#module) - - [Caching](caching.md#caching) - - [Convert](convert.md#convert) - - [Downloader](downloader.md#downloader) +- [Tstickers](#tstickers) + - [cli](#cli) + - [Modules](#modules) ## cli -[[find in source code]](../../../tstickers/__init__.py#L12) +[Show source in __init__.py:12](../../../tstickers/__init__.py#L12) + +cli entry point + +#### Signature ```python def cli(): + ... ``` -cli entry point + + +## Modules + +- [Module](./module.md) +- [Caching](./caching.md) +- [Convert](./convert.md) +- [Downloader](./downloader.md) \ No newline at end of file diff --git a/documentation/reference/tstickers/module.md b/documentation/reference/tstickers/module.md index 4ae948b..ad78074 100644 --- a/documentation/reference/tstickers/module.md +++ b/documentation/reference/tstickers/module.md @@ -1,7 +1,9 @@ # Module -> Auto-generated documentation for [tstickers.__main__](../../../tstickers/__main__.py) module. +[Tstickers Index](../README.md#tstickers-index) / +[Tstickers](./index.md#tstickers) / +Module -entry point for python -m tstickers +> Auto-generated documentation for [tstickers.__main__](../../../tstickers/__main__.py) module. -- [Tstickers](../README.md#tstickers-index) / [Modules](../MODULES.md#tstickers-modules) / [Tstickers](index.md#tstickers) / Module +- [Module](#module) diff --git a/pyproject.toml b/pyproject.toml index 433dfdf..4b52a08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,11 +22,11 @@ readme = "README.md" [tool.poetry.dependencies] python = ">=3.8,<4.0" -requests = "^2.31.0" -Pillow = "^9.5.0" -emoji = "^2.5.1" -pyrlottie = "^2022.0.2" -requests-cache = "^1.0.1" +requests = "<3,>=2.31.0" +Pillow = "<10,>=9.5.0" +emoji = "<3,>=2.5.1" +pyrlottie = "<2024,>=2022.0.2" +requests-cache = "<2,>=1.0.1" [tool.poetry.scripts] tstickers = "tstickers:cli" diff --git a/requirements.txt b/requirements.txt index 59e98ed..daa8fd9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -Pillow<10,>=9.0.0 -emoji<2,>=1.6.3 -pyrlottie<2024,>=2022 -requests-cache<2,>=0.9.1 -requests<3,>=2.27.1 +Pillow<10,>=9.5.0 +emoji<3,>=2.5.1 +pyrlottie<2024,>=2022.0.2 +requests-cache<2,>=1.0.1 +requests<3,>=2.31.0