All pastes #96356 Raw Edit

Something

public text v1 · immutable
#96356 ·published 2006-07-22 21:06 UTC
rendered paste body
#!/usr/bin/python
# NNPScript (final)
# Nicotine+ Now Playing Script
# works with XMMS and InfoPipe plugin
# more info & howto at http://osiris.codedchaos.com/ or http://notes.od1.co.uk/
# written by: [hidden]
# question to d4nj4 & 47th_Ronin @ nicotine chatroom

"""
This script comes without warrant of anykind! Use at your own risk!
"""

#!/usr/bin/python
# Read Info-pipe
import os
if os.path.exists("/tmp/xmms-info"):
	fsock = open("/tmp/xmms-info")
	do = fsock.readlines()
	infolist = []
	for i in do:
		if i != "":
			infolist.append( i.strip("\n") )
	protocol  = infolist[0][29:]
	version = infolist[1][25:]
	status = infolist[2][8:]
	playlist_count = infolist[3][20:]
	playlist_position = infolist[4][20:]
	millisec_position = infolist[5][15:]
	position = infolist[6][10:]
	millisec_time = infolist[7][15:]
	time = infolist[8][6:]
	bitrate = str(int(infolist[9][17:])/1024)
	frequency = infolist[10][20:]
	channels = infolist[11][10:]
	title = infolist[12][7:]
	filename = infolist[13][7:]

#   	print protocol, version, playlist_count, playlist_position, millisec_position, position, time, millisec_time, bitrate, frequency, channels, title, filename
	string = "Now %s: %s (%s/%s) at [%sKBps]" % (status, title, position, time, bitrate)
# 	string = "Now %s: %s (%s/%s)" % (status, title, position, time)
# 	string = "Now %s: %s" % (status, title)
	print string.replace("_", " ")
	fsock.close()