likeawizard / polyglot-composer

A library to compose polyglot opening books from PGN game collections
GNU General Public License v3.0
5 stars 0 forks source link

URL as PGN source #14

Closed likeawizard closed 1 year ago

likeawizard commented 1 year ago

Support URLs as resource identifier for PGN files

  1. It should work on top of any other underlying formats (pgn/bzip2/zst...)
  2. Open a web resource with and wrap it in a usable io.Reader that can be passed to the scanner
  3. Must make a distinction between local file and web resource and if possible produce the same data required for progress estimate
likeawizard commented 1 year ago

With the abstraction of PGN sources (#25)

A further abstraction could be added beneath. Now all PGNSource implementations have a os.File implementation. Be it plain pgn or compressed via zst or bzip2 the underlying data source could be abstracted to either file or web resource. http.Get() returns the response with a body. The body implements the same io.Reader interface so changes should be minimal. The main challenges could be:

  1. Identify if a pgn passed by through the command line is a url or local file
  2. Handle the response headers and status appropriately for errors.
  3. functions being first class citizens when creating / opening a source the closing function can be set appropriately.