{ "info": { "author": "Joe Cross", "author_email": "joe.mcross@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "OpenGameArt Asset Management\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nPrimarily exists to query and download assets from OpenGameArt. This library does not manage collections, post or edit\ncomments. In the future, it may be used to upload or modify your assets.\n\nInstallation\n============\n\n::\n\n pip install oga\n\nUsing the CLI\n=============\n\nThe cli can be used for searching, downloading, and describing assets.\n\n::\n\n $ oga --help\n Usage: oga [OPTIONS] COMMAND [ARGS]...\n\n Search and download assets from OpenGameArt.org\n\n Options:\n --config-path PATH\n --root-dir DIRECTORY\n --url TEXT\n --max-conns INTEGER\n --help Show this message and exit.\n\n Commands:\n describe Look up a single ASSET.\n download Download files for a single ASSET.\n search Search for an asset.\n\nSample Commands\n---------------\n\nDescribe a single asset. The asset id is everything after ``/content/`` in the OpenGameArt url::\n\n $ oga describe imminent-threat\n imminent-threat music (24 favorites, 23 tags)\n\n $ oga describe imminent-threat --verbose\n {\n \"author\": \"matthew-pablo\",\n \"favorites\": 24,\n \"files\": [\n {\n \"etag\": \"2e9386d-4f63b81cc5d00\",\n \"id\": \"Imminent Threat Collection.zip\",\n \"size\": 48838765\n }\n ],\n \"id\": \"imminent-threat\",\n \"licenses\": [\n \"CC-BY-SA 3.0\"\n ],\n \"tags\": [\n \"Action\",\n \"stealth\",\n # ...\n ],\n \"type\": \"Music\"\n }\n\nDownload a single asset::\n\n $ oga download imminent-threat\n\nA simple per-file etag-based cache is used to avoid re-downloading the same blobs::\n\n $ time oga download imminent-threat\n\n real\t0m8.443s\n user\t0m1.944s\n sys\t0m0.592s\n $ time oga download imminent-threat\n\n real\t0m0.780s\n user\t0m0.444s\n sys\t0m0.080s\n\nIn the future, describe and download operations should be much faster for recently-queried packages since today,\nthe asset etag is not checked and the asset description is not cached (only the file etags are).\n\nSearch for assets::\n\n $ oga search --type music --tag epic --tag viking\n heroic-demise-updated-version music (86 favorites, 12 tags)\n battle-theme-a music (76 favorites, 6 tags)\n rise-of-spirit music (71 favorites, 4 tags)\n space-boss-battle-theme music (57 favorites, 31 tags)\n rpg-battle-theme-the-last-encounter-0 music (53 favorites, 26 tags)\n dark-descent music (44 favorites, 8 tags)\n dream-raid-cinematic-action-soundtrack music (44 favorites, 17 tags)\n space-orchestral music (41 favorites, 3 tags)\n # ...\n\n $ oga search --type music --tag epic --tag viking --tag-op and\n # no results with both tags!\n\n $ oga search --type music --license cc0 --tag epic\n battle-theme-a music (76 favorites, 6 tags)\n boss-battle-music music (19 favorites, 3 tags)\n new-sunrise music (9 favorites, 15 tags)\n the-rush music (8 favorites, 13 tags)\n # ...\n\nOutput Format\n-------------\n\nThe default output for an asset is a short summary, which can be cut and piped to other commands. Its format is::\n\n (<\\d+> favorites, <\\d+> tags)\n\n # oga search --submitter xmo --type 3d --type texture\n graveyard-and-crypt 3d (9 favorites, 11 tags)\n my-blender-skins texture (6 favorites, 9 tags)\n posable-poultry 3d (5 favorites, 9 tags)\n\nUsing the usual tools, you can pipe this to other commands eg. download::\n\n oga search --submitter xmo --type 3d --type texture \\\n | cut -d\" \" -f1 \\\n | xargs -n1 oga download\n\nMore asset details are available using ``--verbose``::\n\n $ oga describe imminent-threat --verbose\n {\n \"author\": \"matthew-pablo\",\n \"favorites\": 24,\n \"files\": [\n {\n \"etag\": \"2e9386d-4f63b81cc5d00\",\n \"id\": \"Imminent Threat Collection.zip\",\n \"size\": 48838765\n }\n ],\n \"id\": \"imminent-threat\",\n \"licenses\": [\n \"CC-BY-SA 3.0\"\n ],\n \"tags\": [\n \"Action\",\n \"stealth\",\n # ...\n ],\n \"type\": \"Music\"\n }\n\n\nUsing the Library\n=================\n\nDownloading Assets\n------------------\n\nOne Asset\n^^^^^^^^^\n\nDownload an asset in 5 lines:\n\n.. code-block:: python\n\n >>> from oga import Session\n >>> session = Session()\n >>> asset_id = \"imminent-threat\"\n >>> asset = session.loop.run_until_complete(session.describe_asset(asset_id))\n >>> session.loop.run_until_complete(session.download_asset(asset))\n\nMultiple Assets\n^^^^^^^^^^^^^^^\n\nLet's take advantage of the async client and download a few assets at once:\n\n.. code-block:: python\n\n >>> import asyncio\n >>> from oga import Config, Session\n >>> config = Config.default()\n >>> config.max_conns = 200 # please be nice\n >>> session = Session(config)\n\n >>> async def download(asset_id):\n ... asset = await session.describe_asset(asset_id)\n ... await session.download_asset(asset)\n ...\n\n >>> asset_ids = [\n ... \"free-music-pack\",\n ... \"battle-theme-a\",\n ... \"rise-of-spirit\",\n ... \"town-theme-rpg\",\n ... \"soliloquy\"]\n\n >>> task = asyncio.wait(\n ... [download(id) for id in asset_ids],\n ... loop=session.loop,\n ... return_when=asyncio.ALL_COMPLETED)\n\n >>> session.loop.run_until_complete(task)\n\nCaching\n^^^^^^^\n\nThis library uses a very simple (dumb) tracker to avoid re-downloading asset files based on the ``ETag`` of each\nfile. Because OGA doesn't publish a content hash it's possible to modify the downloaded file and you'll break the\ntracking.\n\nSearching For Assets\n--------------------\n\nSearches use asynchronous generators so that you don't need to fetch every result to begin processing them.\n\n.. code-block:: python\n\n from oga import Session\n session = Session()\n\n # submitter name begins with or contains 'xmo'\n search = session.search(submitter=\"xmo\")\n\n async def collect(async_generator):\n \"\"\"Helper to block and collapse an async generator into a single list\"\"\"\n results = []\n async for result in async_generator:\n results.append(result)\n return results\n\n results = session.loop.run_until_complete(collect(search))\n print(results)\n # ['graveyard-and-crypt', 'my-blender-skins', 'posable-poultry']\n\nSynchronous Client\n------------------\n\nThe synchronous client exposes batched operations of ``Session.download_asset`` and ``Session.describe_asset``.\n\n\n.. code-block:: python\n\n >>> from oga import SynchronizedSession\n >>> session = SynchronizedSession()\n >>> assets = session.batch_describe_assets([\n ... \"free-music-pack\",\n ... \"battle-theme-a\",\n ... \"rise-of-spirit\",\n ... \"town-theme-rpg\",\n ... \"soliloquy\"\n ... ])\n >>> session.batch_download_assets(assets.values())\n\nTODO\n====\n\nRoughly ordered by priority.\n\n* docstrings\n* community feature requests?\n* unit tests\n* rtd\n* hook points for status updates (eg. progress bars for long downloads)\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/numberoverzero/oga", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "oga", "package_url": "https://pypi.org/project/oga/", "platform": "any", "project_url": "https://pypi.org/project/oga/", "project_urls": { "Homepage": "https://github.com/numberoverzero/oga" }, "release_url": "https://pypi.org/project/oga/1.0.2/", "requires_dist": [ "aiohttp (>=2.3)", "beautifulsoup4 (>=4.6)", "click (>=6.7)" ], "requires_python": "", "summary": "Library for interacting with OpenGameArt.org assets", "version": "1.0.2" }, "last_serial": 3526529, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "cfa3faa155a6297bd22054f31a969f45", "sha256": "c8ca3a00a65fca1d098f6071e01af47de51628ed13d6d6e0ce48c8e42e83fde3" }, "downloads": -1, "filename": "oga-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "cfa3faa155a6297bd22054f31a969f45", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 15638, "upload_time": "2018-01-27T08:48:18", "url": "https://files.pythonhosted.org/packages/ab/71/9195e44c3c785773354da451c4b662798d0e65a720be3fe5dc30bc78a661/oga-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "42565c23df295b6917ed065b454f522a", "sha256": "1a9c415c4a6d951878061a998b5c1cdd582bb5137e1ada27b20dc277d89131ec" }, "downloads": -1, "filename": "oga-1.0.0.tar.gz", "has_sig": false, "md5_digest": "42565c23df295b6917ed065b454f522a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11139, "upload_time": "2018-01-27T08:48:20", "url": "https://files.pythonhosted.org/packages/2b/ff/7072ac5c95c403961216c6b07ee6aeb249214c249ca55a53eb34dfec6108/oga-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "fb4cbada95b135d9aa50193673fb7504", "sha256": "afe965f05940b8243c1e74c01f8885beb6216e12f36b87f9395a3db7cde90a62" }, "downloads": -1, "filename": "oga-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "fb4cbada95b135d9aa50193673fb7504", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16345, "upload_time": "2018-01-27T09:35:54", "url": "https://files.pythonhosted.org/packages/e3/0c/5f64ad25ee711b2459d55bf1926a4163e08409b27c20ec6c052d486cee6f/oga-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f07c08eaf97b931d6c835d2eeeb51a1c", "sha256": "97372fc99799ce84feee1a65a19db46e87e88389bf8068c59efbffc3efbb1a67" }, "downloads": -1, "filename": "oga-1.0.1.tar.gz", "has_sig": false, "md5_digest": "f07c08eaf97b931d6c835d2eeeb51a1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11690, "upload_time": "2018-01-27T09:35:56", "url": "https://files.pythonhosted.org/packages/09/dd/e13383149185ce63e9219c427d7c3175cea4dbf1c5297afc94a6f4bfb3d8/oga-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "e11b815f5242000897c53694f288deeb", "sha256": "6566fd35477713be2db2e5a9e698ebb4672012d61bf4068c248950d8e7a48c0b" }, "downloads": -1, "filename": "oga-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e11b815f5242000897c53694f288deeb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16287, "upload_time": "2018-01-27T09:38:30", "url": "https://files.pythonhosted.org/packages/7d/40/d3a9924e7dae539e7aedb43d4b44fbf910270e6d62f02d804c665aa52ae9/oga-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0d32e270fb5abdb750a5a91d86791bf4", "sha256": "78051f66b065e425b9b2362e6e208c6425919383bc302bec167f01ac96212399" }, "downloads": -1, "filename": "oga-1.0.2.tar.gz", "has_sig": false, "md5_digest": "0d32e270fb5abdb750a5a91d86791bf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11660, "upload_time": "2018-01-27T09:38:32", "url": "https://files.pythonhosted.org/packages/15/23/ef8d834f5856b329bf2324fdd4f16771b5275b6ecf4bab70969ff4f8ce7f/oga-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e11b815f5242000897c53694f288deeb", "sha256": "6566fd35477713be2db2e5a9e698ebb4672012d61bf4068c248950d8e7a48c0b" }, "downloads": -1, "filename": "oga-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e11b815f5242000897c53694f288deeb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 16287, "upload_time": "2018-01-27T09:38:30", "url": "https://files.pythonhosted.org/packages/7d/40/d3a9924e7dae539e7aedb43d4b44fbf910270e6d62f02d804c665aa52ae9/oga-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0d32e270fb5abdb750a5a91d86791bf4", "sha256": "78051f66b065e425b9b2362e6e208c6425919383bc302bec167f01ac96212399" }, "downloads": -1, "filename": "oga-1.0.2.tar.gz", "has_sig": false, "md5_digest": "0d32e270fb5abdb750a5a91d86791bf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11660, "upload_time": "2018-01-27T09:38:32", "url": "https://files.pythonhosted.org/packages/15/23/ef8d834f5856b329bf2324fdd4f16771b5275b6ecf4bab70969ff4f8ce7f/oga-1.0.2.tar.gz" } ] }