1
0
mirror of https://github.com/Mikaela/Limnoria.git synced 2024-12-22 18:52:45 +01:00
Limnoria/tools/urlConvert.py

27 lines
615 B
Python
Executable File

#!/usr/bin/env python
import sys
import time
import supybot.ircmsgs as ircmsgs
import supybot.plugins.URL as URL
if __name__ == '__main__':
if len(sys.argv) != 2:
print 'usage: %s URL.db' % sys.argv[0]
sys.exit()
try:
olddb = file(sys.argv[1])
except IOError, e:
print str(e)
sys.exit()
db = URL.URLDB()
for line in olddb:
(url, person) = line.split()
m = ircmsgs.IrcMsg(command='PRIVMSG', args=('#foo', '%s' % url), prefix=person)
m.tag('receivedAt', time.time())
db.add(None, url, m)
db.close()
olddb.close()