might_beep = True def beep_overflow_timeout(): global might_beep might_beep = True return False def sig_beep(): global might_beep beep_cmd = irssi.settings_get_str('beep_cmd') if not beep_cmd: return beep_flood = irssi.settings_get_int('beep_flood') if beep_flood <= 0: beep_flood = 1000 if might_beep: os.system(beep_cmd) might_beep = False irssi.timeout_add(beep_flood, beep_overflow_timeout) irssi.signal_stop() irssi.settings_add_str("lookandfeel", "beep_cmd", "play ~/.irssi/scripts/beep_beep.wav 2>&1 > /dev/null &") irssi.settings_add_int("lookandfeel", "beep_flood", 250) irssi.signal_add("beep", sig_beep)
stdout, stderr = proc.stdout.read(), proc.stderr.read() if os.WEXITSTATUS(status): irssi.prnt(stderr.rstrip()) elif irssi.settings_get_bool('lastfm_use_action'): witem.command('me %s' % stdout.rstrip()) else: witem.command('say %s' % stdout.rstrip()) username = data or irssi.settings_get_str('lastfm_user') irssi_encoding = irssi.settings_get_str('term_charset') lastfm_strftime = irssi.settings_get_str('lastfm_strftime') lastfm_output = irssi.settings_get_str('lastfm_output') proc = subprocess.Popen([ sys.executable, __file__, username, irssi_encoding, lastfm_strftime, lastfm_output], stdin=open(os.devnull), stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) glib.child_watch_add(proc.pid, on_result) if __name__ == '__main__': lastfm_lookup() else: import irssi irssi.settings_add_str('lastfm', 'lastfm_user', '') irssi.settings_add_str('lastfm', 'lastfm_output', 'np: %(artist)s-%(name)s') irssi.settings_add_str('lastfm', 'lastfm_output_tab_complete', '') irssi.settings_add_str('lastfm', 'lastfm_strftime', 'scrobbled at: %R %Z') irssi.settings_add_bool('lastfm', 'lastfm_use_action', 0) irssi.settings_add_bool('lastfm', 'lastfm_get_player', 0) irssi.command_bind('np', do_now_playing)
__author__ = "Miklos Vajna <*****@*****.**>" __version__ = "0.2" __date__ = "Fri, 22 Jun 2007 00:44:12 +0200" __copyright__ = "Copyright (c) 2007 Miklos Vajna" __license__ = "GPL" import irssi, re def send(msg, server, witem): prefix = irssi.settings_get_str("prefix") targets = irssi.settings_get_str("prefix_targets") cmdchars = irssi.settings_get_str("cmdchars") if re.match("^([%s]|%s)" % (cmdchars, prefix), msg): return if not check_target(witem.name, targets): return signal = irssi.signal_get_emitted() msg = "%s%s" % (prefix, msg) irssi.signal_stop() irssi.signal_emit(signal, msg, server, witem) def check_target(target, targets): target = target.lower() targets = targets.lower().split(' ') if target in targets or targets[0] == "*": return True irssi.settings_add_str(__name__, 'prefix', '') irssi.settings_add_str(__name__, 'prefix_targets', '*') irssi.signal_add("send command", send)
def create_settings(self): irssi.settings_add_str("rstatus", "socket", "~/.irssi/rstatus_sock") irssi.settings_add_str("rstatus", "default_channels", "notify") irssi.settings_add_str("rstatus", "default_queries", "notify") irssi.settings_add_str("rstatus", "override_notify", "") irssi.settings_add_str("rstatus", "override_ignore", "")