✔️查看Cast Control Desktop Beta?
cast_control是一個守護程序,可讓您從Linux桌面上控製播放設備上的媒體播放。
在此服務運行時,它會收集有關媒體和應用程序在您的鑄造設備上播放的數據,並將其顯示在計算機上。
cast_control通過D-BUS和MPRIS媒體播放器控件控制Chromecast和鑄造設備。
MPRIS是Linux桌面上的標準媒體播放器界面。
默認情況下,在等離子桌面上啟用了MPRIS集成,並且與GNOME的音量控制小部件一起,也有用於Gnome的小部件。 playerctl提供了一個通過MPRI來控制媒體播放器的CLI。
如果要將MPRIS支持集成到您的媒體播放器中,請查看▶️ mpris_server 。
通過等離子體桌面的媒體播放器窗口小部件來控制染色體:


pyproject.toml中的project.dependencieshatchling在像Ubuntu這樣的Debian衍生的發行版中,請與apt安裝python3-gi 。
在Arch上,您需要安裝python-gobject和gobject-introspection ,或直接從AUR安裝cast_control 。
在MacOS上,通過brew安裝pygobject3 。
如果供應商的軟件包存儲庫中沒有安裝候選,請使用pip安裝PyGObject>=3.34.0 。
$ python3 -m pip install cast_control您將獲得cast_control可執行文件添加到$PATH中。
查看Github上的版本頁面以獲取穩定版本。
如果您想使用開發分支,請克隆存儲庫。
擁有源副本後,運行python3 -m pip install -r requirements.txt ,然後是python3 setup.py install 。
您將獲得cast_control可執行文件添加到$PATH中。
如果您在拱門上,則可以直接從AUR安裝cast_control 。謝謝,@yochananmarqos!
$ yay -S cast_control穩定的版本上傳到PYPI。您可以這樣升級cast_control安裝:
$ python3 -m pip --upgrade cast_control請參閱GitHub上的版本頁面。
您需要確保計算機可以與鑄造設備建立網絡連接。它還有助於事先了解設備的名稱。
通過PYPI,GITHUB或AUR安裝軟件包會將cast_control添加到您的pip可執行期路徑:
$ which cast_control
~ /.local/bin/cast_control如果將pip可執行文件路徑添加到外殼的$PATH中,則可以這樣啟動cast_control :
$ cast_control --help或者,使用短名稱啟動器castctl :
$ castctl --help您還可以通過其Python模塊啟動cast_control 。如果您的$PATH不指向您的pip可執行文件,這將很有用。
$ python3 -m cast_control --help要啟用cast_control的bash完成,請在您的~/.bashrc中添加以下內容:
eval " $( _CAST_CONTROL_COMPLETE=bash_source cast_control ) "對於zsh和fish ,請在此處查看文檔。
$ cast_control --help
Usage: cast_control [OPTIONS] COMMAND [ARGS]...
Control casting devices via Linux media controls and desktops.
This daemon connects your casting device directly to the D-Bus media player
interface.
See https://github.com/alexdelorenzo/cast_control for more information.
Options:
-L, --license Show license and copyright information.
-V, --version Show version information.
--help Show this message and exit.
Commands:
connect Connect to the device and run the service in the foreground.
service Connect, disconnect or reconnect the background service to or...connect命令$ cast_control connect --help
Usage: cast_control connect [OPTIONS]
Connect to the device and run the service in the foreground.
Options:
-n, --name TEXT Connect to a device via its name, otherwise control
the first device found.
-h, --host TEXT Connect to a device via its hostname or IP address,
otherwise control the first device found.
-u, --uuid TEXT Connect to a device via its UUID, otherwise control
the first device found.
-w, --wait FLOAT Seconds to wait between trying to make initial
successful connections to a device.
-r, --retry-wait FLOAT Seconds to wait between reconnection attempts if a
successful connection is interrupted. [default:
5.0]
-i, --icon Use a lighter icon instead of the dark icon. The
lighter icon goes well with dark themes. [default:
False]
-l, --log-level TEXT Set the debugging log level. [default: WARN]
--help Show this message and exit.service命令$ cast_control service --help
Usage: cast_control service [OPTIONS] COMMAND [ARGS]...
Connect, disconnect or reconnect the background service to or from your
device.
Options:
--help Show this message and exit.
Commands:
connect Connect the background service to the device.
disconnect Disconnect the background service from the device.
reconnect Reconnect the background service to the device.
log Show the service log.service connect命令$ cast_control service connect --help
Usage: cast_control service connect [OPTIONS]
Connect the background service to the device.
Options:
-n, --name TEXT Connect to a device via its name, otherwise control
the first device found.
-h, --host TEXT Connect to a device via its hostname or IP address,
otherwise control the first device found.
-u, --uuid TEXT Connect to a device via its UUID, otherwise control
the first device found.
-w, --wait FLOAT Seconds to wait between trying to make initial
successful connections to a device.
-r, --retry-wait FLOAT Seconds to wait between reconnection attempts if a
successful connection is interrupted. [default:
5.0]
-i, --icon Use a lighter icon instead of the dark icon. The
lighter icon goes well with dark themes. [default:
False]
-l, --log-level TEXT Set the debugging log level. [default: WARN]
--help Show this message and exit.連接到名為“我的設備”的設備:
$ cast_control connect --name " My Device "連接到名為“我的設備”的設備,並在後台運行cast_control :
$ cast_control service connect --name " My Device "啟動cast_control之後,您可以使用任何MPRIS客戶端與它進行交互。 MPRIS支持直接基於等離子桌面和GNOME 3,您可以在命令行上使用playerctl 。
您可以使用-w/--wait標誌在幾秒鐘內指定等待時間,然後如果最初找不到一個,則嘗試再次嘗試再次找到cast_control設備。
例如,如果您想在設備掃描之間等待60秒,則可以運行以下內容:
$ export SECONDS=60
$ cast_control connect --wait $SECONDS
# or
$ cast_control service connect --wait $SECONDS如果您想從登錄處啟動cast_control ,並且您的設備不在,或者您在其他網絡上,這將很有用。
如果背景服務正在運行,則可以強迫它重新連接和重新啟動,或完全斷開連接。
$ cast_control service reconnect
# or
$ cast_control service disconnect使用playerctl獲取設備的D-Bus名稱。
$ playerctl --list-all
My_Device使用D-Bus名稱向其發出命令。
$ export URL= " http://ccmixter.org/content/gmz/gmz_-_Parametaphoriquement.mp3 "
$ playerctl --player My_Device open " $URL "這將在您的設備上播放一首歌。
您可以按照施放通用URI的方式投放YouTube視頻。
$ export VIDEO= " https://www.youtube.com/watch?v=I4nkgJdVZFA "
$ playerctl --player My_Device open " $VIDEO "您可以使用-l/--log-level標誌,使用connect或service connect命令設置日誌級別:
$ cast_control connect --log-level debug這是cast_control支持的日誌級別列表。
您可以使用service log命令查看背景服務的日誌文件:
$ cast_control service log是否想支持這個項目和其他類似的開源項目?
請參閱LICENSE 。如果您想使用其他許可證使用此項目,請與您聯繫。