How do I get the currently playing song in Rhythmbox using Python

孤者浪人 提交于 2019-12-04 09:57:25

A workaround, used by lyricsdownloader.py, is:

import subprocess
import shlex

proc = subprocess.Popen(shlex.split('rhythmbox-client --no-start --print-playing-format %tt')))
title, err = proc.communicate()

Note: This does not work with Ubuntu 11.10, which shipped without rhythmbox-client.

This might be useful. https://github.com/aliva/rhythmbox-microblogger

It is a twitter plugin for RhythmBox. So instead of twitter and Gtk, you can just take the current song.

from gi.repository import RB

RB.RhythmDBPropType.TITLE will give enum which you can use to get the title.

I think that you've encountered a bug in Rhythmbox DBus interface described on Launchpad. Tracker says that fix is committed, but possibly your version doesn't have that fix.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!