xeekworx/SDL_WikipediaBot

Create abstraction for content download vs cacheload

xeekworx opened this issue · 0 comments

Currently downloading of wiki content or loading from wikicache is done in separate sections of code. The best way to handle this in the future would be to use a base class for wiki content loading and have two derived classes, one for loading from cache, one from loading live off of wiki.libsdl.org.

In the bot, a list of content searching objects would be used, the order in the list determines priority. The wikicache is first on the list and the wiki-download is after it. This means that the cache will be utilized before the live download.

class SDL_WikiContentSource:
  def __init__(self):
    self.source_name = "Unknown"

  def query(self, value):
    return None


class SDL_WikiContentCache(SDL_WikiContentSource):
  def __init__(self):
    self.source_name = "Cache"

  def query(self, value):
    return None


class SDL_WikiContentDownload(SDL_WikiContentSource):
  def __init__(self):
    self.source_name = "Live"

  def query(self, value):
    return None