开发者

get rhythmbox information from other user

I have Rhythmbox running on my desktop, and I want to be able to control it from remotely via a web interface. I'm having problems accessing it, however, because rhythmbox-client is complaining that the user (www-data) that is trying to access it doesn't a) have as X session running, and b) doesn't have access to my rhythmbox dbus information.

(rhythmbox-client:13954): Rhythmbox-WARNING **: /bin/dbus-launch terminated abnormally with the following error: Autolaunch error: 开发者_Python百科X11 initialization failed.

I'm running apache, php on ubuntu 10.04. The following methods have also been tried by calling the php script via php cli from a different user (sshing into my own box with a different user)

I've tried these approaches:

  • calling system() and exec() from the php script with "rhythmbox-client --print-playing --no-start --no-resent"
  • using DBus directly in php as well as a python script (calling it from the php script with system()/exec())
  • using setuid(), setruid(), seteuid() in a C program and calling it via php.

I'm at a loss now. Is this even possible?

[EDIT] I have used @IvanGoneKrazy's suggestion and taken the environ code from this similar question. Now I have this code with this error message:

import subprocess, os

p = subprocess.Popen('dbus-launch', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for var in p.stdout:
  sp = var.split('=', 1)
  os.environ[sp[0]] = sp[1][:-1]

os.system('rhythmbox-client --print-playing')

error message:

(rhythmbox-client:15377): Rhythmbox-WARNING **: Launch helper exited with unknown return code 1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