anitopy


Nameanitopy JSON
Version 2.1.1 PyPI version JSON
download
home_pagehttps://github.com/igorcmoura/anitopy
SummaryAn anime video filename parser
upload_time2022-07-24 10:24:27
maintainer
docs_urlNone
authorIgor Cescon de Moura
requires_python>=2.7
license
keywords
VCS
bugtrack_url
requirements enum34
Travis-CI
coveralls test coverage No coveralls.
            =======
Anitopy
=======

Anitopy is a Python library for parsing anime video filenames. It's simple to use and it's based on the C++ library `Anitomy <https://github.com/erengy/anitomy>`_.

Example
-------
The following filename...

::

    [TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv

...can be parsed using the following code:

.. code-block:: python

    >>> import anitopy
    >>> anitopy.parse('[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv')
    {
        'anime_title': 'Toradora!',
        'anime_year': '2008',
        'audio_term': 'FLAC',
        'episode_number': '01',
        'episode_title': 'Tiger and Dragon',
        'file_checksum': '1234ABCD',
        'file_extension': 'mkv',
        'file_name': '[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv',
        'release_group': 'TaigaSubs',
        'release_version': '2',
        'video_resolution': '1280x720',
        'video_term': 'H.264'
    }

The :code:`parse` function receives a string and returns a dictionary containing all found elements. It can also receive parsing options, this will be explained below.

Installation
------------

To install Anitopy, simply use pip:

.. code-block:: bash

    $ pip install anitopy

Or download the source code and inside the source code's folder run:

.. code-block:: bash

    $ python setup.py install

Options
-------

The :code:`parse` function can receive the :code:`options` parameter. E.g.:

.. code-block:: python

    >>> import anitopy
    >>> anitopy_options = {'allowed_delimiters': ' '}
    >>> anitopy.parse('DRAMAtical Murder Episode 1 - Data_01_Login', options=anitopy_options)
    {
        'anime_title': 'DRAMAtical Murder',
        'episode_number': '1',
        'episode_title': 'Data_01_Login',
        'file_name': 'DRAMAtical Murder Episode 1 - Data_01_Login'
    }

If the default options had been used, the parser would have considered :code:`_` as a delimiter and replaced it with space in the episode title.

The options contain the following attributes:

+----------------------+-----------------+-----------------------------------------------------------------+-------------------+
| **Attribute name**   | **Type**        | **Description**                                                 | **Default value** |
+----------------------+-----------------+-----------------------------------------------------------------+-------------------+
| allowed_delimiters   | string          | The list of character to be considered as delimiters.           | ' _.&+,|'         |
+----------------------+-----------------+-----------------------------------------------------------------+-------------------+
| ignored_strings      | list of strings | A list of strings to be removed from the filename during parse. | []                |
+----------------------+-----------------+-----------------------------------------------------------------+-------------------+
| parse_episode_number | boolean         | If the episode number should be parsed.                         | True              |
+----------------------+-----------------+-----------------------------------------------------------------+-------------------+
| parse_episode_title  | boolean         | If the episode title should be parsed.                          | True              |
+----------------------+-----------------+-----------------------------------------------------------------+-------------------+
| parse_file_extension | boolean         | If the file extension should be parsed.                         | True              |
+----------------------+-----------------+-----------------------------------------------------------------+-------------------+
| parse_release_group  | boolean         | If the release group should be parsed.                          | True              |
+----------------------+-----------------+-----------------------------------------------------------------+-------------------+



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/igorcmoura/anitopy",
    "name": "anitopy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=2.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Igor Cescon de Moura",
    "author_email": "igorcesconm@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d3/8b/3da3f8ba73b8e4e5325a9ecbd6780f4dc9f41c98cc1c6a897800c4f85979/anitopy-2.1.1.tar.gz",
    "platform": null,
    "description": "=======\nAnitopy\n=======\n\nAnitopy is a Python library for parsing anime video filenames. It's simple to use and it's based on the C++ library `Anitomy <https://github.com/erengy/anitomy>`_.\n\nExample\n-------\nThe following filename...\n\n::\n\n    [TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv\n\n...can be parsed using the following code:\n\n.. code-block:: python\n\n    >>> import anitopy\n    >>> anitopy.parse('[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv')\n    {\n        'anime_title': 'Toradora!',\n        'anime_year': '2008',\n        'audio_term': 'FLAC',\n        'episode_number': '01',\n        'episode_title': 'Tiger and Dragon',\n        'file_checksum': '1234ABCD',\n        'file_extension': 'mkv',\n        'file_name': '[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv',\n        'release_group': 'TaigaSubs',\n        'release_version': '2',\n        'video_resolution': '1280x720',\n        'video_term': 'H.264'\n    }\n\nThe :code:`parse` function receives a string and returns a dictionary containing all found elements. It can also receive parsing options, this will be explained below.\n\nInstallation\n------------\n\nTo install Anitopy, simply use pip:\n\n.. code-block:: bash\n\n    $ pip install anitopy\n\nOr download the source code and inside the source code's folder run:\n\n.. code-block:: bash\n\n    $ python setup.py install\n\nOptions\n-------\n\nThe :code:`parse` function can receive the :code:`options` parameter. E.g.:\n\n.. code-block:: python\n\n    >>> import anitopy\n    >>> anitopy_options = {'allowed_delimiters': ' '}\n    >>> anitopy.parse('DRAMAtical Murder Episode 1 - Data_01_Login', options=anitopy_options)\n    {\n        'anime_title': 'DRAMAtical Murder',\n        'episode_number': '1',\n        'episode_title': 'Data_01_Login',\n        'file_name': 'DRAMAtical Murder Episode 1 - Data_01_Login'\n    }\n\nIf the default options had been used, the parser would have considered :code:`_` as a delimiter and replaced it with space in the episode title.\n\nThe options contain the following attributes:\n\n+----------------------+-----------------+-----------------------------------------------------------------+-------------------+\n| **Attribute name**   | **Type**        | **Description**                                                 | **Default value** |\n+----------------------+-----------------+-----------------------------------------------------------------+-------------------+\n| allowed_delimiters   | string          | The list of character to be considered as delimiters.           | ' _.&+,|'         |\n+----------------------+-----------------+-----------------------------------------------------------------+-------------------+\n| ignored_strings      | list of strings | A list of strings to be removed from the filename during parse. | []                |\n+----------------------+-----------------+-----------------------------------------------------------------+-------------------+\n| parse_episode_number | boolean         | If the episode number should be parsed.                         | True              |\n+----------------------+-----------------+-----------------------------------------------------------------+-------------------+\n| parse_episode_title  | boolean         | If the episode title should be parsed.                          | True              |\n+----------------------+-----------------+-----------------------------------------------------------------+-------------------+\n| parse_file_extension | boolean         | If the file extension should be parsed.                         | True              |\n+----------------------+-----------------+-----------------------------------------------------------------+-------------------+\n| parse_release_group  | boolean         | If the release group should be parsed.                          | True              |\n+----------------------+-----------------+-----------------------------------------------------------------+-------------------+\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "An anime video filename parser",
    "version": "2.1.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "b072145079442d1475f98ea6c9d64b0c",
                "sha256": "515b97cd78917ee406313f4eb53bdc75e8a573e6ad5252ffd355c96a06988e26"
            },
            "downloads": -1,
            "filename": "anitopy-2.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b072145079442d1475f98ea6c9d64b0c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7",
            "size": 20890,
            "upload_time": "2022-07-24T10:24:27",
            "upload_time_iso_8601": "2022-07-24T10:24:27.230050Z",
            "url": "https://files.pythonhosted.org/packages/d3/8b/3da3f8ba73b8e4e5325a9ecbd6780f4dc9f41c98cc1c6a897800c4f85979/anitopy-2.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-07-24 10:24:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "igorcmoura",
    "github_project": "anitopy",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "enum34",
            "specs": []
        }
    ],
    "lcname": "anitopy"
}
        
Elapsed time: 0.02239s