stump icon indicating copy to clipboard operation
stump copied to clipboard

[FEATURE] TXT support

Open Yesterday17 opened this issue 1 year ago • 2 comments

It seems that only EPUB is supported for now. TXTs might be useful for short texts.

Describe the solution you'd like

Add txt in scan pattern https://github.com/aaronleopold/stump/blob/bb67ec2105655fdc3219fd5d86ba997c8ac960b7/packages/interface/src/utils/patterns.ts#L3

Yesterday17 avatar Apr 05 '23 10:04 Yesterday17

I'm open to adding txt support but, as I mentioned in another recent feature request, unless someone else contributes it will likely happen after the 0.1.0 release. It is unfortunately a little more complicated than adding it to the pattern you linked, as well, since that is primarily a client-side utility for naive pattern matching on the extension in order to redirect epub files to the appropriate reader.

A brief overview of what it might involve to fully support txt:

  • Add to the supported formats via ContentType enum
  • Add some basic txt-specific utilities alongside the other supported formats.
    • This piece would include important things like file metadata, etc, needed for processing step
  • Add it to the parent process utility function the scanner(s) use.
  • Implement some server-side logic for handling the reading of txt files. I imagine this should be buffered/streamed from the server, rather than sending the entire file. I would think, at the very least, this will be easier than the epub streaming I want eventually https://github.com/aaronleopold/stump/issues/62.
  • Add logic to route reading attempts to the appropriate client-side reader
  • Implement a new client-side reader that supports txt.
    • Decisions about whether this would be some sort of infinite scroll, or have some programatic way of paging the content, would have to be made.
  • Considerations for OPDS would also have to be made. Are txt files to be included? Etc.

aaronleopold avatar Apr 05 '23 19:04 aaronleopold

I will have a try when I have free time. Thank you for your explanation!

Yesterday17 avatar Apr 06 '23 02:04 Yesterday17