Feeds:
Posts
Comments

Posts Tagged ‘dbus’

Yesterday i installed debian lenny ( thanks to ashik salahudeen who sent me those DVDs for free 🙂 ).

I was not ready to waste another holiday.So started thinking of doing something and got landed in my usual plugin stuff.This time not audacious,its Rhythmbox.So downloaded my pidgin-audacious now playing code and rewritten it to access rhythmbox methods.This time there is a lot of changes in the code.This code is not going to use ‘watch’ command to execute it after a fixed period and another interesting feature is a format specifier kinda thing. ie Just write what you want in the status message and place a format specifier where you want to see the song title , album title and artist.
Format Specifiers are

%rbs ————–> for displaying song title
%rbt ————–> for displaying album title
%rba ————–> for displaying artist name

Script will append a seperate string containg songtitle and albumtitle if no format specifier is there in the status message at the time of running the script.

An example for appending status message using format specifier kinda thing:

%rbs in %rbt by %rba

pidgin-after-appending-formatspecifier kinda thing in status message

pidgin after appending format specifier kinda thing in status message

Now download the script and run it using these commands

$wget http://ragsagar.freehostia.com/pidgin-rb.py
$python pidgin-rb.py

Downloading and running the script

Downloading and running the script

pidgin after running the script

pidgin after running the script

PS : Run the script only after appending the format specifier kinda thing. You can run the script without appending anything, In this case the script will append status message like ” listening to [songname] in [albumname] “

Download Script

Advertisements

Read Full Post »

Few days ago i wrote a script to update the status message in pidgin with the title of the song playing in audacious music player.It is written in python.it makes use of the dbus for the inter application communication.when you invoke that script it just appends the title of the song currently playing in audacious as the status message in pidgin .i used the shell command $watch to invoke it in every 30 seconds so that the status message gets updated with the songtitle within 30 seconds after the song change.You can reduce the number of seconds so that the status message gets updated frequently reducing the time delay between the song change and updation of status message.What the script does is, it retrieves the song title from the audacious music player using dbus.Then this songtitle is assigned as the status message in pidgin by communicating through dbus.This script needs dbus and py-dbus.So make sure that you have both packages installed in your system.

Here is the script :

def set_message(message):
# Get current status type (Available/Away/etc.)
current = purple.PurpleSavedstatusGetType(purple.PurpleSavedstatusGetCurrent())
# Create new transient status and activate it
status = purple.PurpleSavedstatusNew(“”, current)
msg=”Now Playing: ”
emsg=msg+message
purple.PurpleSavedstatusSetMessage(status, emsg)
purple.PurpleSavedstatusActivate(status)

import dbus
session_bus=dbus.SessionBus()
proxy = session_bus.get_object(“im.pidgin.purple.PurpleService”, “/im/pidgin/purple/PurpleObject”)
purple = dbus.Interface(proxy, “im.pidgin.purple.PurpleInterface”)
proxy1 = session_bus.get_object(‘org.mpris.audacious’,’/TrackList’)
purple1 = dbus.Interface(proxy1,’org.freedesktop.MediaPlayer’)
ct = purple1.GetCurrentTrack()
proxy2 = session_bus.get_object(‘org.mpris.audacious’,’/org/atheme/audacious’)
purple2 = dbus.Interface(proxy2,’org.atheme.audacious’)
currentsong = purple2.SongTitle(ct)
print currentsong
set_message(currentsong)

Running this script will update the status message just once , so u have to shell command $watch as i said earlier.if you dont want to do this things manually, dont worry! i got package for this, grab it from here http://ragsagar.freehostia.com/pidgin-audacious_plugin.tar.gz , untar it and run the installer..

$wget http://ragsagar.freehostia.com/pidgin-audacious_plugin.tar.gz

$tar -xvf pidgin-audacious_plugin.tar.gz

$cd pidgin-audacious\ plugin/

$sudo chmod a+x installer

$./installer

Now run the script using this command :

$pidgin-plugin

PS: Make sure that you have both audacious and pidgin already running

Read Full Post »

%d bloggers like this: