Created
August 26, 2012 10:08
-
-
Save maddievision/3476798 to your computer and use it in GitHub Desktop.
lazyboosh v0.01
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
""" | |
LAZYBOOSH HOW TO USE | |
1. Notify channel when it will be (all the /c*** commands change the topic) | |
/cno <min> - eg /cno 30 | |
2. Start the compo (also open it in s3m.it) | |
/cstart <sample pack url> - eg /cstart https://dl.dropbox.com/u/3434534/lolpack.it | |
3. Don't forget to make your own entry, too | |
4. Notify when due | |
/cdue | |
5. Wait for mad to finish. | |
6. Switch to synclisten (close on s3m.it) | |
/csync <packnumber> - eg /csync 265 | |
7. wget the pack into ~/compo, unzip, and delete the zip | |
8. Load the songs | |
/aso | |
9. Queue | |
10. Play | |
/pp | |
11. Repeat 9-10 until all songs done (it will auto advance on /pp) | |
12. Do /qq one more time to show "Votes to me in PM" msg | |
13. Do the votes properly, don't be stupid, watch for nicks, super bad spelling etc | |
14. Generate results, paste them in descending order except first two, put witty comments (optional) | |
15. End it all | |
/cend | |
""" | |
import os | |
import weechat | |
import struct | |
weechat.register("lazyboosh", "DJ Bouche", "1.0", "BSDicks", "LazyBoosh Compo Helper", "", "") | |
weechat.prnt("", "Hihihi...") | |
#dont include in compo blast | |
compoignore = ('virt') | |
#coda | |
cbcolor = "\x0314,01@\x0312,01@\x0312,02@\x0313,12@\x0304,06@\x0308,04@\x0308,07@\x0315,08@\x0308,09@\x0309,10@\x0311,12@\x0312,02@\x0312,01@\x0314,01@\x03" | |
compopath = os.path.expanduser("~/compo") | |
#schtuff | |
songz = [] | |
curs = 0 | |
#scan compo dir for songs | |
def addsong_cb(data, buffer, args): | |
global songz | |
global curs | |
songz = [] | |
dirlist = os.listdir(compopath) | |
dirlist.sort(key=str.lower) | |
x = 0 | |
for fname in dirlist: | |
n = get_song_title(fname) | |
songz.append(n) | |
echo("Song added: #{0}: {1}".format(x,n)) | |
x+=1 | |
curs = 0 | |
return weechat.WEECHAT_RC_OK | |
addsong_hook = weechat.hook_command("aso","Add Song","<message>","Message","","addsong_cb","") | |
#q | |
def qq_cb(data, buffer, args): | |
global curs | |
global songz | |
echo("Curs = %d" % curs) | |
if curs > len(songz)-1: | |
say("Votes to me in PM") | |
else: | |
qsay(songz[curs]) | |
return weechat.WEECHAT_RC_OK | |
qq_hook = weechat.hook_command("qq","Queue Queue","<message>","Message","","qq_cb","") | |
#p (and advance to next song) | |
def pp_cb(data,buffer,args): | |
global curs | |
global songz | |
composay("PLAY "+songz[curs]) | |
curs += 1 | |
return weechat.WEECHAT_RC_OK | |
pp_hook = weechat.hook_command("pp","Play Play","<message>","Message","","pp_cb","") | |
#set cursor manually | |
def rr_cb(data,buffers,args): | |
global curs | |
global songz | |
curs = int(args) | |
echo("Set Curs = %d" % curs) | |
return weechat.WEECHAT_RC_OK | |
rr_hook = weechat.hook_command("rr","r r","<message>","Message","","rr_cb","") | |
#manual compoblast | |
def blast_cb(data,buffers,args): | |
compoblast() | |
return weechat.WEECHAT_RC_OK | |
blast_hook = weechat.hook_command("blast","r r","<message>","Message","","blast_cb","") | |
#get song titles yahh, IT and XM only | |
def get_song_title(fname): | |
ff = compopath+'/'+fname | |
sn = "" | |
with open(ff,"rb") as f: | |
(impm, sn) = struct.unpack('<4s26s', f.read(30)) | |
if impm != 'IMPM': | |
f.seek(0) | |
(xm, sn) = struct.unpack('<17s20s', f.read(37)) | |
if xm != 'Extended Module: ': | |
sn = "" | |
else: | |
sn = sn.split('\0')[0] | |
else: | |
sn = sn.split('\0')[0] | |
sn = sn.strip() | |
if sn == '' or sn == 'untitled': | |
return fname | |
return "{0} ({1})".format(fname,sn) | |
#for manual shiet | |
def compobanner_cb(data, buffer, args): | |
composay(args) | |
return weechat.WEECHAT_RC_OK | |
compobanner_hook = weechat.hook_command("cba","Compo Banner","<message>","Message","","compobanner_cb","") | |
def q_cb(data,buffer,args): | |
qsay(args) | |
return weechat.WEECHAT_RC_OK | |
q_hook = weechat.hook_command("qu","Queue","<message>","Message","","q_cb","") | |
#opening and closing compos | |
cmin = 0 | |
csmp = "" | |
csurl = "http://s3m.it" | |
cnum = 0 | |
cpackbase = "http://s3m.it/pack/" | |
ccompobase = "http://s3m.it/compo/" | |
#componotice in XX:MM use as /cno 30, /cno 0, etc. | |
def cno_cb(data, buffer, args): | |
global cmin | |
cmin = int(args) | |
topic("COMPO at xx:%02d" % cmin) | |
return weechat.WEECHAT_RC_OK | |
cno_hook = weechat.hook_command("cno","cno","<message>","Message","","cno_cb","") | |
#manually change cmin (xx:mm) | |
def cmin_cb(data, buffer, args): | |
global cmin | |
cmin = int(args) | |
echo("COMPO changed to xx:%02d" % cmin) | |
return weechat.WEECHAT_RC_OK | |
cmin_hook = weechat.hook_command("cmin","cmin","<message>","Message","","cmin_cb","") | |
#start compo | |
def cstart_cb(data, buffer, args): | |
global cmin,csmp | |
csmp = args | |
compoblast() | |
topic("COMPO %s xx:%02d -> %s" % (csmp,cmin,csurl)) | |
return weechat.WEECHAT_RC_OK | |
cstart_hook = weechat.hook_command("cstart","cstart","<message>","Message","","cstart_cb","") | |
def cdue_cb(data, buffer, args): | |
global csmp | |
topic("DUE -> %s" % csurl) | |
return weechat.WEECHAT_RC_OK | |
cdue_hook = weechat.hook_command("cdue","cdue","<message>","Message","","cdue_cb","") | |
def csync_cb(data, buffer, args): | |
global cnum | |
global cpackbase | |
cnum = int(args) | |
topic("VOTEPACK -> %s%d" % (cpackbase,cnum)) | |
return weechat.WEECHAT_RC_OK | |
csync_hook = weechat.hook_command("csync","csync","<message>","Message","","csync_cb","") | |
def cnum_cb(data, buffer, args): | |
global cnum | |
cnum = int(args) | |
echo("COMPO NUMBER changed to %d" % cnum) | |
return weechat.WEECHAT_RC_OK | |
cnum_hook = weechat.hook_command("cnum","cnum","<message>","Message","","cnum_cb","") | |
def cend_cb(data, buffer, args): | |
global cnum | |
global ccompobase | |
topic("%s%d %s" % (ccompobase,cnum,args)) | |
return weechat.WEECHAT_RC_OK | |
cend_hook = weechat.hook_command("cend","cend","<message>","Message","","cend_cb","") | |
def compoblast(): | |
global compoignore | |
infolist = weechat.infolist_get('irc_nick', '', current_buffer_string()) | |
L = [] | |
while weechat.infolist_next(infolist): | |
nick = weechat.infolist_string(infolist, 'name') | |
#ignore list check | |
if nick not in compoignore: | |
L.append(nick) | |
weechat.infolist_free(infolist) | |
L.sort(key=str.lower) | |
l = '' | |
for le in L: | |
l+=le+' ' | |
composay("COMPO") | |
say(l) | |
composay("COMPO") | |
#coda stylez | |
def composay(msg): | |
say("{0} \x02{1}\x02 {0}".format(cbcolor,msg)) | |
#\ stylez | |
def qsay(msg): | |
say("\x0307q {0}".format(msg)) | |
def topic(msg): | |
weechat.command(weechat.current_buffer(), "/topic "+msg) | |
def say(msg): | |
weechat.command(weechat.current_buffer(), msg) | |
def echo(msg): | |
weechat.prnt(weechat.current_buffer(), msg) | |
def current_buffer_string(): | |
buff=weechat.current_buffer() | |
return "%s,%s" % (weechat.buffer_get_string(buff,"localvar_server"),weechat.buffer_get_string(buff,"localvar_channel")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment