How to use the sma.archiver.GroupArchive function in sma

To help you get started, we’ve selected a few sma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sdockray / sma / sma / archiver.py View on Github external
def rebuild_group(self, id, do_snaps=False):
		a = GroupArchive(self.g, id)
		if do_snaps:
			a.snaps()
		a.markdownify()
		a.save()
github sdockray / sma / sma / archiver.py View on Github external
def archive_group(self, id):
		a = GroupArchive(self.g, id)
		a.save()
		a.markdownify()
github sdockray / sma / sma / archiver.py View on Github external
def markdownify(self):
		output = "%s\n%s\n\n" %(self.name, '='*len(self.name))
		output = "%s### Groups (click one to archive, then wait a couple minutes)\n" % output
		for g in self.groups:
			output = "%s- %s\n" % (output, "[%s](/fb/archive_group/%s)" %(g[1],g[0]))
		output = "%s### Posts (click one to archive, then wait a couple minutes)\n" % output
		for g in self.posts:
			t = re.sub('[\[\]\(\)\n]', '', g[1])
			output = "%s- %s\n" % (output, "[%s](/fb/archive_post/%s)" %(t,g[0]))
		return output

if __name__ == '__main__':
	args = sys.argv[1:]
	g = GroupArchive(None, args[1])
	if g.isLoaded:
		if args[2]=='markdownify':
			g.markdownify()
		elif args[2]=='build':
			g.snaps()
			g.markdownify()
			g.save()
github sdockray / sma / sma / archiver.py View on Github external
def save(self, filename='archive.pkl'):
		d = {'obj':self.obj, 'posts': [], 'links':[]}
		for k in self.posts:
			d['posts'].append(self.posts[k].obj)
		for k in self.links:
			d['links'].append(self.links[k])
		super(GroupArchive, self).save(filename, d)