#!/usr/local/bin/perl
# Includes
use Net::DBus;
# Setup XChat
# Register
Xchat::register("Now Playing Script", "1.0", "", "");
Xchat::print("** Now Playing Script Loaded"); # Debug
# Hooks and Stuff
Xchat::hook_command("np", c_NowPlaying);
# Subs
# Now Playing
sub c_NowPlaying
{
# Connect to DBus and get Banshee's object
my $bus = Net::DBus->session;
my $banshee = $bus->get_service("org.gnome.Banshee");
my $remote_player = $banshee->get_object("/org/gnome/Banshee/Player");
# Get song and store in $song
my $song = $remote_player->GetPlayingArtist. " - " . $remote_player->GetPlayingTitle();
# Echo to channel
Xchat::command("me np: " . $song);
}