├── requirements.txt
├── tests
├── __init__.py
├── data_dummy
│ ├── books.txt
│ └── annotations
│ │ ├── TitleB.xml
│ │ ├── TitleC_with_custom_tag.xml
│ │ └── TitleA.xml
├── test_func.py
└── test_data_type.py
├── MANIFEST.in
├── manga109api
├── __init__.py
└── manga109api.py
├── Makefile
├── setup.py
├── LICENSE
├── .github
└── workflows
│ └── python-package.yml
├── .gitignore
└── README.md
/requirements.txt:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include LICENSE
2 |
--------------------------------------------------------------------------------
/tests/data_dummy/books.txt:
--------------------------------------------------------------------------------
1 | TitleA
2 | TitleB
3 | TitleC_with_custom_tag
--------------------------------------------------------------------------------
/manga109api/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['Parser']
2 | __version__ = '0.3.1'
3 | from .manga109api import Parser
4 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: test clean build test_deploy deploy
2 |
3 | test:
4 | pytest tests/*
5 |
6 | clean:
7 | rm -rf build dist *.egg-info
8 |
9 | build:
10 | python setup.py sdist bdist_wheel
11 |
12 | test_deploy: clean build
13 | twine upload --repository-url https://test.pypi.org/legacy/ dist/*
14 |
15 | deploy: clean build
16 | twine upload dist/*
17 |
--------------------------------------------------------------------------------
/tests/test_func.py:
--------------------------------------------------------------------------------
1 | import manga109api
2 | from pathlib import Path
3 |
4 |
5 | def test_img_path():
6 | manga109_root_dir = "tests/data_dummy/"
7 | p = manga109api.Parser(root_dir=manga109_root_dir)
8 |
9 | img1 = Path(p.img_path(book="TitleA", index=0)).absolute()
10 | img2 = Path("tests/data_dummy/images/TitleA/000.jpg").absolute()
11 | assert(img1 == img2)
12 |
--------------------------------------------------------------------------------
/tests/data_dummy/annotations/TitleB.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup, find_packages
2 | import re
3 |
4 | with open('README.md') as f:
5 | readme = f.read()
6 |
7 | with open('requirements.txt') as f:
8 | requirements = []
9 | for line in f:
10 | requirements.append(line.rstrip())
11 |
12 | with open('manga109api/__init__.py') as f:
13 | # Version is written in manga109api/__init__.py
14 | # This function simply reads it
15 | version = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
16 |
17 |
18 | setup(
19 | name='manga109api',
20 | version=version,
21 | description='Simple python API to read annotation data of Manga109',
22 | long_description=readme,
23 | long_description_content_type='text/markdown',
24 | author='Yusuke Matsui',
25 | author_email='matsui528@gmail.com',
26 | url='https://github.com/manga109/manga109api',
27 | license='MIT',
28 | packages=find_packages(),
29 | install_requires=requirements,
30 | )
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Yusuke Matsui
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/tests/data_dummy/annotations/TitleC_with_custom_tag.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | dummy_text
13 | dummy_text2
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.github/workflows/python-package.yml:
--------------------------------------------------------------------------------
1 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3 |
4 | name: Python package
5 |
6 | on:
7 | push:
8 | branches: [ main ]
9 | pull_request:
10 | branches: [ main ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ${{ matrix.os }}
16 | strategy:
17 | matrix:
18 | os: [macos-latest, ubuntu-latest]
19 | python-version: [3.6, 3.7, 3.8]
20 |
21 | steps:
22 | - uses: actions/checkout@v2
23 | - name: Set up Python ${{ matrix.python-version }}
24 | uses: actions/setup-python@v2
25 | with:
26 | python-version: ${{ matrix.python-version }}
27 | - name: Install dependencies
28 | run: |
29 | python -m pip install --upgrade pip
30 | pip install flake8 pytest
31 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32 | - name: Lint with flake8
33 | run: |
34 | # stop the build if there are Python syntax errors or undefined names
35 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
36 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
37 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
38 | - name: Test with pytest
39 | run: |
40 | make test
41 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 |
3 |
4 | # Byte-compiled / optimized / DLL files
5 | __pycache__/
6 | *.py[cod]
7 | *$py.class
8 |
9 | # C extensions
10 | *.so
11 |
12 | # Distribution / packaging
13 | .Python
14 | build/
15 | develop-eggs/
16 | dist/
17 | downloads/
18 | eggs/
19 | .eggs/
20 | lib/
21 | lib64/
22 | parts/
23 | sdist/
24 | var/
25 | wheels/
26 | *.egg-info/
27 | .installed.cfg
28 | *.egg
29 | MANIFEST
30 |
31 | # PyInstaller
32 | # Usually these files are written by a python script from a template
33 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
34 | *.manifest
35 | *.spec
36 |
37 | # Installer logs
38 | pip-log.txt
39 | pip-delete-this-directory.txt
40 |
41 | # Unit test / coverage reports
42 | htmlcov/
43 | .tox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | .hypothesis/
51 | .pytest_cache/
52 |
53 | # Translations
54 | *.mo
55 | *.pot
56 |
57 | # Django stuff:
58 | *.log
59 | local_settings.py
60 | db.sqlite3
61 |
62 | # Flask stuff:
63 | instance/
64 | .webassets-cache
65 |
66 | # Scrapy stuff:
67 | .scrapy
68 |
69 | # Sphinx documentation
70 | docs/_build/
71 |
72 | # PyBuilder
73 | target/
74 |
75 | # Jupyter Notebook
76 | .ipynb_checkpoints
77 |
78 | # IPython
79 | profile_default/
80 | ipython_config.py
81 |
82 | # pyenv
83 | .python-version
84 |
85 | # celery beat schedule file
86 | celerybeat-schedule
87 |
88 | # SageMath parsed files
89 | *.sage.py
90 |
91 | # Environments
92 | .env
93 | .venv
94 | env/
95 | venv/
96 | ENV/
97 | env.bak/
98 | venv.bak/
99 |
100 | # Spyder project settings
101 | .spyderproject
102 | .spyproject
103 |
104 | # Rope project settings
105 | .ropeproject
106 |
107 | # mkdocs documentation
108 | /site
109 |
110 | # mypy
111 | .mypy_cache/
112 | .dmypy.json
113 | dmypy.json
114 |
--------------------------------------------------------------------------------
/tests/data_dummy/annotations/TitleA.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | あ
14 |
15 |
16 |
17 |
18 | オ
19 |
20 |
21 |
22 |
23 |
24 | え?
25 |
26 | はあ
27 | はあ
28 |
29 |
30 |
31 |