{"id":13907966,"url":"https://github.com/jcarbaugh/python-roku","last_synced_at":"2025-05-16T08:06:05.679Z","repository":{"id":12959535,"uuid":"15637861","full_name":"jcarbaugh/python-roku","owner":"jcarbaugh","description":"Screw remotes. Control your Roku with Python.","archived":false,"fork":false,"pushed_at":"2023-07-25T21:37:57.000Z","size":141,"stargazers_count":320,"open_issues_count":14,"forks_count":97,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-05-10T04:48:59.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/roku","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcarbaugh.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-04T19:09:41.000Z","updated_at":"2025-04-28T21:01:07.000Z","dependencies_parsed_at":"2024-06-18T22:43:18.889Z","dependency_job_id":"344223a5-a248-4251-b956-c602ded662df","html_url":"https://github.com/jcarbaugh/python-roku","commit_stats":{"total_commits":87,"total_committers":21,"mean_commits":4.142857142857143,"dds":0.4482758620689655,"last_synced_commit":"87952bd956c2068620f232f7cf291296d433379c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fpython-roku","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fpython-roku/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fpython-roku/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcarbaugh%2Fpython-roku/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcarbaugh","download_url":"https://codeload.github.com/jcarbaugh/python-roku/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493378,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T23:02:21.492Z","updated_at":"2025-05-16T08:06:00.671Z","avatar_url":"https://github.com/jcarbaugh.png","language":"Python","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"readme":"python-roku\n===========\n\nScrew remotes. Control your `Roku \u003chttp://www.roku.com\u003e`_ via Python.\n\nSupports Python 3.7 to 3.11.\n\n\nInstallation\n------------\n\n::\n\n    pip install roku\n\n\nUsage\n-----\n\n\nThe Basics\n~~~~~~~~~~\n\nTo start, import the Roku object and create it with the IP address or hostname of your Roku.\n::\n\n    \u003e\u003e\u003e from roku import Roku\n    \u003e\u003e\u003e roku = Roku('192.168.10.163')\n\nThe Roku object has a method for each of the buttons on the remote.\n::\n\n    \u003e\u003e\u003e roku.home()\n    \u003e\u003e\u003e roku.right()\n    \u003e\u003e\u003e roku.select()\n\nTo support keyup and keydown events simply pass \"keyup\" or \"keydown\" when you call the command.\n::\n\n    \u003e\u003e\u003e roku.right(\"keydown\")\n    \u003e\u003e\u003e roku.right(\"keyup\")\n\nTo see a full list of available commands, use the *commands* property.\n::\n\n    \u003e\u003e\u003e roku.commands\n    ['back', 'backspace', 'down', 'enter', 'forward', 'home', 'info', 'left', 'literal', 'play', 'replay', 'reverse', 'right', 'search', 'select', 'up']\n\nIf you are following along on your home network and are connected to your Roku, you should see it doing stuff. *Cool!*\n\n\nApps\n~~~~\n\nThe *apps* property will return a list of the applications on your device.\n::\n\n    \u003e\u003e\u003e roku.apps\n    [\u003cApplication: [2285] Hulu Plus v2.7.6\u003e, \u003cApplication: [13] Amazon Instant Video v5.1.3\u003e, \u003cApplication: [20445] VEVO v2.0.12092013\u003e]\n\nApps have *id*, *name*, and *version* properties.\n::\n\n    \u003e\u003e\u003e app = roku.apps[0]\n    \u003e\u003e\u003e print(app.id, app.name, app.version)\n    2285 Hulu Plus 2.7.6\n\nYou can get an individual app from the Roku object by either its *name* or *id*.\n::\n\n    \u003e\u003e\u003e roku['Hulu Plus']\n    \u003cApplication: [2285] Hulu Plus v2.7.6\u003e\n    \u003e\u003e\u003e roku[2285]\n    \u003cApplication: [2285] Hulu Plus v2.7.6\u003e\n\nSeeing the reference to this Hulu Plus app makes me really want to watch the latest episode of `Nashville \u003chttp://abc.go.com/shows/nashville\u003e`_. Let's launch it!\n::\n\n    \u003e\u003e\u003e hulu = roku['Hulu Plus']\n    \u003e\u003e\u003e hulu.launch()\n\nAgain, if you are following along at home, you should see that your Roku has launched the Hulu Plus app. Want to see the app's entry in the Channel Store?\n::\n\n    \u003e\u003e\u003e hulu.store()\n\nYou can also get the app's icon.\n::\n\n    \u003e\u003e\u003e with open('hulu.png', 'w') as f:\n    ...     f.write(hulu.icon)\n\n    \u003e\u003e\u003e print hulu.icon_url\n    http://0.0.0.0:8060/query/icon/2285\n\nYou can get the current running app.\n::\n\n    \u003e\u003e\u003e roku.active_app\n    \u003cApplication: [12] Netflix v4.2.75015046\u003e\n\n\nEntering Text\n~~~~~~~~~~~~~\n\nOkay, I've already seen all of the available episodes of Nashville, so I'm going to search for *Stargate*. With the search open and waiting for text entry::\n\n    \u003e\u003e\u003e roku.literal('stargate')\n\nWhat if I now want to watch *The Informant!*? Again, with the search open and waiting for text entry::\n\n    \u003e\u003e\u003e roku.literal('The Informant!')\n\nThis will iterate over each character, sending it individually to the Roku.\n\n\nAdvanced Stuff\n--------------\n\n\nDiscovery\n~~~~~~~~~\n\nRoku devices can be discovered using `SSDP \u003chttp://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol\u003e`_. A class method is available on the Roku object that will return Roku object instances for each device found on the same network.\n::\n\n    \u003e\u003e\u003e Roku.discover()\n    [\u003cRoku: 192.168.10.163:8060\u003e]\n\nIt may take a few seconds for a device to be found. You can call discover again or change the *timeout* or *retries* parameters on the discover method. This will take longer, but will find more devices.\n::\n\n    \u003e\u003e\u003e Roku.discover(timeout=10)\n    [\u003cRoku: 192.168.10.163:8060\u003e, \u003cRoku: 192.168.10.204:8060\u003e]\n\nThanks to `Dan Krause \u003chttps://github.com/dankrause\u003e`_ for his `SSDP code \u003chttps://gist.github.com/dankrause/6000248\u003e`_.\n\n\nSensors\n~~~~~~~\n\nNewer Roku remotes have extra sensors built into them that measure acceleration, orientation, and other things.You can mimic these sensors using the provided helper methods.\n::\n\n    \u003e\u003e\u003e roku.orientation(1, 1, 1)\n\nThe parameters to all of the sensor methods are x, y, and z values. Available methods include:\n\n* acceleration - in each dimension relative to free fall measured in meters/sec^2\n* magnetic - magnetic field strength in microtesla\n* orientation - angular displacement from flat/level and north in radians\n* rotation - angular rotation rate about each axis using the right hand rule in radians/sec\n\n\nTouch\n~~~~~\n\nSome Roku input devices support touch. The parameters to the *touch* method are the *x* and *y* coordinates of the touch.\n::\n\n    \u003e\u003e\u003e roku.touch(10, 40)\n\nYou can change the event triggered by passing an optional *op* parameter.\n::\n\n    \u003e\u003e\u003e roku.touch(10, 40, op='up')\n\nSupported events are:\n\n* down\n* up\n* press (down and up)\n* move\n* cancel\n\nMultitouch is not yet supported in this package.\n\nIntegrations\n~~~~~~~~~~~~\n* `pyrokuserve \u003chttps://github.com/lingster/pyrokuserve\u003e`_\n* `Home Assistant \u003chttps://www.home-assistant.io/components/roku/\u003e`_\n\nGeneric Input\n~~~~~~~~~~~~~\n\nBoth the sensor and touch methods rely on the generic *input* method for sending data to a running application. If you refuse to use covenience methods because they make people lazy and weak, you can call the sensor and touch methods directly.\n::\n\n    \u003e\u003e\u003e params = {'touch.0.x': 10, 'touch.0.y': 20, 'touch.0.op': 'press'}\n    \u003e\u003e\u003e roku.input(params)\n\nMore information about input, touch, and sensors is available in the `Roku External Control docs \u003chttp://sdkdocs.roku.com/display/sdkdoc/External+Control+Guide#ExternalControlGuide-31ExternalControlInputCommandConventions\u003e`_.\n\n\nTODO\n----\n\n* Tests, of course.\n* Multitouch support.\n* A Flask proxy server that can listen to requests and forward them to devices on the local network. Control multiple devices at once, eh?\n* A server that mimics the Roku interface so you can make your own Roku-like stuff.\n* A task runner that will take a set of commands and run them with delays that are appropriate for most devices.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcarbaugh%2Fpython-roku","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcarbaugh%2Fpython-roku","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcarbaugh%2Fpython-roku/lists"}