Open codemac opened 2 years ago
Technically it is possible, but not simple. The note file consists of multiple blocks and the blocks are referred from other blocks by byte offset value. When combining multiple note files, we need to adjust offset values and merge metadata carefully to ensure consistency because the position of the blocks change.
Your suggestion looks interesting. It may take some time, but I'll consider file combining method.
Merging ( and splitting) notes would be SO cool and helpful for my workflow.
I have started implementing the merging feature and now it works with some restrictions. You can try it with the latest commit (f687b4f41e6b4d0dda066dea51c9eafef5ca48f1).
Important Notices: This is an experimental feature, so output file may be corrupted. Backup your input files before trying the feature to prevent data loss.
Usage:
$ supernote-tool merge input1.note input2.note output.note
This command generates output.note
which combines the pages of input1.note
and input2.note
.
The cover image of output.note
uses the one of input1.note
.
Restrictions:
output.note
is limited to 9999 pagesNice - thank you very much !!! My first tests came out perfectly fine: I merged two files ( 70 mb, 40mb) totalling in 180 pages and it worked great. I have not checked if titles are keywords are fine. What is next on your list ? ( I have some ideas but I don't want to stress you :) )
Hi, thank you for testing. Titles and Keywords has been also supported.
I plan to add bellows:
Notebook
object and binary formatNotebook
object easily (insert/remove pages, etc.)Very cool ( especially item 3). How about merging more than 2 notebooks ( eg merging all files in a specific directory ) ?
OK, I add the feature that merging more than 2 notebooks to my plan list. Basically It is not difficult because we should be able to achieve the feature by repeating the merge function.
Thank you so much for this feature! Trying it out now.
Really makes my workflow so much better where I write notes into new files, and then add them into .note
files when I've processed them.
Now I committed the feature that merging more than 2 notebooks (d9c6839678d703090990c7de1cccccb955ed7e96). 'merge' sub-command accepts any number of input file name arguments.
Examples:
$ supernote-tool merge input1.note input2.note input3.note output.note
You can easily specify many input files in a directory using shell's wildcards.
$ ls mynote/
20220306_164410.note 20220306_164428.note 20220306_164458.note 20220306_164504.note
$ supernote-tool merge mynote/*.note merged-mynote.note
It seems you forgot to add the newer .note
versions in the supported files. Expected signature is noteSN_FILE_VER_20210010
whereas the latest file version is 20230015
This tool has been a life saver for my own personal workflow. Thank you for creating this!
Because you have a parser, I was curious if there would be a way to merely append two .note files into one. I realize this is different than parsing, in fact the opposite of generating.
Any thoughts on what this would take?