Skip to content

Commit 59e29aa

Browse files
author
Andrew Pennebaker
committed
add euphrates for auto cropping panels
1 parent abcc383 commit 59e29aa

12 files changed

+447
-5
lines changed

.github/workflows/audit.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: "Audit"
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: "0 0 * * 1"
8+
jobs:
9+
Audit:
10+
runs-on: "ubuntu-24.04"
11+
env:
12+
GOPATH: "/home/runner/go"
13+
steps:
14+
- run: "echo \"/usr/local/go/bin\" >> $GITHUB_PATH"
15+
- run: "echo \"${GOPATH}/bin\" >> $GITHUB_PATH"
16+
- uses: "actions/checkout@v4"
17+
- run: "sudo apt-get update"
18+
- run: "sudo apt-get install -y curl python3-venv"
19+
- run: "curl -LO https://go.dev/dl/go1.23.2.linux-amd64.tar.gz"
20+
- run: "sudo tar -C /usr/local -xzf go1.23.2.linux-amd64.tar.gz"
21+
- run: "curl -LO https://downloads.snyk.io/cli/stable/snyk-linux"
22+
- run: "sudo cp snyk-linux /bin/snyk"
23+
- run: "sudo chmod a+x /bin/snyk"
24+
- run: "./install"
25+
- run: "./build audit"
26+
env:
27+
SNYK_TOKEN: "${{ secrets.SNYK_TOKEN }}"

.github/workflows/lint.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: "Lint"
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
pull_request:
6+
jobs:
7+
Lint:
8+
runs-on: "ubuntu-24.04"
9+
env:
10+
GOPATH: "/home/runner/go"
11+
steps:
12+
- run: "echo \"/usr/local/go/bin\" >> $GITHUB_PATH"
13+
- run: "echo \"${GOPATH}/bin\" >> $GITHUB_PATH"
14+
- uses: "actions/checkout@v4"
15+
- run: "sudo apt-get update"
16+
- run: "sudo apt-get install -y curl python3-venv shellcheck"
17+
- run: "curl -LO https://go.dev/dl/go1.23.2.linux-amd64.tar.gz"
18+
- run: "sudo tar -C /usr/local -xzf go1.23.2.linux-amd64.tar.gz"
19+
- run: "./install"
20+
- run: "./build lint"

.github/workflows/rubberstamp.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
#
3+
# Rubberstamp
4+
# https://github.com/mcandre/rubberstamp
5+
#
6+
name: "Rubberstamp"
7+
on: # yamllint disable-line rule:truthy
8+
# POSIX cron format
9+
# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html
10+
schedule:
11+
# Once every 5 minutes
12+
# - cron: "*/5 * * * *"
13+
# Once a month
14+
- cron: "0 0 1 * *"
15+
jobs:
16+
Audit:
17+
runs-on: "ubuntu-24.04"
18+
steps:
19+
- uses: "actions/checkout@v4"
20+
- run: "sudo apt-get update"
21+
- run: "sudo apt-get install -y git"
22+
- run: "date -u >.rubberstamp"
23+
- run: "git remote set-url origin \"[email protected]:${RUBBERSTAMP_GH_REPO}.git\""
24+
env:
25+
RUBBERSTAMP_GH_REPO: "${{ github.repository }}"
26+
- run: "git remote get-url origin"
27+
- run: "git config --global user.email '[email protected]'"
28+
- run: "git config --global user.name 'Rubberstamp'"
29+
- run: "git add .rubberstamp"
30+
- run: "git commit -am 'rubberstamp'"
31+
- run: "echo \"$SSH_KEY\" >/tmp/key && chmod 0600 /tmp/key && git -c 'core.sshCommand=ssh -i /tmp/key' push"
32+
env:
33+
SSH_KEY: "${{ secrets.SSH_KEY }}"

