Giter Site home page Giter Site logo

sdl_wikipediabot's People

Contributors

xeekworx avatar

Watchers

 avatar  avatar

sdl_wikipediabot's Issues

Create abstraction for content download vs cacheload

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

Search the wiki rather than just go directly to wiki pages for content

Searching is currently not possible. The downloader simply takes the user's query (eg. SDL_RenderCopy) and build's a wiki.libsdl.org URL out of it to pull content. This feature would allow for searching the wiki and displaying results.

Maybe use !wiki_search for the command, or add an argument to the existing !wiki command (eg. !wiki search )

The wiki-cache should have a file size limit

Currently, there is no limit to how big the wikicache file can get. This could be a problem. Two ideas:

  • If I am going to cap the file size then dates need to be added to each of the query items so that the oldest items could be purged.
  • The data could be separated in different files, each file having a soft limit.
  • The content per query should also be limited. If the content exceeds a certain amount, then it should probably not get cached, this limit could be very high high; just to prevent someone from some how adding a query to the cache that's gigabytes. I'm not sure how that could be possible, but who knows.

!wiki query needs to be verified before taking action

The query given to the !wiki command isn't checked for anything that might be unsafe to use in a URL before that URL is downloaded. The simplest solution would be to just make sure only alphanumeric characters are used (plus the underscore), or what would be considered valid for function and type names in C/C++.

This should be simple to implement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.