Skip to content

Commit

Permalink
Merge pull request #10 from manga109/v0.2.0
Browse files Browse the repository at this point in the history
for v0.2.0
  • Loading branch information
matsui528 authored Aug 28, 2020
2 parents 4f712ce + 21c3082 commit 5026fbd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.PHONY: clean build test_deploy deploy test
.PHONY: test clean build test_deploy deploy

test:
python -m pytest tests/*

clean:
rm -rf build dist *.egg-info
Expand All @@ -11,6 +14,3 @@ test_deploy: clean build

deploy: clean build
twine upload dist/*

test:
python -m pytest tests/*
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ This package provides a simple Python API to read annotation data (i.e., parsing
with some utility functions such as reading an image.

## News
- [Aug XX, 2020]: v0.2.0 will be released. [The API will be drastically improved](https://github.com/matsui528/manga109api/pull/8), thanks for [@i3ear](https://github.com/i3ear)!
- [Aug XX, 2020]: The repository is moved to [manga109 organization](https://github.com/manga109)
- [Aug 28, 2020]: v0.2.0 is out. [The API is drastically improved](https://github.com/matsui528/manga109api/pull/8), thanks for [@i3ear](https://github.com/i3ear)!
- [Aug 28, 2020]: The repository is moved to [manga109 organization](https://github.com/manga109)

## Links
- [Manga109](http://www.manga109.org/en/)
Expand All @@ -28,7 +28,7 @@ with some utility functions such as reading an image.
- [[Aizawa+, IEEE MultiMedia 2020]](https://arxiv.org/abs/2005.04425): The paper introducing (1) the annotation data and (2) a few examples of multimedia processing applications (detection, retrieval, and generation). **Please cite this if you use manga109 annotation data**

## Installing
You can install the package via pip. The library works with Python 3.5+ on linux
You can install the package via pip. The library works with Python 3.5+ on linux/MacOS
```bash
pip install manga109api
```
Expand All @@ -43,22 +43,29 @@ from pprint import pprint
manga109_root_dir = "YOUR_DIR/Manga109_2017_09_28"
p = manga109api.Parser(root_dir=manga109_root_dir)

# See the book titles by p.books

# (1) Book titles
print(p.books)
# Output: ['ARMS', 'AisazuNihaIrarenai', 'AkkeraKanjinchou', 'Akuhamu', ...

# Access the annotation by p.get_annotation(book)

# (2) Path to an image (page).
print(p.img_path(book="ARMS", index=3)) # the 4th page of "ARMS"
# Output (str): YOUR_DIR/Manga109_2017_09_28/images/ARMS/003.jpg


# (3) The main annotation data
annotation = p.get_annotation(book="ARMS")

# annotation is a dictionary. Keys are "title", "character", and "page":
# - annotation["title"] : (str) Title
# - annotation["character"] : (list) Characters who appeared in the book
# - annotation["character"] : (list) Characters who appear in the book
# - annotation["page"] : (list) The main annotation data for each page

# (1) title
# (3-a) title
print(annotation["title"]) # Output (str): ARMS

# (2) character
# (3-b) character
pprint(annotation["character"])
# Output (list):
# [{'@id': '00000003', '@name': '女1'},
Expand All @@ -67,10 +74,9 @@ pprint(annotation["character"])
# {'@id': '000000fe', '@name': 'エリー'},
# {'@id': '0000010a', '@name': 'ケイト'}, ... ]

# (3) page
# (3-c) page
# annotation["page"] is the main annotation data (list of pages)
# E.g., annotation["page"][3] returns the data of 4th page of "ARMS"
pprint(annotation["page"][3])
pprint(annotation["page"][3]) # the data of the 4th page of "ARMS"
# Output (dict):
# {'@height': 1170, <- Height of the img
# '@index': 3, <- The page number
Expand Down Expand Up @@ -121,12 +127,6 @@ pprint(annotation["page"][3])
# '@xmin': 1155,
# '@ymax': 686,
# '@ymin': 595} ... ]}


# Utility function.
# p.img_path() gives you the path to the image data. The following line returns the path to the 4th image of ARMS
print(p.img_path(book="ARMS", index=3))
# Output (str): YOUR_DIR/Manga109_2017_09_28/images/ARMS/003.jpg
```


Expand Down
11 changes: 8 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
with open('README.md') as f:
readme = f.read()

with open('requirements.txt') as f:
requirements = []
for line in f:
requirements.append(line.rstrip())

setup(
name='manga109api',
version='0.1.2',
version='0.2.0',
description='Simple python API to read annotation data of Manga109',
long_description=readme,
long_description_content_type='text/markdown',
author='Yusuke Matsui',
author_email='[email protected]',
url='https://github.com/matsui528/manga109api',
url='https://github.com/manga109/manga109api',
license='MIT',
packages=find_packages(),
install_requires=['xmltodict'],
install_requires=requirements,
)

0 comments on commit 5026fbd

Please sign in to comment.