.gitignore

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/python
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=python
3+
4+
### Python ###
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
*.py,cover
54+
.hypothesis/
55+
.pytest_cache/
56+
cover/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
db.sqlite3
66+
db.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
.pybuilder/
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# IPython
86+
profile_default/
87+
ipython_config.py
88+
89+
# pyenv
90+
# For a library or package, you might want to ignore these files since the code is
91+
# intended to run in multiple environments; otherwise, check them in:
92+
# .python-version
93+
94+
# pipenv
95+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
97+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
98+
# install all needed dependencies.
99+
#Pipfile.lock
100+
101+
# poetry
102+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103+
# This is especially recommended for binary packages to ensure reproducibility, and is more
104+
# commonly ignored for libraries.
105+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106+
#poetry.lock
107+
108+
# pdm
109+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110+
#pdm.lock
111+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112+
# in version control.
113+
# https://pdm.fming.dev/#use-with-ide
114+
.pdm.toml
115+
116+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117+
__pypackages__/
118+
119+
# Celery stuff
120+
celerybeat-schedule
121+
celerybeat.pid
122+
123+
# SageMath parsed files
124+
*.sage.py
125+
126+
# Environments
127+
.env
128+
.venv
129+
env/
130+
venv/
131+
ENV/
132+
env.bak/
133+
venv.bak/
134+
135+
# Spyder project settings
136+
.spyderproject
137+
.spyproject
138+
139+
# Rope project settings
140+
.ropeproject
141+
142+
# mkdocs documentation
143+
/site
144+
145+
# mypy
146+
.mypy_cache/
147+
.dmypy.json
148+
dmypy.json
149+
150+
# Pyre type checker
151+
.pyre/
152+
153+
# pytype static type analyzer
154+
.pytype/
155+
156+
# Cython debug symbols
157+
cython_debug/
158+
159+
# PyCharm
160+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162+
# and can be added to the global gitignore or merged into this file. For a more nuclear
163+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
164+
#.idea/
165+
166+
### Python Patch ###
167+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
168+
poetry.toml
169+
170+
# ruff
171+
.ruff_cache/
172+
173+
# LSP config files
174+
pyrightconfig.json
175+
176+
# End of https://www.toptal.com/developers/gitignore/api/python

.tool-versions

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
golang 1.23.2
2+
python 3.12.1

DEVELOPMENT.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# BUILDTIME REQUIREMENTS
22

33
* [git](https://git-scm.com/) 2.46.1+
4+
* [ImageMagick](https://imagemagick.org/) 7.1.1+
45
* [Kindle](https://www.amazon.com/b?ie=UTF8&node=16571048011) 7.20+
56
* [macOS](https://www.apple.com/macos) 15+
7+
* [ShellCheck](https://www.shellcheck.net/) 0.8.0+
8+
* [Go](https://go.dev/) 1.23.2+
9+
* [Python](https://www.python.org/) 3.12.1+
10+
* [Snyk](https://snyk.io/)
11+
* Provision additional dev tools with `./install`
612

713
## Recommended
814

915
* [Amphetamine](https://apps.apple.com/us/app/amphetamine/id937984704)
10-
* [ImageMagick](https://imagemagick.org/)
1116

1217
# INSTALL
1318

README.md

+28-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
1-
# tigris: Kindle comic book archiver
1+
# tigris & euphrates: Kindle comic book archiver utilities
22

33
# EXAMPLE
44

55
```
66
$ tigris 101
77
8-
$ ls ~/Downloads/tigris
8+
$ euphrates tigris
9+
10+
$ ls
911
000.png
1012
001.png
1113
002.png
1214
...
1315
```
1416

15-
Adjust `101` to match desired frame count.
17+
# ABOUT
18+
19+
## tigris
20+
21+
`tigris [<frames>]` captures raw archival panels.
22+
23+
Adjust the frames to match the number of pages in your comic book.
24+
25+
Note that frame count `1` is useful for accelearting troubleshooting and other kinds of experiments.
26+
27+
## euphrates
28+
29+
`euphrates` trims panel borders.
30+
31+
* `-n <frames>` controls the limit of images that euphrates processes.
32+
* `-o <directory>` customizes the output directory path.
33+
* `-l <amount>` controls how many pixels to trim from the left border of each frame.
34+
* `-t <amount>` controls how many pixels to trim from the top border of each frame.
35+
* `-r <amount>` controls how many pixels to trim from the right border of each frame.
36+
* `-b <amount>` controls how many pixels to trim from the bottom border of each frame.
37+
38+
See `euphrates -h` for more detail.
1639

1740
# DISCLAIMER
1841

@@ -25,13 +48,13 @@ BSD-2-Clause
2548
# RUNTIME REQUIREMENTS
2649

2750
* [git](https://git-scm.com/) 2.46.1+
51+
* [ImageMagick](https://imagemagick.org/) 7.1.1+
2852
* [Kindle](https://www.amazon.com/b?ie=UTF8&node=16571048011) 7.20+
2953
* [macOS](https://www.apple.com/macos) 15+
3054

3155
## Recommended
3256

3357
* [Amphetamine](https://apps.apple.com/us/app/amphetamine/id937984704)
34-
* [ImageMagick](https://imagemagick.org/)
3558

3659
# INSTALL
3760

@@ -90,6 +113,7 @@ Recommend prototyping archival scans with a small frame count (e.g. 3) in order
90113
* To end the script early, foreground the console emulator and press `Control + C`.
91114
* Queue `tigris` command in console emulator, then adjust the cursor to minimize Kindle HUD artifacts before submitting the command with the Return (Enter) key.
92115
* Temporarily silence browser and other application notifications during scans.
116+
* Keep backups of `tigris/` images before altering the images with `euphrates`.
93117

94118
# CONTRIBUTING
95119

0 commit comments

Comments
 (0)