

from ScrapePlugins.LoneMangaLoader.LmFeedLoader import LmFeedLoader
from ScrapePlugins.LoneMangaLoader.LmContentLoader import LmContentLoader

import ScrapePlugins.RunBase

import time

import runStatus


class Runner(ScrapePlugins.RunBase.ScraperBase):
	loggerPath = "Main.Lm.Run"

	pluginName = "LmLoader"


	def _go(self):

		self.log.info("Checking Lm feeds for updates")
		fl = LmFeedLoader()
		fl.go()
		fl.closeDB()

		time.sleep(3)
		#print "wat", cl

		if not runStatus.run:
			return

		cl = LmContentLoader()

		if not runStatus.run:
			return

		todo = cl.retreiveTodoLinksFromDB()

		if not runStatus.run:
			return

		cl.processTodoLinks(todo)
		cl.closeDB()
