Skip to content

Commit d631542

Browse files
committed
update deps, code improvements and fixes
1 parent a90ebce commit d631542

File tree

19 files changed

+645
-334
lines changed

19 files changed

+645
-334
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
All major and minor version changes will be documented in this file. Details of
44
patch-level version changes can be found in [commit messages](../../commits/master).
55

6+
## 2024.1 - 2024/03/17
7+
8+
- update deps
9+
- use ruff
10+
- code quality improvements
11+
- fix 'Can't download packs with ":" (Colon) in it' - https://github.com/FHPythonUtils/SigStickers/issues/3
12+
613
## 2024 - 2024/01/07
714

815
- update dependencies

README.md

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212

1313
<img src="readme-assets/icons/name.png" alt="Project Icon" width="750">
1414

15-
Download sticker packs from Signal
15+
The `sigstickers` package provides functionality for downloading and converting sticker packs from https://signal.art/addstickers (find packs at https://www.sigstick.com/). Download stickers in WebP format, and convert them to PNG and GIF formats, with caching the converted stickers for faster retrieval.
1616

17+
- [Key Features](#key-features)
1718
- [Using](#using)
18-
- [Help](#help)
1919
- [Formats](#formats)
2020
- [Documentation](#documentation)
2121
- [Install With PIP](#install-with-pip)
@@ -49,23 +49,80 @@ Download sticker packs from Signal
4949
- [Support](#support)
5050
- [Rationale](#rationale)
5151

52+
## Key Features
53+
54+
1. **Sticker Pack Downloading** from Signal from their https://signal.art/addstickers url
55+
2. **Sticker Pack Conversion** from the WebP format to PNG and GIF formats, making them compatible with various platforms and applications.
56+
3. **Caching Functionality** to store converted sticker images locally, reducing the need to re-convert them
57+
4. **Asynchronous Processing** for downloading and converting sticker packs
58+
5259
## Using
5360

54-
- Get the URL of the Signal sticker pack
55-
- Run the program `python -m sigstickers`
56-
- Enter the URL of the sticker pack
57-
- Get the output in the `downloads` folder.
61+
1. Get the URL of the Signal sticker pack. In the form https://signal.art/addstickers (find packs at https://www.sigstick.com/)
5862

59-
### Help
63+
2. Pass in multiple packs from the commandline with `-p/--pack`
6064

61-
```sh
62-
usage: Welcome to SigSticker, providing all of your sticker needs [-h] [-p PACK [PACK ...]]
65+
```bash
66+
$ python -m sigstickers --help
67+
usage: Welcome to SigSticker, providing all of your sticker needs [-h] [-p PACK [PACK ...]]
68+
69+
options:
70+
-h, --help show this help message and exit
71+
-p PACK [PACK ...], --pack PACK [PACK ...]
72+
Pass in a pack URL inline
73+
74+
$ python -m sigstickers --pack 'https://signal.art/addstickers/#pack_id=b676ec334ee2f771cadff5d095971e8c&pack_key=c957a57000626a2dc3cb69bf0e79c91c6b196b74d4d6ca1cbb830d3ad0ad4e36'
75+
76+
2024-03-17 00:14:16.354 | INFO | sigstickers.downloader:download_pack:82 - ============================================================
77+
2024-03-17 00:14:16.805 | INFO | sigstickers.downloader:download_pack:88 - Starting to scrape "DonutTheDog" ...
78+
2024-03-17 00:14:16.812 | INFO | sigstickers.downloader:download_pack:89 - Time taken to scrape 28 stickers - 0.999s
79+
2024-03-17 00:14:16.813 | INFO | sigstickers.downloader:download_pack:90 -
80+
2024-03-17 00:14:16.816 | INFO | sigstickers.downloader:download_pack:96 - ------------------------------------------------------------
81+
2024-03-17 00:14:16.820 | INFO | sigstickers.downloader:download_pack:97 - Starting download of "DonutTheDog" into ...\downloads\DonutTheDog
82+
2024-03-17 00:14:16.894 | INFO | sigstickers.downloader:convert_pack:151 - ------------------------------------------------------------
83+
2024-03-17 00:14:16.897 | INFO | sigstickers.caching:verify_converted:35 - -> Cache miss for DonutTheDog!
84+
2024-03-17 00:14:16.905 | INFO | sigstickers.downloader:convert_pack:163 - Converting stickers "DonutTheDog"...
85+
2024-03-17 00:14:29.655 | INFO | sigstickers.downloader:convert_pack:171 - Time taken to convert 28/28 stickers - 12.749s
86+
2024-03-17 00:14:29.656 | INFO | sigstickers.downloader:convert_pack:175 -
87+
```
6388

64-
optional arguments:
65-
-h, --help show this help message and exit
66-
-p PACK [PACK ...], --pack PACK [PACK ...]
67-
Pass in a pack url inline
68-
```
89+
3. OR. Enter the URL of the sticker pack
90+
91+
```bash
92+
$ python -m sigstickers
93+
Enter sticker_set URL (leave blank to stop): https://signal.art/addstickers/#pack_id=b676ec334ee2f771cadff5d095971e8c&pack_key=c957a57000626a2dc3cb69bf0e79c91c6b196b74d4d6ca1cbb830d3ad0ad4e36
94+
Enter sticker_set URL (leave blank to stop):
95+
2024-03-17 00:18:25.528 | INFO | sigstickers.downloader:download_pack:82 - ============================================================
96+
2024-03-17 00:18:26.415 | INFO | sigstickers.downloader:download_pack:88 - Starting to scrape "DonutTheDog" ...
97+
2024-03-17 00:18:26.417 | INFO | sigstickers.downloader:download_pack:89 - Time taken to scrape 28 stickers - 0.885s
98+
2024-03-17 00:18:26.420 | INFO | sigstickers.downloader:download_pack:90 -
99+
2024-03-17 00:18:26.426 | INFO | sigstickers.downloader:download_pack:96 - ------------------------------------------------------------
100+
2024-03-17 00:18:26.428 | INFO | sigstickers.downloader:download_pack:97 - Starting download of "DonutTheDog" into ...\downloads\DonutTheDog
101+
2024-03-17 00:18:26.497 | INFO | sigstickers.downloader:convert_pack:151 - ------------------------------------------------------------
102+
2024-03-17 00:18:26.524 | INFO | sigstickers.caching:verify_converted:33 - -> Cache hit for DonutTheDog!
103+
```
104+
105+
4. Get the output in the `downloads` folder.
106+
107+
```powershell
108+
$ ls .\downloads\DonutTheDog\
109+
110+
Mode LastWriteTime Length Name
111+
---- ------------- ------ ----
112+
d----- 17/03/2024 00꞉14 gif
113+
d----- 17/03/2024 00꞉14 png
114+
d----- 17/03/2024 00꞉08 webp
115+
116+
$ ls .\downloads\DonutTheDog\webp
117+
118+
Mode LastWriteTime Length Name
119+
---- ------------- ------ ----
120+
-a---- 17/03/2024 00꞉18 285292 0+face_with_tears_of_joy+😂.webp
121+
-a---- 17/03/2024 00꞉18 271726 1+face_blowing_a_kiss+😘.webp
122+
-a---- 17/03/2024 00꞉18 306995 10+smiling_face_with_horns+😈.webp
123+
-a---- 17/03/2024 00꞉18 293578 11+partying_face+🥳.webp
124+
-a---- 17/03/2024 00꞉18 266627 12+angry_face+😠.webp
125+
```
69126

70127
## Formats
71128

documentation/reference/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ A full list of `Sigstickers` project modules.
77
- [Sigstickers](sigstickers/index.md#sigstickers)
88
- [Module](sigstickers/module.md#module)
99
- [Caching](sigstickers/caching.md#caching)
10+
- [Cli](sigstickers/cli.md#cli)
1011
- [Downloader](sigstickers/downloader.md#downloader)

documentation/reference/sigstickers/caching.md

Lines changed: 76 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,68 +5,123 @@
55
> Auto-generated documentation for [sigstickers.caching](../../../sigstickers/caching.py) module.
66
77
- [Caching](#caching)
8-
- [_verifyConvertedV1](#_verifyconvertedv1)
9-
- [createConverted](#createconverted)
10-
- [verifyConverted](#verifyconverted)
8+
- [_get_verify_function](#_get_verify_function)
9+
- [_verify_converted_v1](#_verify_converted_v1)
10+
- [_verify_converted_v2](#_verify_converted_v2)
11+
- [create_converted](#create_converted)
12+
- [verify_converted](#verify_converted)
1113

12-
## _verifyConvertedV1
14+
## _get_verify_function
1315

14-
[Show source in caching.py:37](../../../sigstickers/caching.py#L37)
16+
[Show source in caching.py:96](../../../sigstickers/caching.py#L96)
1517

16-
Verify the cache for a packName using cache data
18+
Get the appropriate cache verification function based on version.
1719

1820
#### Arguments
1921

20-
data (dict[str, Any]) packName cache data to verify
22+
----
23+
- `version` *int* - Cache version
2124

2225
#### Returns
2326

24-
- `bool` - if the converted cache has been verified
27+
-------
28+
- `callable` - Cache verification function
2529

2630
#### Signature
2731

2832
```python
29-
def _verifyConvertedV1(data: dict[str, Any]): ...
33+
def _get_verify_function(version: int): ...
3034
```
3135

3236

3337

34-
## createConverted
38+
## _verify_converted_v1
3539

36-
[Show source in caching.py:52](../../../sigstickers/caching.py#L52)
40+
[Show source in caching.py:40](../../../sigstickers/caching.py#L40)
3741

38-
Write cache data to a file identified by packName
42+
Verify the cache for a packName using cache data.
3943

4044
#### Arguments
4145

42-
- `packName` *str* - name of the sticker pack eg. "DonutTheDog"
43-
- `data` *dict* - packName cache data to write to cache
46+
----
47+
data (dict[Path, Any]): packName cache data to verify
48+
49+
#### Returns
50+
51+
-------
52+
- `bool` - if the converted cache has been verified
53+
54+
#### Signature
55+
56+
```python
57+
def _verify_converted_v1(data: dict[str, Any]) -> bool: ...
58+
```
59+
60+
61+
62+
## _verify_converted_v2
63+
64+
[Show source in caching.py:59](../../../sigstickers/caching.py#L59)
65+
66+
Verify the cache for a packName using cache data.
67+
68+
#### Arguments
69+
70+
----
71+
data (dict[Path, Any]): packName cache data to verify
72+
73+
#### Returns
74+
75+
-------
76+
- `bool` - if the converted cache has been verified
77+
78+
#### Signature
79+
80+
```python
81+
def _verify_converted_v2(data: dict[str, Any]) -> bool: ...
82+
```
83+
84+
85+
86+
## create_converted
87+
88+
[Show source in caching.py:83](../../../sigstickers/caching.py#L83)
89+
90+
Write cache data to a file identified by packName.
91+
92+
#### Arguments
93+
94+
----
95+
- `pack_name` *Path* - name of the sticker pack eg. "DonutTheDog"
96+
- `data` *dict* - packName cache data to write to cache
4497

4598
#### Signature
4699

47100
```python
48-
def createConverted(packName: str, data: dict): ...
101+
def create_converted(pack_name: Path, data: dict) -> None: ...
49102
```
50103

51104

52105

53-
## verifyConverted
106+
## verify_converted
54107

55-
[Show source in caching.py:14](../../../sigstickers/caching.py#L14)
108+
[Show source in caching.py:16](../../../sigstickers/caching.py#L16)
56109

57110
Verify the cache for a packName eg. "DonutTheDog". Uses the cache "version"
58-
to call the verify function for that version
111+
to call the verify function for that version.
59112

60113
#### Arguments
61114

62-
- `packName` *str* - name of the sticker pack eg. "DonutTheDog"
115+
----
116+
- `pack_name` *Path* - name of the sticker pack eg. "DonutTheDog"
63117

64118
#### Returns
65119

66-
- `bool` - if the converted cache has been verified
120+
-------
121+
- `bool` - if the converted cache has been verified
67122

68123
#### Signature
69124

70125
```python
71-
def verifyConverted(packName: str) -> bool: ...
126+
def verify_converted(pack_name: Path) -> bool: ...
72127
```
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Cli
2+
3+
[Sigstickers Index](../README.md#sigstickers-index) / [Sigstickers](./index.md#sigstickers) / Cli
4+
5+
> Auto-generated documentation for [sigstickers.cli](../../../sigstickers/cli.py) module.
6+
7+
- [Cli](#cli)
8+
- [cli](#cli)
9+
- [main](#main)
10+
11+
## cli
12+
13+
[Show source in cli.py:12](../../../sigstickers/cli.py#L12)
14+
15+
CLI entry point.
16+
17+
#### Signature
18+
19+
```python
20+
def cli() -> None: ...
21+
```
22+
23+
24+
25+
## main
26+
27+
[Show source in cli.py:35](../../../sigstickers/cli.py#L35)
28+
29+
Main function to download sticker packs.
30+
31+
#### Signature
32+
33+
```python
34+
def main(packs): ...
35+
```

0 commit comments

Comments
 (0)