IRC Meeting Text Formatter....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've been trying to keep up with reading the IRC logs, but they aren't
the easiest to read.

So.... I turned to scripting and created a much easier to read format
based on the original text.  The new format separates the text by
subject, tallies the attendees and reports on these at the end.

The script (called "irc") is in Ruby and is attached - it writes out a
file "irc.{mo}.{day}".

-- 
UNIX System Administrator
Linux+, SCSA, RHCE, LPIC-1
HP-UX, Linux, Solaris, FreeBSD
Books: "Advanced System Administration" and "GNU Screen: A Comprehensive Introduction"
http://www.lulu.com/ssrat

#!/usr/bin/ruby

message = STDIN.readlines.map { |x|
	x.gsub!(/=\n$/,'')
	x.gsub!(/=20/, ' ')
	x.gsub!(/=3D/, '=')
	x
}

x = `date "+irc.%m.%d"`
$stdout = File.open(x.chomp, "w+")

x = `date`.chomp
print x

attendees = Hash.new
joined = Hash.new
message.to_s.each { |x|
	next unless (x =~ /^\[[0-9][0-9]:[0-9][0-9]\]/)
	x.gsub!(/^\[..:..\] \* /, "  * ")

	if (/subject to (.*)/.match(x))
		s = "SUBJECT: #{$1}"
		print "\n\n#{s}\n#{"=" * s.size}\n\n"
	elsif (/^\[..:..\] ([^ ]*) has joined /.match(x))
		joined[$1] = 1
		print x.gsub(/...:... /, "  ")
	elsif (/^\[..:..\] ([^: ]*) /.match(x))
		print x.gsub(/...:... /, "  ")
	else
		print x
#		print x.gsub(/^...:... /, "        ")
	end

	if (/^\[..:..\] ([^ :]*): /.match(x))
		attendees[$1] = 1
	end


}

total = (attendees.keys + joined.keys).sort.uniq
print "\n\nAttendees (#{total.size}): \n"

total.each { |x|
	print "\t", x
	if (joined.member?(x) && ! attendees.member?(x))
		print " (nonspeaking)"
	end
	print "\n"
}

#message.each { |line|
#	line.chomp!
#	if (line =~ /=$/)
#		line.chop!
#		line += readline.chomp!
#	end
#
#	if (line =~ /set the subject to (.*)/)
#		subj = $1;
#		print "\n", subj, "\n\n";
#	else
#		print line, "\n";
#	end
#}



[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux