# # pyql - show what's currently playing in Quod Libet # # Quod Libet needs to be running of course! # # This is a lame python version of QLCtrl http://ruined.us/projects/qlctrl/ # Unlike QLCtrl this script does not do any error checking whatsoever (yet) # # (c) Lasse Pommerenke, housetier@gmail.com # written with pida: http://pida.berlios.de/index.php/Main_Page # # History: # 0.1 initial release, seems to work on my pc # 0.2 less user editing required, thanks to piman in #quodlibet on oftc # 0.2.1 FOR TOHELLWITHGA :O # 0.2.1.1 modified by ToHellWithGA # import os current_file_name = os.path.expanduser('~/.quodlibet/current') # except for programming mistakes you shouldn't need to edit anything below this # line import xchat import re __module_name__ = "pyql" __module_version__ = "0.2.1" __module_description__ = "shows what's playing in quod libet" def np_handler(foo1, foo2, foo3): f = open(current_file_name) data = f.read() f.close() list1 = data.split("\n") list2 = [foo for foo in list1 if re.search("^(artist|title|~#bitrate)=.*", foo)] # trimmed (ToHellWithGA) dict = {} for foo in list2: k, v = foo.split("=") dict[k] = v if int(dict['~#bitrate'])==0: bitrate='FLAC' # flac_in_hell would be proud elif int(dict['~#bitrate'][0:3])<=128: bitrate='last.fm' # they really need higher quality on lastfm elif int(dict['~#bitrate'][0:3]) > 128 and int(dict['~#bitrate'][0:-3]) <= 320: bitrate='mp3,'+dict['~#bitrate'][0:-3]+'kbps' # changed k to kbps (ToHellWithGA) else: bitrate='CD' # quod libet doesn't even play CDs, hehe xchat.command("me " + "\00312" + "\\np" + "\003" + "[%s]{%s - %s}" % (bitrate,dict["artist"],dict["title"])) # colors added (ToHellWithGA) return xchat.EAT_ALL xchat.hook_command("amp", np_handler, help="its too simple for help!")