Ejemplo n.º 1
0
def main(newsgroup):
	articles = []
	lines = file(settings.cache() + newsgroup + ".flt","r").readlines()
	lines = [ string.strip(line) for line in lines ]
	for i in range( (len(lines)+1)/4):
		ArticleFileName = lines[i*4]
		accept = lines[i*4+2]
		if len(ArticleFileName) == 0 or accept != "Accepted": continue
		articles.append(ArticleFileName)

	digest = SummariseArticles(articles)
	summary = SummariseA(digest)
	file(settings.cache() + newsgroup + ".sum", "w").write(summary)
Ejemplo n.º 2
0
Archivo: shtm.py Proyecto: blippy/soul
def compose(SrcGroup, DestNewsGroups, DestName):
	summary = file( cache() + SrcGroup + '.sum', 'r').read()
	if len(summary) == 0 : 
		records = ""
	else: 
		records = ""
		for record in string.split(summary, chr(30)):
			fields = string.split(record, chr(31))
			records += '\n\n<p><h3>' + fields.pop(0) + '</h3>\n'
			for url in fields:
				line = '<li><a href="%s">%s</a></li>\n' % ( url, url)
				records += line 

	file( cache() + DestName, 'w').write(records)
Ejemplo n.º 3
0
def main(newsgroup, filters):
	newsdir = '/uu/news/' + newsgroup.replace(".", "/") + "/"

	# determine what articles are available
	ArticleFileNames = glob.glob( newsdir + '[0-9]*')
	avail = [int(os.path.basename(x)) for x in ArticleFileNames ]
	mavail = max(avail)

	# determine what articles we want to summarise
	p = Placeholder(newsgroup)
	last = p.load()
	if last == None: last = mavail - 10
	articles = [ x for x in ArticleFileNames if int(os.path.basename(x)) > last ]

	# sort the wheat from the chaff
	fpflt = file(settings.cache() + newsgroup + ".flt", "w")
	for article in articles:
		fpflt.write('%s\nNow: %s\n' %(article, str(datetime.datetime.now())))
		m = reject(article, filters)
		if m: fpflt.write( 'Rejected: %s' % (m))
		else: fpflt.write('Accepted')
		fpflt.write('\n%%\n')

	fpflt.close()

	p.save(mavail)
Ejemplo n.º 4
0
Archivo: post.py Proyecto: blippy/soul
def tryemail(eml):
	MsgFile = settings.cache() + eml
	try:
		if os.path.getsize(MsgFile) >0:
			f = open(MsgFile)
			email(f)
			f.close()
	except os.error: pass
Ejemplo n.º 5
0
Archivo: email.py Proyecto: blippy/soul
def compose(SrcGroup, DestNewsGroups, DestName):
    txt = load_skel("email.txt")
    txt = txt.replace("[DEST-GROUP]", DestNewsGroups)
    txt = txt.replace("[SRC-GROUP]", SrcGroup)
    txt = txt.replace("[TIME]", time.asctime())
    summary = file(cache() + SrcGroup + ".sum", "r").read()
    if len(summary) == 0:
        txt = ""
    else:
        records = ""
        for record in string.split(summary, chr(30)):
            fields = string.split(record, chr(31))
            heading = fields.pop(0)
            records += heading + "\n" + string.join(["   " + url for url in fields], "\n") + "\n\n"

        txt = txt.replace("[SUMMARY]", records)

    fortune = file(cache() + "fortune.txt", "r").read()
    txt = txt.replace("[SOUL-FORTUNE]", fortune)

    file(cache() + DestName, "w").write(txt)
Ejemplo n.º 6
0
	def __init__(self, newsgroup):
		self.lastfile = settings.cache() + newsgroup + ".last"