Name | glutamate JSON |
Version |
0.0.1a7
JSON |
| download |
home_page | None |
Summary | Python library for querying and downloading posts from e621 |
upload_time | 2024-10-15 21:53:38 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | None |
keywords |
e621
glutamate
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# glutamate
Easy to use Python library for querying and downloading posts from e621.net.
## Installation
```bash
pip install glutamate
```
## Example
```python
from pathlib import Path
from glutamate.database import E621, E621Data, E621PostsCSV, E621TagsCSV, Query, autoinit_from_directory
from glutamate.dataset import get_captions, write_captions, write_stats
from glutamate.download import download_posts
# Init with qualified file paths
e621_data_directory = Path('./e621-data/')
posts_csv = e621_data_directory / 'posts.csv'
posts = E621PostsCSV(posts_csv)
tags_csv = e621_data_directory / 'tags.csv'
tags = E621TagsCSV(tags_csv)
e621: E621 = E621Data(posts, tags)
# or simple automatic init with directory contains CSVs
e621_data_directory = Path('./e621-data/')
e621 = autoinit_from_directory(e621_data_directory)
query = Query(("kisha", "solo"))
kisha_dataset = e621.select(query)
target_directory = Path().cwd() / 'tmp' / 'kisha_solo'
target_directory.mkdir(parents=True, exist_ok=True)
results = download_posts(posts, target_directory, naming='id')
failed = [result for result in results if not result.ok]
if failed:
print(f"Failed to download {len(failed)} posts")
captions = kisha_dataset.get_captions(
naming='id',
remove_underscores=True,
tags_to_head=('kisha', 'kisha (character)')
)
write_captions(captions, target_directory)
counts_csv = target_directory / 'tags.csv'
counts = kisha_dataset.get_tags_stats()
write_stats(counts, counts_csv)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "glutamate",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "e621, glutamate",
"author": null,
"author_email": "jorektheglitch <jorektheglitch@yandex.ru>",
"download_url": "https://files.pythonhosted.org/packages/c5/09/abaf474669421b1f787be0d0f79f49949a2ba54692fd9c658df7a090a518/glutamate-0.0.1a7.tar.gz",
"platform": null,
"description": "# glutamate\r\n\r\nEasy to use Python library for querying and downloading posts from e621.net.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install glutamate\r\n```\r\n\r\n## Example\r\n\r\n```python\r\nfrom pathlib import Path\r\n\r\nfrom glutamate.database import E621, E621Data, E621PostsCSV, E621TagsCSV, Query, autoinit_from_directory\r\nfrom glutamate.dataset import get_captions, write_captions, write_stats\r\nfrom glutamate.download import download_posts\r\n\r\n\r\n# Init with qualified file paths\r\ne621_data_directory = Path('./e621-data/')\r\nposts_csv = e621_data_directory / 'posts.csv'\r\nposts = E621PostsCSV(posts_csv)\r\ntags_csv = e621_data_directory / 'tags.csv'\r\ntags = E621TagsCSV(tags_csv)\r\ne621: E621 = E621Data(posts, tags)\r\n\r\n# or simple automatic init with directory contains CSVs\r\ne621_data_directory = Path('./e621-data/')\r\ne621 = autoinit_from_directory(e621_data_directory)\r\n\r\nquery = Query((\"kisha\", \"solo\"))\r\nkisha_dataset = e621.select(query)\r\n\r\ntarget_directory = Path().cwd() / 'tmp' / 'kisha_solo'\r\ntarget_directory.mkdir(parents=True, exist_ok=True)\r\n\r\nresults = download_posts(posts, target_directory, naming='id')\r\nfailed = [result for result in results if not result.ok]\r\nif failed:\r\n print(f\"Failed to download {len(failed)} posts\")\r\n\r\ncaptions = kisha_dataset.get_captions(\r\n naming='id',\r\n remove_underscores=True,\r\n tags_to_head=('kisha', 'kisha (character)')\r\n)\r\nwrite_captions(captions, target_directory)\r\n\r\ncounts_csv = target_directory / 'tags.csv'\r\ncounts = kisha_dataset.get_tags_stats()\r\nwrite_stats(counts, counts_csv)\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Python library for querying and downloading posts from e621",
"version": "0.0.1a7",
"project_urls": {
"Homepage": "https://github.com/jorektheglitch/glutamate/"
},
"split_keywords": [
"e621",
" glutamate"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "85f07ae0a6d79e23c1dcece07971eb22431bb8ee64ef7023ab505832907d1cb6",
"md5": "c50d61671839c2a5961806261614d34d",
"sha256": "e32695182766d65a500615fba76001d732856d765b001a6dbc8131ea6d9bfeb0"
},
"downloads": -1,
"filename": "glutamate-0.0.1a7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c50d61671839c2a5961806261614d34d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 15078,
"upload_time": "2024-10-15T21:53:37",
"upload_time_iso_8601": "2024-10-15T21:53:37.006102Z",
"url": "https://files.pythonhosted.org/packages/85/f0/7ae0a6d79e23c1dcece07971eb22431bb8ee64ef7023ab505832907d1cb6/glutamate-0.0.1a7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c509abaf474669421b1f787be0d0f79f49949a2ba54692fd9c658df7a090a518",
"md5": "80298f0a42af72a83db1dce9b6f13fcf",
"sha256": "50ae4b052d57a8e2b37892e7973f9f18fc04dd7107007b59bfeebe17429bd619"
},
"downloads": -1,
"filename": "glutamate-0.0.1a7.tar.gz",
"has_sig": false,
"md5_digest": "80298f0a42af72a83db1dce9b6f13fcf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 13764,
"upload_time": "2024-10-15T21:53:38",
"upload_time_iso_8601": "2024-10-15T21:53:38.481826Z",
"url": "https://files.pythonhosted.org/packages/c5/09/abaf474669421b1f787be0d0f79f49949a2ba54692fd9c658df7a090a518/glutamate-0.0.1a7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-15 21:53:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jorektheglitch",
"github_project": "glutamate",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "glutamate"
}