Truth, Computing and Fail

  • Home
  • About

Moving to Google Code

anomit | June 27, 2009

I have decided to move some of my personal projects to Google Code so that it’d give me some impetus and make me get off my lazy ass and actually put some real effort into the things I like.

Er, not really. It’s more of a selfish decision. Right now I want other people to read and criticize my code so that I’d know where I’m going wrong and correct myself. Nothing’s more dangerous than complacency.

As a starter, I have uploaded the tiny mpd now playing plugin I wrote for xchat about an year ago when I was learning socket programming in python. Showing the current playing track was too easy. Right now I want it to become more like an interface to mpd that provides basic controls sitting in the comfort of xchat.

I named the project mpd-xchat

PS: Just after I had uploaded the code, I found a project by the name of xchat-mpd :P

I hope to add one more project in the next few days :)

Comments
5 Comments »
Categories
Coding, GNU/Linux
Tags
mpd, python, xhcat
Comments rss Comments rss
Trackback Trackback

mpd now playing plugin for XChat

anomit | July 6, 2008

It is 3 in the morning. Don’t expect me to blabber much. Windows users, please fuck off at this point. Just give the file a py extension and move it to ~/.xchat2 so that it loads automatically at startup. Use /show to tell everyone in the channel you are playing [insert an emo band name here] and proceed to cut your wrist or let everyone know you are a real emo with the legwarmers and all. OK ENOUGH.

import socket,re,xchat

__module_name__ = "mpd-np"
__module_version__ = "0.1"
__module_description__ = "mpd now playing"

def playing(word, word_eol, userdata):
	mpd=socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
	host='127.0.0.1'
	port=6600
	mpd.connect((host,port))
        #welcome msg could be used to extract mpd version information
	welcome=mpd.recv(1024)
	mpd.send('currentsong\r\n')
        #get all the info about current track being played
	data=mpd.recv(4096)
	#I wont be explaining any REs
	artist=re.findall(r'Artist[:]\s[\S ]+',data)[0].split(':')[1]
	title=re.findall(r'Title[:]\s[\S ]+',data)[0].split(':')[1]
	msg='Now playing:'+artist+'-'+title
	xchat.command('me '+msg)
	data=""
	mpd.close()
	return xchat.EAT_ALL
#hooks into the show xchat command
xchat.hook_command("show",playing)

Reports of idiotic behavior go into the comments.

Comments
2 Comments »
Categories
Coding, GNU/Linux
Tags
mpd, plugin, python, xchat
Comments rss Comments rss
Trackback Trackback

What’s in

  • Symlinks in a libfs virtual file system: The Pains
  • Small rant on the FUSE API reference
  • Kernel module debugging: a simple technique
  • Vim/Cscope quickie
  • PyCon India or Code Jam?

Blogroll

  • Akshay Kothari
  • Ankur Shrivastav (OS)
  • Ankur Sinha
  • Harsh J
  • Hullap
  • LUG manipal
  • Swap

Tags

aircrack airfail airtel assembly blues build c Coding college country cryptography dean faculty file systems fuckery gnuplot hacking India kernel linux mangalore manipal mpd music NASM plugin plugins politicians pub culture python rant rock sam scheduler simulation SSFNet stupidity supernatural suppression syscall syscalls unix vim xchat xml

Archives

  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • January 2009
  • November 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • October 2007
  • September 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007

License

Creative Commons License
This work by Anomit Ghosh is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 India License.
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox