tannercollin / standardnotes-fs

Mount your Standard Notes as a filesystem.
GNU General Public License v3.0
148 stars 12 forks source link

Tags support #4

Closed ddddavidmartin closed 6 years ago

ddddavidmartin commented 6 years ago

Good day,

I have been coming back to this project on and off. One thing that I would really like to see is support for tags on notes. The way I'm picturing it is to have tags mapped to directories under which the respective notes live.

For example:

./tag1:
some_note.txt

./tag_xyz:
some_other_note.txt
and_yet_another_note.txt

For simplicity's sake I would be happy to support just one tag per note. Multiple tags could be symlinked though I reckon. Though it does raise some scenarios to be aware of when deleting tags from the file system.

I'd be happy to spend some time on this and give it a go. Would you have any pointers on where to start? Thanks!

tannercollin commented 6 years ago

This is a great idea!

Give me a few days to think about it. I don't think symlinks would be necessary, we could just have the note inside each tag's folder just due to how FUSE works.

If you'd like to help, testing it would be great!

ddddavidmartin commented 6 years ago

I don't think symlinks would be necessary, we could just have the note inside each tag's folder just due to how FUSE works.

That would make it a bit easier. I'm not familiar with FUSE though. Would the notes be in the toplevel directory as well? Because you could delete all tags and the expectation is to still have the note.

Give me a few days to think about it.

No rush at all from my side.

If you'd like to help, testing it would be great!

Definitely, I'm more than happy to give it a spin and do some testing!

tannercollin commented 6 years ago

@ddddavidmartin basic tag support added in 62056fe033329cc18f0cda85a406db37168ce35b. Let me know how it works for you!

ddddavidmartin commented 6 years ago

Woot, how very exciting! I shall have a look and I will let you know how I go

tannercollin commented 6 years ago

I'll push this to PyPi once it's tested better. For now, can you please back your notes up and install with: sudo pip install git+https://github.com/tannercollin/standardnotes-fs or sudo pip3 install git+https://github.com/tannercollin/standardnotes-fs

ddddavidmartin commented 6 years ago

Hmmm, I'm getting

Old encryption protocol detected. This version is not supported by standardnotes-fs. Please resync all of your notes by following the instructions here: https://standardnotes.org/help/resync

when I run it. There has been a security update in the past x weeks which I did apply though.

Okay, I have tried it with a new account and that seems to work. I'm not sure what's going on there, but may be a standardnotes issue rather than standardnotes-fs.

ddddavidmartin commented 6 years ago

Okay, so I have imported my backup into the new account and now snfs fails with the following:

Silbersofa2:~$ snfs ~/notes
Traceback (most recent call last):
  File "/usr/local/bin/snfs", line 11, in <module>
    load_entry_point('standardnotes-fs==0.0.2', 'console_scripts', 'snfs')()
  File "/usr/local/lib/python3.7/site-packages/standardnotes_fs/standardnotes_fs.py", line 179, in main
    fuse = FUSE(StandardNotesFUSE(sn_api, sync_sec),
  File "/usr/local/lib/python3.7/site-packages/standardnotes_fs/sn_fuse.py", line 23, in __init__
    self.update_mtimes()
  File "/usr/local/lib/python3.7/site-packages/standardnotes_fs/sn_fuse.py", line 65, in update_mtimes
    self.notes = self.item_manager.get_notes()
  File "/usr/local/lib/python3.7/site-packages/standardnotes_fs/itemmanager.py", line 60, in get_notes
    title = note['title'] + ('' if not count else str(count + 1))
KeyError: 'title'
tannercollin commented 6 years ago

That's odd. Maybe in some old version of SN, titles weren't included. This should be fixed in 46e792d198e040cf50f8f0dc9cce22aa817e2648. Can you try it out?

tannercollin commented 6 years ago

@ddddavidmartin any luck?

ddddavidmartin commented 6 years ago

That's odd. Maybe in some old version of SN, titles weren't included. This should be fixed in 46e792d. Can you try it out?

Just gave it a try and it appears to be working fine! Thanks!

ddddavidmartin commented 6 years ago

On an unrelated note. I'm not familiar with FUSE, are all file system operations going to the network?

For example when I switch to the notes directory and try to tab-complete notes, it takes about 3 seconds before they show up. For example simply doing the following.

cd ~/notes
vim <tab><tab>
tannercollin commented 6 years ago

They aren't, my code is just horribly unoptimized. How many notes do you have?

ddddavidmartin commented 6 years ago

I have about 200 notes in this account which does not seem accessive I would think.

tannercollin commented 6 years ago

Good to know, I created issue #7 to deal with it!