{ "info": { "author": "Jonas Degrave", "author_email": "erstaateenknolraapinmijntuin+pythontwitch@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "Intended Audience :: Other Audience", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Topic :: Communications :: Chat :: Internet Relay Chat", "Topic :: Multimedia :: Video" ], "description": ".. image:: https://readthedocs.org/projects/python-twitch-stream/badge/\n :target: http://python-twitch-stream.readthedocs.org/en/latest/\n\n.. image:: https://travis-ci.org/317070/python-twitch-stream.svg\n :target: https://travis-ci.org/317070/python-twitch-stream\n\n.. image:: https://coveralls.io/repos/317070/python-twitch-stream/badge.svg\n :target: https://coveralls.io/github/317070/python-twitch-stream\n\n.. image:: https://img.shields.io/badge/license-MIT-green.svg\n :target: https://github.com/Lasagne/Lasagne/blob/master/LICENSE\n\nPython-Twitch-Stream\n====================\n\nPython-twitch-stream is a simple lightweight library, which you can use to\nsend your python video to twitch and react with the chat in real time.\nIts main features are:\n\n* Supports sending of audio and video in a thread safe way to your twitch\n channel.\n* Allows to interact with the chat of your channel by sending chat messages\n and reading what other users post.\n\n\nInstallation\n------------\n\nIn short, you can install a known compatible version of ffmpeg and\nthe latest stable version over pip.\n\n.. code-block:: bash\n\n pip install python-twitch-stream\n\nMake sure to also install a recent ffmpeg version:\n\n.. code-block:: bash\n\n sudo add-apt-repository ppa:mc3man/trusty-media\n sudo apt-get update && sudo apt-get install ffmpeg\n\nThe ffmpeg library needs to be very recent (written in october 2015).\nThere are plenty of bugs when\nrunning a stream using older versions of ffmpeg or avconv, including but\nnot limited to 6GB of memory use, problems with the audio and\nsynchronization of the audio and the video.\n\nOr alternatively, install the latest\npython-twitch-stream development version via:\n\n.. code-block:: bash\n\n pip install git+https://github.com/317070/python-twitch-stream\n\n\nDocumentation\n-------------\n\nDocumentation is available online: http://python-twitch-stream.readthedocs.org/\n\nFor support, please use the github issues on `the repository\n`_.\n\n\nExample\n-------\n\nThis is a small example which creates a twitch stream which\nchanges the color of the video according to the colors provided in\nthe chat.\n\n.. code-block:: python\n\n from __future__ import print_function\n from twitchstream.outputvideo import TwitchBufferedOutputStream\n from twitchstream.chat import TwitchChatStream\n import argparse\n import time\n import numpy as np\n\n if __name__ == \"__main__\":\n parser = argparse.ArgumentParser(description=__doc__)\n required = parser.add_argument_group('required arguments')\n required.add_argument('-u', '--username',\n help='twitch username',\n required=True)\n required.add_argument('-o', '--oauth',\n help='twitch oauth '\n '(visit https://twitchapps.com/tmi/ '\n 'to create one for your account)',\n required=True)\n required.add_argument('-s', '--streamkey',\n help='twitch streamkey',\n required=True)\n args = parser.parse_args()\n\n # load two streams:\n # * one stream to send the video\n # * one stream to interact with the chat\n with TwitchBufferedOutputStream(\n twitch_stream_key=args.streamkey,\n width=640,\n height=480,\n fps=30.,\n enable_audio=True,\n verbose=False) as videostream, \\\n TwitchChatStream(\n username=args.username.lower(), # Must provide a lowercase username.\n oauth=args.oauth,\n verbose=False) as chatstream:\n\n # Send a chat message to let everybody know you've arrived\n chatstream.send_chat_message(\"Taking requests!\")\n\n frame = np.zeros((480, 640, 3))\n frequency = 100\n last_phase = 0\n\n # The main loop to create videos\n while True:\n\n # Every loop, call to receive messages.\n # This is important, when it is not called,\n # Twitch will automatically log you out.\n # This call is non-blocking.\n received = chatstream.twitch_receive_messages()\n\n # process all the messages\n if received:\n for chat_message in received:\n print(\"Got a message '%s' from %s\" % (\n chat_message['message'],\n chat_message['username']\n ))\n if chat_message['message'] == \"red\":\n frame[:, :, :] = np.array(\n [1, 0, 0])[None, None, :]\n elif chat_message['message'] == \"green\":\n frame[:, :, :] = np.array(\n [0, 1, 0])[None, None, :]\n elif chat_message['message'] == \"blue\":\n frame[:, :, :] = np.array(\n [0, 0, 1])[None, None, :]\n elif chat_message['message'].isdigit():\n frequency = int(chat_message['message'])\n\n # If there are not enough video frames left,\n # add some more.\n if videostream.get_video_frame_buffer_state() < 30:\n videostream.send_video_frame(frame)\n\n # If there are not enough audio fragments left,\n # add some more, but take care to stay in sync with\n # the video! Audio and video buffer separately,\n # so they will go out of sync if the number of video\n # frames does not match the number of audio samples!\n elif videostream.get_audio_buffer_state() < 30:\n x = np.linspace(last_phase,\n last_phase +\n frequency*2*np.pi/videostream.fps,\n int(44100 / videostream.fps) + 1)\n last_phase = x[-1]\n audio = np.sin(x[:-1])\n videostream.send_audio(audio, audio)\n\n # If nothing is happening, it is okay to sleep for a while\n # and take some pressure of the CPU. But not too long, if\n # the buffers run dry, audio and video will go out of sync.\n else:\n time.sleep(.001)\n\n\nFor a fully-functional example, see `examples/color.py `_,\nand check the `Tutorial\n`_ for in-depth\nexplanations of the same. More examples are maintained in the `examples directory\n`_.\n\n\nDevelopment\n-----------\n\nPython-twitch-stream is a work in progress, but is stable. Feel free to ask\nfor features or add pull-requests with updates on the code.\n\n\nChangelog\n---------\n\n1.0 (2015-10-30)\n~~~~~~~~~~~~~~~~\n\nFirst release.\nFeatures:\n\n* Sending Twitch streams (video and audio)\n* Reading and sending Twitch chats.\n\n* core contributors, in alphabetical order:\n\n * Jonas Degrave (@317070)\n\n* Special thanks to\n\n * Frederik Tejner Witte for his `great tutorial `_!", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/317070/python-twitch-stream", "keywords": "twitch,stream,video,chat", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "python-twitch-stream", "package_url": "https://pypi.org/project/python-twitch-stream/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/python-twitch-stream/", "project_urls": { "Homepage": "https://github.com/317070/python-twitch-stream" }, "release_url": "https://pypi.org/project/python-twitch-stream/1.0.2/", "requires_dist": [ "numpy", "mock; extra == 'testing'", "pytest; extra == 'testing'", "pytest-cov; extra == 'testing'", "pytest-pep8; extra == 'testing'" ], "requires_python": "", "summary": "An interface to the Twitch website, to interact with their video and chat", "version": "1.0.2" }, "last_serial": 2079890, "releases": { "0.0.dev1": [ { "comment_text": "", "digests": { "md5": "14457122552b8b8db5e1c4b5e74eeeb8", "sha256": "923a8e90868ec49593418dbed238472d9f7b6eb0a2a5a725952695edcdc91d08" }, "downloads": -1, "filename": "python_twitch_stream-0.0.dev1-py2-none-any.whl", "has_sig": false, "md5_digest": "14457122552b8b8db5e1c4b5e74eeeb8", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13834, "upload_time": "2015-10-29T19:23:35", "url": "https://files.pythonhosted.org/packages/78/0b/7b4f28638249af930162278ad47e7dc0e61b1eccee4ef6804d661f318a8e/python_twitch_stream-0.0.dev1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6dbfe419e41acd6e26b92313e740945", "sha256": "3f8e10b8f53e0df9ee1b8471100d4bd457dcfa1c292d1bd96323a3a54dcef1e4" }, "downloads": -1, "filename": "python-twitch-stream-0.0.dev1.tar.gz", "has_sig": false, "md5_digest": "f6dbfe419e41acd6e26b92313e740945", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18114, "upload_time": "2015-10-29T19:23:20", "url": "https://files.pythonhosted.org/packages/55/67/a8e3523f5e1a8d21a99487939b8e178b7aae8c35a38257e4ee3d95c0107b/python-twitch-stream-0.0.dev1.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "45a57cf97498a5b87fb658955172b276", "sha256": "dc640fbe6a7e62b33425214f6c06bec09cec27f1701cadb47d3c6744f6dcc11e" }, "downloads": -1, "filename": "python_twitch_stream-1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "45a57cf97498a5b87fb658955172b276", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 18676, "upload_time": "2015-10-29T21:35:54", "url": "https://files.pythonhosted.org/packages/19/8e/5964d98255c71462aab6d93a211c6b825e62c92dd5424b9e148337e8b4f2/python_twitch_stream-1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0f6308a274cdeb56d59b854e6c25b760", "sha256": "69a36cf1737fec4e1240757ece6d3bb9c38ff46ad9a1edcab69b99f67d77748c" }, "downloads": -1, "filename": "python-twitch-stream-1.0.tar.gz", "has_sig": false, "md5_digest": "0f6308a274cdeb56d59b854e6c25b760", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22026, "upload_time": "2015-10-29T21:35:42", "url": "https://files.pythonhosted.org/packages/2d/f3/556992bea68f3ba5d0a99ea985ae7ffba112f7591127684205a781c2ca3e/python-twitch-stream-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "b2e86c470b88ca116d1c8df97649c063", "sha256": "a75a8c8c1cd66447d185adb7f558073602d83da95f0d877f4125e5567fe5b382" }, "downloads": -1, "filename": "python_twitch_stream-1.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "b2e86c470b88ca116d1c8df97649c063", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 18753, "upload_time": "2015-10-30T20:50:59", "url": "https://files.pythonhosted.org/packages/91/5d/b362fcf93c30bf3d880ee7f9b6a25df47e2177b99bfd937009c64b8bb3f9/python_twitch_stream-1.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4f14ed640166d72ebc02eba0d9d722ac", "sha256": "3aa63c0d166de637d1c7a9269d7c4d012f25d32fdf65f6427d70c9a7cd76f713" }, "downloads": -1, "filename": "python-twitch-stream-1.0.1.tar.gz", "has_sig": false, "md5_digest": "4f14ed640166d72ebc02eba0d9d722ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22123, "upload_time": "2015-10-30T20:50:37", "url": "https://files.pythonhosted.org/packages/8d/da/2b77ea77c4e7800a39d6f96b9729f39f92f6464bd952a4fe88a995c9be18/python-twitch-stream-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "2dfe37d0a212c594179b48b69a6c73b5", "sha256": "b33c90278bef71d17c1a85205067387c7c032c867cfffa8568c2062e082d3910" }, "downloads": -1, "filename": "python_twitch_stream-1.0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "2dfe37d0a212c594179b48b69a6c73b5", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 18809, "upload_time": "2016-04-23T13:19:59", "url": "https://files.pythonhosted.org/packages/b1/02/0b8af16deadf662dcd3c28a63b4fcb417729a0f858cbc9bcbc84ae6922fc/python_twitch_stream-1.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c30c0a0ac897c65cc24f856d363cdd4", "sha256": "03b2a43f28e0730d1708d5d5ac99fa69a763b887629f84e86499d1307260a0bb" }, "downloads": -1, "filename": "python_twitch_stream-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0c30c0a0ac897c65cc24f856d363cdd4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18802, "upload_time": "2016-04-23T12:21:53", "url": "https://files.pythonhosted.org/packages/3c/1c/fb821e36fa40316442f59c152d1632a46fceedd04056707c8950159d0671/python_twitch_stream-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f18f8bd245d27dc7c2510cc624cd3020", "sha256": "a38d950d1f4904d8316f2c7be375c0f08175a14059cd05c9134a07c8d2968aec" }, "downloads": -1, "filename": "python-twitch-stream-1.0.2.tar.gz", "has_sig": false, "md5_digest": "f18f8bd245d27dc7c2510cc624cd3020", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22188, "upload_time": "2016-04-23T13:19:07", "url": "https://files.pythonhosted.org/packages/7c/2f/df6319b8cf1c31e1e17ba5167bf02c00ddf04f0e5e8de936ef8132bb0595/python-twitch-stream-1.0.2.tar.gz" } ], "1.0.2b": [ { "comment_text": "", "digests": { "md5": "e4aacd15f4d3a53e74d6ffeb9d4412a5", "sha256": "3d94fcd2aa2fd58b72a62e4a8ee092b5d9ef4fe228dd97a72d2dadd952d2de8a" }, "downloads": -1, "filename": "python_twitch_stream-1.0.2b-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e4aacd15f4d3a53e74d6ffeb9d4412a5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18824, "upload_time": "2016-04-23T12:58:38", "url": "https://files.pythonhosted.org/packages/24/29/6eb458e3b6894a3bf98b3fa707af348b7db3442405c76057f0e995aa8a6d/python_twitch_stream-1.0.2b-py2.py3-none-any.whl" } ], "1.0.2c": [ { "comment_text": "", "digests": { "md5": "be08e7b0e2401f850f42abd1a4d63aa7", "sha256": "c33ae5d696ab167046cce8f18c6ecd0bcd310ff46540209174c022e36608657f" }, "downloads": -1, "filename": "python-twitch-stream-1.0.2c.tar.gz", "has_sig": false, "md5_digest": "be08e7b0e2401f850f42abd1a4d63aa7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22197, "upload_time": "2016-04-23T13:46:37", "url": "https://files.pythonhosted.org/packages/a0/52/fb0d04ef265810cf560e9e5e1d74f314c6930175eb06e503e63ad515448c/python-twitch-stream-1.0.2c.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2dfe37d0a212c594179b48b69a6c73b5", "sha256": "b33c90278bef71d17c1a85205067387c7c032c867cfffa8568c2062e082d3910" }, "downloads": -1, "filename": "python_twitch_stream-1.0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "2dfe37d0a212c594179b48b69a6c73b5", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 18809, "upload_time": "2016-04-23T13:19:59", "url": "https://files.pythonhosted.org/packages/b1/02/0b8af16deadf662dcd3c28a63b4fcb417729a0f858cbc9bcbc84ae6922fc/python_twitch_stream-1.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c30c0a0ac897c65cc24f856d363cdd4", "sha256": "03b2a43f28e0730d1708d5d5ac99fa69a763b887629f84e86499d1307260a0bb" }, "downloads": -1, "filename": "python_twitch_stream-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0c30c0a0ac897c65cc24f856d363cdd4", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18802, "upload_time": "2016-04-23T12:21:53", "url": "https://files.pythonhosted.org/packages/3c/1c/fb821e36fa40316442f59c152d1632a46fceedd04056707c8950159d0671/python_twitch_stream-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f18f8bd245d27dc7c2510cc624cd3020", "sha256": "a38d950d1f4904d8316f2c7be375c0f08175a14059cd05c9134a07c8d2968aec" }, "downloads": -1, "filename": "python-twitch-stream-1.0.2.tar.gz", "has_sig": false, "md5_digest": "f18f8bd245d27dc7c2510cc624cd3020", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22188, "upload_time": "2016-04-23T13:19:07", "url": "https://files.pythonhosted.org/packages/7c/2f/df6319b8cf1c31e1e17ba5167bf02c00ddf04f0e5e8de936ef8132bb0595/python-twitch-stream-1.0.2.tar.gz" } ] }