{"id":13586419,"url":"https://github.com/alexdelorenzo/cast_control","last_synced_at":"2025-05-15T04:08:12.822Z","repository":{"id":37594290,"uuid":"257417024","full_name":"alexdelorenzo/cast_control","owner":"alexdelorenzo","description":"📺 Control Chromecasts from Linux and D-Bus","archived":false,"fork":false,"pushed_at":"2024-11-18T18:49:53.000Z","size":3231,"stargazers_count":488,"open_issues_count":11,"forks_count":8,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-04T02:04:09.920Z","etag":null,"topics":["chromecast","control-chromecasts","d-bus","gnome","linux","linux-desktop","media","media-player","mpris","mpris2","plasma-desktop","playback","playback-information","pygobject","python-library","python3"],"latest_commit_sha":null,"homepage":"https://cast.firstbyte.dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexdelorenzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["alexdelorenzo"]}},"created_at":"2020-04-20T22:19:12.000Z","updated_at":"2025-04-23T18:37:13.000Z","dependencies_parsed_at":"2023-07-14T06:08:28.482Z","dependency_job_id":"b99ef4dd-040d-4137-b0c2-329a7338d202","html_url":"https://github.com/alexdelorenzo/cast_control","commit_stats":{"total_commits":585,"total_committers":4,"mean_commits":146.25,"dds":0.6136752136752137,"last_synced_commit":"023f349cdc95d6d284cb320e1037f36ea2255348"},"previous_names":["alexdelorenzo/chromecast_mpris"],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdelorenzo%2Fcast_control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdelorenzo%2Fcast_control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdelorenzo%2Fcast_control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdelorenzo%2Fcast_control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexdelorenzo","download_url":"https://codeload.github.com/alexdelorenzo/cast_control/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270656,"owners_count":22042860,"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":["chromecast","control-chromecasts","d-bus","gnome","linux","linux-desktop","media","media-player","mpris","mpris2","plasma-desktop","playback","playback-information","pygobject","python-library","python3"],"created_at":"2024-08-01T15:05:33.579Z","updated_at":"2025-05-15T04:08:07.802Z","avatar_url":"https://github.com/alexdelorenzo.png","language":"Python","funding_links":["https://github.com/sponsors/alexdelorenzo","https://www.buymeacoffee.com/alexdelorenzo"],"categories":["Python"],"sub_categories":[],"readme":"\u003ch2\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cstrong\u003e\n      ✔️ Check out\n      \u003ca href=\"https://cast.firstbyte.dev/\" title=\"Cast Control Desktop - Control your streaming devices from your computer\" \u003eCast Control Desktop 📺\u003c/a\u003e\n      beta 👍\n    \u003c/strong\u003e\n  \u003c/p\u003e\n\u003c/h2\u003e\n\n\n# 📺 Control Chromecasts from Linux\n\n`cast_control` is [a daemon](https://en.wikipedia.org/wiki/Daemon_(computing)) utility that allows you to control media\nplayback on casting devices from the Linux desktop.\n\nWhile this service runs, it collects data about the media and apps playing on your casting devices and displays it on your computer.\n\n### Integrations\n\n`cast_control` controls Chromecasts and casting devices via D-Bus\nand [MPRIS media player controls](https://specifications.freedesktop.org/mpris-spec/2.2/).\n\nMPRIS is the standard media player interface on Linux desktops.\n\nMPRIS integration is [enabled by default](https://github.com/KDE/plasma-workspace/tree/master/applets/mediacontroller)\nin Plasma Desktop, and, along with GNOME's volume control\nwidget, [there are widgets for GNOME](https://extensions.gnome.org/extension/1379/mpris-indicator-button/), too. [\n`playerctl` provides a CLI](https://github.com/altdesktop/playerctl) for controlling media players through MPRIS.\n\nCheck out [`▶️ mpris_server`](https://github.com/alexdelorenzo/mpris_server) if you want to integrate MPRIS support into\nyour media player.\n\n## Screenshots\n\nControlling a Chromecast via Plasma Desktop's Media Player widget:\n\n\u003cimg src=\"https://github.com/alexdelorenzo/chromecast_mpris/raw/name_change/cast_control/assets/mpris_widget.png\" height=\"225\" /\u003e \u003cimg src=\"https://github.com/alexdelorenzo/chromecast_mpris/raw/name_change/cast_control/assets/mpris_plasma.png\" height=\"225\" /\u003e\n\n## Features\n\n* [x] Control music and video playback\n* [x] Control app playback\n* [x] View playback information in real-time\n* [x] Display thumbnail and title\n* [x] Display playback position and media length\n* [x] Seek forward and backward\n* [x] Play, pause, and stop playback\n* [x] Volume up and down\n* [x] Play next and previous\n* [x] Quit casted app\n* [x] Open media from D-Bus\n* [x] Play YouTube videos\n* [ ] Playlist integration\n\n## Installation\n\n### Requirements\n\n- Python \u003e= 3.12\n- Linux / *BSD / [macOS](https://github.com/zbentley/dbus-osx-examples)\n- [D-Bus](https://www.freedesktop.org/wiki/Software/dbus/)\n- [PyGObject](https://pypi.org/project/PyGObject/)\n- See `project.dependencies` in `pyproject.toml`\n\n### Build requirements\n\n- Python \u003e=3.12\n- [Rye](https://rye.astral.sh/)\n- `hatchling`\n- All installation requirements\n\n\n#### Installing PyGObject\n\nOn Debian-derived distributions like Ubuntu, install `python3-gi` with `apt`.\n\nOn Arch, you'll want to install `python-gobject` and `gobject-introspection`, or install\n`cast_control` [directly from the AUR](https://aur.archlinux.org/packages/cast_control/).\n\nOn macOS, install [`pygobject3`](https://formulae.brew.sh/formula/pygobject3) via `brew`.\n\nUse `pip` to install `PyGObject\u003e=3.34.0` if there are no installation candidates available in your vendor's package\nrepositories.\n\n### PyPI\n\n```bash\n$ python3 -m pip install cast_control\n```\n\nYou'll get a `cast_control` executable added to your `$PATH`.\n\n### GitHub\n\nCheck out [the releases page on GitHub](https://github.com/alexdelorenzo/cast_control/releases) for stable releases.\n\nIf you'd like to use the development branch, clone the repository.\n\nOnce you have a source copy, run `python3 -m pip install -r requirements.txt`, followed by `python3 setup.py install`.\n\nYou'll get a `cast_control` executable added to your `$PATH`.\n\n### AUR\n\nIf you're on Arch, you can install\n`cast_control` [directly from the AUR](https://aur.archlinux.org/packages/cast_control/).\nThanks, [@yochananmarqos](https://github.com/yochananmarqos)!\n\n```bash\n$ yay -S cast_control\n```\n\n### Upgrades\n\nStable releases are uploaded to PyPI. You can upgrade your `cast_control` installation like so:\n\n```bash\n$ python3 -m pip --upgrade cast_control\n```\n\nSee the [releases page](https://github.com/alexdelorenzo/cast_control/releases) on GitHub.\n\n## Usage\n\nYou'll need to make sure that your computer can make network connections with your casting devices. It also helps to\nknow the names of the devices in advance.\n\n### Launch\n\nInstalling the package via PyPI, GitHub or the AUR will add `cast_control` to your `pip` executables path:\n\n```bash\n$ which cast_control \n~/.local/bin/cast_control\n```\n\nIf you have your `pip` executables path added to your shell's `$PATH`, you can launch `cast_control` like so:\n\n```bash\n$ cast_control --help\n```\n\nOr, using the short name launcher `castctl`:\n\n```bash\n$ castctl --help\n```\n\nYou can also launch `cast_control` via its Python module. This can be useful if your `$PATH` doesn't point to your `pip`\nexecutables.\n\n```bash\n$ python3 -m cast_control --help\n```\n\n### Help\n\n#### Shell completion\n\nTo enable Bash completion for `cast_control`, add the following to your `~/.bashrc`:\n\n```bash\neval \"$(_CAST_CONTROL_COMPLETE=bash_source cast_control)\"\n```\n\nFor the `zsh` and `fish` shells, check\nout [the documentation here](https://click.palletsprojects.com/en/8.0.x/shell-completion/#enabling-completion).\n\n#### Help text\n\n```bash\n$ cast_control --help\nUsage: cast_control [OPTIONS] COMMAND [ARGS]...\n\n  Control casting devices via Linux media controls and desktops.\n\n  This daemon connects your casting device directly to the D-Bus media player\n  interface.\n\n  See https://github.com/alexdelorenzo/cast_control for more information.\n\nOptions:\n  -L, --license  Show license and copyright information.\n  -V, --version  Show version information.\n  --help         Show this message and exit.\n\nCommands:\n  connect  Connect to the device and run the service in the foreground.\n  service  Connect, disconnect or reconnect the background service to or...\n```\n\n##### `connect` command\n\n```bash\n$ cast_control connect --help\nUsage: cast_control connect [OPTIONS]\n\n  Connect to the device and run the service in the foreground.\n\nOptions:\n  -n, --name TEXT         Connect to a device via its name, otherwise control\n                          the first device found.\n  -h, --host TEXT         Connect to a device via its hostname or IP address,\n                          otherwise control the first device found.\n  -u, --uuid TEXT         Connect to a device via its UUID, otherwise control\n                          the first device found.\n  -w, --wait FLOAT        Seconds to wait between trying to make initial\n                          successful connections to a device.\n  -r, --retry-wait FLOAT  Seconds to wait between reconnection attempts if a\n                          successful connection is interrupted.  [default:\n                          5.0]\n  -i, --icon              Use a lighter icon instead of the dark icon. The\n                          lighter icon goes well with dark themes.  [default:\n                          False]\n  -l, --log-level TEXT    Set the debugging log level.  [default: WARN]\n  --help                  Show this message and exit.\n```\n\n##### `service` command\n\n```bash\n$ cast_control service --help\nUsage: cast_control service [OPTIONS] COMMAND [ARGS]...\n\n  Connect, disconnect or reconnect the background service to or from your\n  device.\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  connect     Connect the background service to the device.\n  disconnect  Disconnect the background service from the device.\n  reconnect   Reconnect the background service to the device.\n  log         Show the service log.\n```\n\n###### `service connect` command\n\n```bash\n$ cast_control service connect --help\nUsage: cast_control service connect [OPTIONS]\n\n  Connect the background service to the device.\n\nOptions:\n  -n, --name TEXT         Connect to a device via its name, otherwise control\n                          the first device found.\n  -h, --host TEXT         Connect to a device via its hostname or IP address,\n                          otherwise control the first device found.\n  -u, --uuid TEXT         Connect to a device via its UUID, otherwise control\n                          the first device found.\n  -w, --wait FLOAT        Seconds to wait between trying to make initial\n                          successful connections to a device.\n  -r, --retry-wait FLOAT  Seconds to wait between reconnection attempts if a\n                          successful connection is interrupted.  [default:\n                          5.0]\n  -i, --icon              Use a lighter icon instead of the dark icon. The\n                          lighter icon goes well with dark themes.  [default:\n                          False]\n  -l, --log-level TEXT    Set the debugging log level.  [default: WARN]\n  --help                  Show this message and exit.\n```\n\n### Connect to a device\n\nConnect to a device named \"My Device\":\n\n```bash\n$ cast_control connect --name \"My Device\"\n```\n\nConnect to a device named \"My Device\" and run `cast_control` in the background:\n\n```bash\n$ cast_control service connect --name \"My Device\"\n```\n\nAfter launching `cast_control`, you can use any MPRIS client to interact with it. MPRIS support is built in directly to\nPlasma Desktop and GNOME 3, and you can use `playerctl` on the command-line.\n\n### Retry until a Chromecast is found\n\nYou can use the `-w/--wait` flag to specify a waiting period in seconds before `cast_control` will try to find a casting\ndevice again if one is not found initially.\n\nFor example, if you want to wait 60 seconds between scans for devices, you can run the following:\n\n```bash\n$ export SECONDS=60\n$ cast_control connect --wait $SECONDS\n# or\n$ cast_control service connect --wait $SECONDS\n```\n\nThis is useful if you'd like to start `cast_control` at login, and there is a chance that your device isn't on, or\nyou're on a different network.\n\n### Reconnect or disconnect the background service\n\nIf the background service is running, you can force it to reconnect and restart, or disconnect it entirely.\n\n```bash\n$ cast_control service reconnect\n# or\n$ cast_control service disconnect\n```\n\n### Open a URI on a Chromecast\n\nGet the D-Bus name for your device using `playerctl`.\n\n```bash\n$ playerctl --list-all\nMy_Device\n```\n\nUse the D-Bus name to issue commands to it.\n\n```bash\n$ export URL=\"http://ccmixter.org/content/gmz/gmz_-_Parametaphoriquement.mp3\"\n$ playerctl --player My_Device open \"$URL\"\n```\n\nThis will play a song on your device.\n\n### Open a YouTube video\n\nYou can cast YouTube videos the same way you can cast a generic URI.\n\n```bash\n$ export VIDEO=\"https://www.youtube.com/watch?v=I4nkgJdVZFA\"\n$ playerctl --player My_Device open \"$VIDEO\"\n```\n\n### Logs\n\nYou can set the log level using the `-l/--log-level` flag with the `connect` or `service connect` commands:\n\n```bash\n$ cast_control connect --log-level debug\n```\n\nHere's a [list of log levels supported by\n`cast_control`](https://docs.python.org/3/library/logging.html#logging-levels).\n\nYou can view the background service's log file with the `service log` command:\n\n```bash\n$ cast_control service log\n```\n\n## Support\n\nWant to support this project and [other open-source projects](https://github.com/alexdelorenzo) like it?\n\n\u003ca href=\"https://www.buymeacoffee.com/alexdelorenzo\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-blue.png\" alt=\"Buy Me A Coffee\" height=\"60px\" style=\"height: 60px !important;width: 217px !important;max-width:25%\" \u003e\u003c/a\u003e\n\n## License\n\nSee `LICENSE`. If you'd like to use this project with a different license, please get in touch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdelorenzo%2Fcast_control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexdelorenzo%2Fcast_control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdelorenzo%2Fcast_control/lists"}