Created
October 12, 2011 03:32
-
-
Save erik/1280193 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dbus | |
import commands | |
import sys | |
if not 'banshee' in commands.getoutput('ps -A'): | |
print("nothing, since banshee isn't open\n") | |
sys.exit() | |
bus = dbus.SessionBus() | |
try: | |
banshee = bus.get_object("org.bansheeproject.Banshee", | |
"/org/bansheeproject/Banshee/PlayerEngine") | |
playing = "" | |
npDict = banshee.GetCurrentTrack() | |
title = str(npDict['name']) | |
album = str(npDict['album']) | |
artist = str(npDict['artist']) | |
print("%s - %s [%s]\n" % (artist, title, album)) | |
except dbus.exceptions.DBusException: | |
print("\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use vars qw($VERSION %IRSSI); | |
use Irssi; | |
use Thread; | |
use strict; | |
$VERSION = '1.0'; | |
%IRSSI = ( | |
authors => 'Erik Price', | |
contact => 'erik', | |
name => 'np', | |
description => 'Shows the song playing in mpd in the active window (channel or query).', | |
license => 'BSD', | |
); | |
sub cmd_mprisnp { | |
my ($data, $server, $witem) = @_; | |
my $cmd; | |
my $output; | |
$cmd = "python dbus-np,py"; | |
if ($witem && ($witem->{type} eq "CHANNEL" || $witem->{type} eq "QUERY")) { | |
$output = `$cmd`; | |
$witem->command("ACTION ".$witem->{name}." is listening to $output"); | |
} else { | |
Irssi::print("This is not a channel/query window :b"); | |
} | |
} | |
Irssi::command_bind('np', 'cmd_mprisnp'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment