K1rakishou/Kuroba-Experimental

Include thread json in thread export

B13rg opened this issue · 3 comments

Currently there are two export functions:

  • ExportDownloadedThreadAsHtmlUseCase: exports thread html, media, and thumbnails into .zip
  • ExportDownloadedThreadMediaUseCase: export thread media and thumbnails into folder

As part of the export process, I think it should include the thread json file which I think is fetched from ${siteName()}_${boardCode()}_${threadNo}.json. This will make it easier to access thread data with scripts

Location to add for Thread export:

Location for thread media export:

I'll try and get a PR for this myself, do you have any suggestions for where I should be getting the thread data from in those functions?

@B13rg
Unfortunately, there is no prepared json because downloaded threads are stored in the database. You will have to create the json manually by iterating through the posts.
See

chanPosts.forEach { chanPost ->
formatPost(chanPost).byteInputStream().use { formattedPostStream ->
formattedPostStream.copyTo(zos)
}
}

@B13rg
You should probably just copy the whole class, rename it to ExportDownloadedThreadAsJsonUseCase and then do the conversion. Then hook it up to the bottom panel (add a new button with an icon or something like that) of LocalArchiveController and that should be it.