rPawel / Tomboy2Evernote

Exports Tomboy Notes to Evernote Format
MIT License
19 stars 8 forks source link

Export as a multiple enex files with note title as filename? #2

Open khurshid-alam opened 8 years ago

khurshid-alam commented 8 years ago

I want to export each note as separate enex file with note tile as file name i.e note1.enex, note2.enex etc.

I think its possible by slightly modifing the code. Could you include that in option (or show as snippet here)?

rPawel commented 8 years ago

Rather than calling enex_notes.append(make_enex(title, html_note_body, created_date, updated_date)) and later saving save_to_file(outputdir, output_filename, multi_enex_body)

It should (on top of my head) save straight away. save_to_file(outputdir, some_generated_name, make_enex(title, html_note_body, created_date, updated_date)) Let me know if this is something you could change.

khurshid-alam commented 8 years ago

Thanks. Yes that could work. some_generated_name should be respective tomboy_note_title which can be obtained using get_title. In loop, it will produce multiple file in outputdir. I will try and let you know.

rPawel commented 8 years ago

Cool, It would be worth to ensure file name is valid: http://stackoverflow.com/questions/7406102/create-sane-safe-filename-from-any-unsafe-string

keepcharacters = (' ','.','_')
    "".join(c for c in filename if c.isalnum() or c in keepcharacters).rstrip()
Tycho-S commented 7 years ago

I just had this same issue, I needed to preserve the notebooks. It turned out a bit (but not much) more complicated due to the need to have the header and footer XML. So I had to buffer everything in an indexed list containing arrays. And, because python doesn't seem to allow reading key names in lists, a separate array of the index names :). I also had some invalid characters in some notebook names indeed so I covered that also.

Maybe it could be patched back in but I can imagine some people would prefer to have everything in one big file so to keep it simple I forked the project. If anyone wants to use it here's the code:

https://github.com/TychoSchenkeveld/Tomboy2Evernote

It might not be as clean as it should be as I don't write in python much :)

I'm actually using this along with the OneNote converter from Microsoft (meant to import evernote files) and it works ok, it's just not very handy because I have to import each notebook individually. Also OneNote is super slow compared to Tomboy :)

And thanks for your work Pawel!! It was a great help to get my notes converted.