# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['bgmi',
 'bgmi.downloader',
 'bgmi.front',
 'bgmi.lib',
 'bgmi.utils',
 'bgmi.website']

package_data = \
{'': ['*'], 'bgmi': ['others/*'], 'bgmi.front': ['templates/*']}

install_requires = \
['beautifulsoup4==4.9.1',
 'icalendar==4.0.6',
 'importlib-metadata==1.7.0',
 'peewee==3.13.3',
 'pydantic==1.6.1',
 'requests==2.24.0',
 'tornado==6.0.4',
 'transmission-rpc==3.2.1',
 'wcwidth>=0.2.5,<0.3.0']

entry_points = \
{'console_scripts': ['bgmi = bgmi.main:main',
                     'bgmi_http = bgmi.front.server:main']}

setup_kwargs = {
    'name': 'bgmi',
    'version': '2.1.4',
    'description': 'BGmi is a cli tool for subscribed bangumi.',
    'long_description': 'BGmi\n====\nBGmi is a cli tool for subscribed bangumi.\n\n`中文说明 <./README.cn.md>`_\n\n|pypi|\n|download|\n|pipeline|\n|coverage|\n|license|\n\n====\nTODO\n====\n\n\n==========\nUpdate Log\n==========\n+ Remove python3.4 support as it has reached its end-of-life\n+ Remove Python2 support\n+ Transmission rpc authentication configuration\n+ New download delegate `deluge-rpc <https://www.deluge-torrent.org/>`_\n+ You can filter search results by min and max episode\n\n=======\nFeature\n=======\n+ Multi data sources supported: `bangumi_moe <https://bangumi.moe>`_, `mikan_project <https://mikanani.me>`_ or `dmhy <https://share.dmhy.org/>`_\n+ Use aria2, transmission or deluge to download bangumi\n+ Web interface to manage bangumi with HTTP API\n+ Play bangumi online with danmaku\n+ RSS feed for uTorrent, ICS calendar for mobile devices\n+ Bangumi Script: Write your own bangumi parser!\n+ Bangumi calendar / episode information\n+ Keyword, subtitle group, regular expression filters for download bangumi\n+ Windows, Linux and Router system supported, BGmi everywhere\n\n.. image:: ./images/bgmi_cli.png?raw=true\n    :alt: BGmi\n    :align: center\n.. image:: ./images/bgmi_http.png?raw=true\n    :alt: BGmi HTTP Service\n    :align: center\n.. image:: ./images/bgmi_player.png?raw=true\n    :alt: BGmi HTTP Service\n    :align: center\n.. image:: ./images/bgmi_admin.png?raw=true\n    :alt: BGmi HTTP Service\n    :align: center\n\n============\nInstallation\n============\n\nUse pip:\n\n.. code-block:: bash\n\n    pip install bgmi\n\nOr from source(not recommended):\n\n.. code-block:: bash\n\n    git clone https://github.com/BGmi/BGmi\n    cd BGmi\n    python -m pip install -U pip\n    pip install .\n\nInit BGmi database and install BGmi web interface:\n\n.. code-block:: bash\n\n    bgmi install\n\n============\nUpgrade\n============\n.. code-block:: bash\n\n    pip install bgmi -U\n    bgmi upgrade\n\nMake sure to run :code:`bgmi upgrade` after you upgrade your bgmi\n\n======\nDocker\n======\n\ngo to `BGmi/bgmi-docker-all-in-one <https://github.com/BGmi/bgmi-docker-all-in-one>`_\n\n=============\nUsage of bgmi\n=============\nCli completion(bash and zsh. Shell was detected from your env $SHELL)\n\n.. code-block:: bash\n\n    eval "$(bgmi complete)"\n\nIf you want to setup a custom BGMI_PATH instead of default ``$HOME/.bgmi``:\n\n.. code-block:: bash\n\n    BGMI_PATH=/bgmi bgmi -h\n\nOr add this code to your .bashrc file:\n\n.. code-block:: bash\n\n    alias bgmi=\'BGMI_PATH=/tmp bgmi\'\n\nSupported data source:\n\n+ `bangumi_moe(default) <https://bangumi.moe>`_\n+ `mikan_project <https://mikanani.me>`_\n+ `dmhy <https://share.dmhy.org/>`_\n\nHelp\n------\n\nyou can add ``--help`` to all ``BGmi`` sub command to show full options, some of them are not mentioned here.\n\nChange data source:\n---------------------\n\n**All bangumi in database will be deleted when changing data source!** but scripts won\'t be affected\n\nvideo files will still store on the disk, but won\'t be shown on website.\n\n.. code-block:: bash\n\n    bgmi source mikan_project\n\n\nShow bangumi calendar:\n--------------------------\n\n.. code-block:: bash\n\n    bgmi cal\n\n\nSubscribe bangumi:\n---------------------\n\n.. code-block:: bash\n\n    bgmi add "Re:CREATORS" "夏目友人帐 陆" "进击的巨人 season 2"\n    bgmi add "樱花任务" --episode 0\n\n\nUnsubscribe bangumi:\n---------------------\n\n.. code-block:: bash\n\n    bgmi delete --name "Re:CREATORS"\n\nUpdate bangumi:\n-----------------\n\nUpdate bangumi database which locates at ~/.bgmi/bangumi.db acquiescently:\n\n.. code-block:: bash\n\n    bgmi update --download\n    bgmi update "从零开始的魔法书" --download 2 3\n    bgmi update "时钟机关之星" --download\n\nFilter download:\n-----------------\n\nSet up the bangumi subtitle group filter and fetch entries:\n\n.. code-block:: bash\n\n    bgmi list\n    bgmi fetch "Re:CREATORS"\n    bgmi filter "Re:CREATORS" --subtitle "DHR動研字幕組,豌豆字幕组" --include 720P --exclude BIG5\n    bgmi fetch "Re:CREATORS"\n    # remove subtitle, include and exclude keyword filter and add regex filter\n    bgmi filter "Re:CREATORS" --subtitle "" --include "" --exclude ""\n    bgmi filter "Re:CREATORS" --regex "(DHR動研字幕組|豌豆字幕组).*(720P)"\n    bgmi fetch "Re:CREATORS"\n\nSearch episodes:\n-----------------\n\n.. code-block:: bash\n\n    bgmi search \'为美好的世界献上祝福！\' --regex-filter \'.*动漫国字幕组.*为美好的世界献上祝福！].*720P.*\'\n    # download\n    bgmi search \'为美好的世界献上祝福！\' --regex-filter \'.*合集.*\' --download\n\n\nModify bangumi episode:\n\n.. code-block:: bash\n\n    bgmi list\n    bgmi mark "Re:CREATORS" 1\n\n\nManage download items:\n\n.. code-block:: bash\n\n    bgmi download --list\n    bgmi download --list --status 0\n    bgmi download --mark 1 --status 2\n\nStatus code:\n\n+ 0 - Not downloaded items\n+ 1 - Downloading items\n+ 2 - Downloaded items\n\nShow BGmi configure and modify it:\n\n.. code-block:: bash\n\n    bgmi config\n    bgmi config ARIA2_RPC_TOKEN \'token:token233\'\n\nFields of configure file:\n\nBGmi configure:\n\n+ :code:`BANGUMI_MOE_URL`: url of bangumi.moe mirror\n+ :code:`SAVE_PATH`: bangumi saving path\n+ :code:`DOWNLOAD_DELEGATE`: the ways of downloading bangumi (aria2-rpc, transmission-rpc, xunlei)\n+ :code:`MAX_PAGE`: max page for fetching bangumi information\n+ :code:`TMP_PATH`: just a temporary path\n+ :code:`DANMAKU_API_URL`: url of danmaku api\n+ :code:`LANG`: language\n\nAria2-rpc configure:\n\n+ :code:`ARIA2_RPC_URL`: aria2c daemon RPC url, not jsonrpc url.("http://localhost:6800/rpc" for localhost)\n+ :code:`ARIA2_RPC_TOKEN`: aria2c daemon RPC token("token:" for no token)\n\nXunlei configure:\n\nXunleiLixian is deprecated, please choose aria2-rpc or transmission-rpc.\n\n+ :code:`XUNLEI_LX_PATH`: path of xunlei-lixian binary\n\nTransmission-rpc configure:\n\n+ :code:`TRANSMISSION_RPC_URL`: transmission rpc host\n+ :code:`TRANSMISSION_RPC_PORT`: transmission rpc port\n+ :code:`TRANSMISSION_RPC_USERNAME`: transmission rpc username (leave it default if you don\'t set rpc authentication)\n+ :code:`TRANSMISSION_RPC_PASSWORD`: transmission rpc password (leave it default if you don\'t set rpc authentication)\n\nDeluge-rpc configure:\n\n+ :code:`DELUGE_RPC_URL`: deluge rpc url\n+ :code:`DELUGE_RPC_PASSWORD`: deluge rpc password\n\n==================\nUsage of bgmi_http\n==================\nDownload all bangumi cover:\n\n.. code-block:: bash\n\n    bgmi cal --download-cover\n\nDownload frontend static files(you may have done it before):\n\n.. code-block:: bash\n\n    bgmi install\n\nStart BGmi HTTP Service bind on :code:`0.0.0.0:8888`:\n\n.. code-block:: bash\n\n    bgmi_http --port=8888 --address=0.0.0.0\n\nUse bgmi_http on Windows\n------------------------\nJust start your bgmi_http and open `http://localhost:8888/ <http://localhost:8888/>`_ in your browser.\n\nConsider most people won\'t use Nginx on Windows, bgmi_http use tornado.web.StaticFileHandler to serve static files(frontend, bangumi covers, bangumi files) without Nginx.\n\nUse bgmi_http on Linux\n----------------------\nGenerate Nginx config\n\n.. code-block:: bash\n\n    bgmi gen nginx.conf --server-name bgmi.whatever.com > bgmi.whatever.com\n\nOr write your config file manually.\n\n.. code-block:: nginx\n\n    server {\n        listen 80;\n        server_name bgmi;\n\n        root /path/to/bgmi;\n        autoindex on;\n        charset utf-8;\n\n        location /bangumi {\n            # ~/.bgmi/bangumi\n            alias /path/to/bangumi;\n        }\n\n        location /api {\n            proxy_pass http://127.0.0.1:8888;\n            # Requests to api/update may take more than 60s\n            proxy_connect_timeout 500s;\n            proxy_read_timeout 500s;\n            proxy_send_timeout 500s;\n        }\n\n        location /resource {\n            proxy_pass http://127.0.0.1:8888;\n        }\n\n        location / {\n            # ~/.bgmi/front_static/;\n            alias /path/to/front_static/;\n        }\n\n    }\n\nOf cause you can use `yaaw <https://github.com/binux/yaaw/>`_ to manage download items if you use aria2c to download bangumi.\n\n.. code-block:: nginx\n\n    ...\n    location /yaaw {\n        alias /path/to/yaaw;\n    }\n\n    location /jsonrpc {\n        # aria2c rpc\n        proxy_pass http://127.0.0.1:6800;\n    }\n    ...\n\nExample file: `bgmi.conf <https://github.com/BGmi/BGmi/blob/dev/bgmi.conf>`_\n\nmacOS launchctl service controller\n----------------------------------\nsee `issue #77 <https://github.com/BGmi/BGmi/pull/77>`_\n\n`me.ricterz.bgmi.plist <https://github.com/BGmi/BGmi/blob/master/bgmi/others/me.ricterz.bgmi.plist>`_\n\n===================\nDPlayer and Danmaku\n===================\n\nBGmi use `DPlayer <https://github.com/DIYgod/DPlayer>`_ to play bangumi.\n\nFirst, setup nginx to access bangumi files.\nSecond, choose one danmaku backend at `DPlayer#related-projects <https://github.com/DIYgod/DPlayer#related-projects>`_.\n\nUse :code:`bgmi config` to setup the url of danmaku api.\n\n.. code-block:: bash\n\n    bgmi config DANMAKU_API_URL https://api.prprpr.me/dplayer/ # This api is provided by dplayer official\n\n...restart your :code:`bgmi_http` and enjoy :D\n\n==============\nBangumi Script\n==============\n\nBangumi Script is a script which you can write the bangumi parser own.\nBGmi will load the script and call the method you write before the native functionality.\n\nBangumi Script Runner will catch the data you returned, update the database, and download the bangumi.\nYou only just write the parser and return the data.\n\nBangumi Script is located at :code:`BGMI_PATH/script`, inherited :code:`ScriptBase` class.\n\nexamples: `script_example.py <./script_example.py>`_\n\n``get_download_url`` returns a dict as follows.\n\n.. code-block:: python\n\n    {\n        1: \'http://example.com/Bangumi/1/1.torrent\',\n        2: \'http://example.com/Bangumi/1/2.torrent\',\n        3: \'http://example.com/Bangumi/1/3.torrent\'\n    }\n\nThe keys `1`, `2`, `3` is the episode, the value is the url of bangumi, make sure your download delegate support it..\n\n================\nBGmi Data Source\n================\nYou can easily add your own BGmi data source by extending BGmi website base class and implement all the method.\n\n.. code-block:: python\n\n    from typing import List, Optional\n\n    from bgmi.website.base import BaseWebsite\n    from bgmi.website.model import WebsiteBangumi, Episode\n\n\n    class DataSource(BaseWebsite):\n        def search_by_keyword(\n            self, keyword: str, count: int\n        ) -> List[Episode]:  # pragma: no cover\n            """\n\n            :param keyword: search key word\n            :param count: how many page to fetch from website\n            :return: list of episode search result\n            """\n            raise NotImplementedError\n\n        def fetch_bangumi_calendar(self,) -> List[WebsiteBangumi]:  # pragma: no cover\n            """\n            return a list of all bangumi and a list of all subtitle group\n\n            list of bangumi dict:\n            update time should be one of [\'Sun\', \'Mon\', \'Tue\', \'Wed\', \'Thu\', \'Fri\', \'Sat\', \'Unknown\']\n            """\n            raise NotImplementedError\n\n        def fetch_episode_of_bangumi(\n            self, bangumi_id: str, max_page: int, subtitle_list: Optional[List[str]] = None\n        ) -> List[Episode]:  # pragma: no cover\n            """\n            get all episode by bangumi id\n\n            :param bangumi_id: bangumi_id\n            :param subtitle_list: list of subtitle group\n            :type subtitle_list: list\n            :param max_page: how many page you want to crawl if there is no subtitle list\n            :type max_page: int\n            :return: list of bangumi\n            """\n            raise NotImplementedError\n\n\n        def fetch_single_bangumi(self, bangumi_id: str) -> WebsiteBangumi:\n            """\n            fetch bangumi info when updating\n\n            :param bangumi_id: bangumi_id, or bangumi[\'keyword\']\n            :type bangumi_id: str\n            :rtype: WebsiteBangumi\n            """\n            # return WebsiteBangumi(keyword=bangumi_id) if website don\'t has a page contains episodes and info\n\n===================\nDebug\n===================\nSet env :code:`BGMI_LOG` to :code:`debug`, :code:`info`, :code:`warning`, :code:`error` for different log level\n\nlog file will locate at :code:`{TMP_PATH}/bgmi.log`\n\n\n===================\nUninstall\n===================\nScheduled task will not be delete automatically, you will have to remove them manually.\n\n``*nix``:\n    remove them from your crontab\n\n``windows``:\n\n.. code-block:: powershell\n\n    schtasks /Delete /TN \'bgmi updater\'\n\n=======\nLicense\n=======\n\n`MIT License <https://github.com/BGmi/BGmi/blob/master/LICENSE>`_\n\n.. |pypi| image:: https://img.shields.io/pypi/v/bgmi.svg\n   :target: https://pypi.python.org/pypi/bgmi\n\n.. |pipeline| image:: https://dev.azure.com/BGmi/BGmi/_apis/build/status/BGmi.BGmi?branchName=master\n   :target: https://dev.azure.com/BGmi/BGmi/_apis/build/status/BGmi.BGmi?branchName=master\n\n.. |coverage| image:: https://codecov.io/gh/BGmi/BGmi/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/BGmi/BGmi\n\n.. |license| image:: https://img.shields.io/badge/License-MIT-blue.svg\n   :target: https://github.com/BGmi/BGmi/blob/master/LICENSE\n\n.. |download| image:: https://pepy.tech/badge/bgmi/month\n   :target: https://pepy.tech/project/bgmi\n',
    'author': 'RicterZ',
    'author_email': 'ricterzheng@gmail.com',
    'maintainer': 'Trim21',
    'maintainer_email': 'i@trim21.me',
    'url': 'https://github.com/BGmi/BGmi',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.6.1,<4.0.0',
}


setup(**setup_kwargs)
