Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
khurshid-alam opened this issue Jun 19, 2016 · 4 comments
Open

Comments

@khurshid-alam
Copy link

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
Copy link
Owner

rPawel commented Jun 29, 2016

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
Copy link
Author

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
Copy link
Owner

rPawel commented Jun 29, 2016

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
Copy link

Tycho-S commented Jan 31, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants