Friday, 6 July 2012

First bite of the Pi

Started playing around with the raspi properly today. Already booted up XBMC when I first got it, just to make sure everything worked. Very cool but a bit unoriginal and boring.

First thing I did was whack a decent distro on there. Sorry Debian lovers - I'm a fedora man. Tried the official raspi 'fedora remix' but it was a bit old - based on F14 so nowhere near bleeding edge. Found a Fedora 17 based raspi build here. Much better.

First thing to do was Quake III - what else?! Not much to say really, everyone's seen the youtube clips. It runs OK. Crazy to think my desktop struggled with this when it first came out.

I have a plan (finally) for my raspi.... more soon :)

Thursday, 5 July 2012

Conky Exaile

Just a quick one but I'm a big fan of conky and exaile. Disappointingly it seems Exaile changed its DBUS API so my 'now playing' script (shamefully pulled from google) no longer worked.

I've been dabbling with python a bit so had a go at writing my own replacement script. Its the first time I've really used DBUS - quite impressed so far, especially after finding dbus-cli

Anyway - here's the code. Quick, dirty and just what I needed:


 #!/usr/bin/env python  
   
 import sys  
 import dbus  
 reload(sys)  
   
 sys.setdefaultencoding('utf8')  
   
 bus = dbus.SessionBus()  
 try:  
  remote_object = bus.get_object("org.exaile.Exaile","/org/exaile/Exaile")  
 except dbus.exceptions.DBusException:  
  print("Exaile not running")  
  sys.exit()  
   
 iface = dbus.Interface(remote_object, "org.exaile.Exaile")  
 status = iface.Query()  
 #print "Status: "+status  
   
   
   
 if status == "Not playing.":  
  print("Exaile not playing")  
  sys.exit()  
 elif "paused" in status:  
  print("Exaile is paused")  
  sys.exit()  
   
 title = iface.GetTrackAttr("title")  
 album = iface.GetTrackAttr("album")  
 artist = iface.GetTrackAttr("artist")  
   
 if iface.IsPlaying():  
  print("%s - %s (%s)"%(title, artist, album))  
 else:  
  print "Exaile is not playing"