Open jaroet opened 4 years ago
Hello, I keep thinking about some reasonable ways to integrate with the file system as well - my ideal solution would be to sort of "mount" some directory into trilium - this directory could be placed wherever into the note tree and would also behave as tree itself (so you could explore through this mount point the directory structure as well). But while the basic idea is simple, it crashes on many bigger and smaller issues like the need to watch the filesystem changes, missing file metadata (.html file can be both text note or code note), these files not being present in most data structures/caches etc. In the end it seems way too much work and increased complexity.
But what you propose is more limited and therefore more feasible but I think there is a simpler way to achieve what you need:
Thank for thinking about it.
The thing about mounting a directory in the tree is that it is all in one place in the tree. And like I mentioned in my initial message I think having notes and related files close to each other is important. When a note with content is in a certain place in the tree the files related to that note, should be there also (IMHO). So a directory being mounted sounds less interesting, to me at least.
Thinking about it you might keep the current upload possibilities and in fact store all files together in one directory (to be configured in Trilium) instead of the SQLite file. And add metadata to know where to show the uploaded files in the tree. Could even be in multiple places. And maybe you should not even show the files in the tree anymore but make all uploaded files available as a hyperlink, possible in multiple notes. Easy linking with search option (like link to note) is key then. Just thinking out loud ... :-)
For instance TheBrain software recognizes when you again add a file that you added before and then gives you the option to link to that already uploaded file or choose to upload the as a new file. Question is how you would handle the naming of that file.
I think in windows you use %userprofile% to always link to the home directory of avuser. And as I understand from https://stackoverflow.com/questions/9228950/what-is-the-alternative-for-users-home-directory-on-windows-command-prompt when you use powershell you can even use ~ also. But I have no Windows machine to test that.
So many options to choose from :-)
Op do 14 mei 2020 om 14:18 schreef zadam notifications@github.com:
Hello, I keep thinking about some reasonable ways to integrate with the file system as well - my kind of ideal solution would be to sort of "mount" some directory into trilium - this directory could be placed wherever into the note tree and would also behave as tree itself (so you could explore through this mount point the directory structure as well). But while the basic idea is simple, it crashes on many bigger and smaller issues like need to watch the filesystem changes, missing file metadata (.html file can be both text note or code note), these files not being present in most data structures/caches etc. In the end it seems way too much work and increased complexity.
But what you propose is more limited and therefore more feasible but I think there is a simpler way to achieve what you need:
- Trilium needs to support opening local links - currently this is not implemented
- Abstract differences in directory structure on different platforms using symbolic links/junctions
- This works great across Mac/Linux - e.g. "~/trilium-attachments" could point to platform specific location
- With windows it's a bit more difficult since "~/trilium-attachments" is not a valid path, but perhaps we could find some solution.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zadam/trilium/issues/1015#issuecomment-628595666, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG3CDWG5AIVNU23OTLTYGVDRRPOQFANCNFSM4M7FH5TA .
Thinking about it you might keep the current upload possibilities and in fact store all files together in one directory (to be configured in Trilium) instead of the SQLite file.
This gets complicated with possible filename conflicts, the fact Trilium also supports versioning etc. In the end it would also create a mess - directory full of files which would need to at least contain some UUID. The benefits compared to just storing them in SQLite get smaller ...
And maybe you should not even show the files in the tree anymore but make all uploaded files available as a hyperlink, possible in multiple notes. Easy linking with search option (like link to note) is key then
Just noting that you can link file already just like any other note.
The reason why files (and images) are visible in the tree is that what happens when you remove the last link to the file? File then becomes inaccessible without you explicitly asking for it to be deleted ...
In 0.42 there's a new option to hide images from the tree if they are included in the parent note, something similar could be done for files too.
The easy linking I mean ... was when using the filesystem.
About only using hyperlinks to files ... hyperlinks to files link to uploaded files in a directory. With the upload metadata should be stored to where the files should be shown. When you remove a link Trilium should check the metadata to see if the file is linked in another note. If so, let it be. If not ... ask the user to keep or delete the file from the upload directory.
I have in my trilium for example a note about TaiChi. And I have like 16 files with different TaiChi exercises that are 60Mb in total (with pictures ect.). So although I would like to add those file to the TaiChi note I have not because I think it will blow up the SQLite file. Add those to a file based directory that support abstract links would allow me to link those files to the note. The metadata is also important because for instance one of the exercises is helpfull for headache so I want to link to that specific file from my personal health note.
Op do 14 mei 2020 om 15:44 schreef zadam notifications@github.com:
And maybe you should not even show the files in the tree anymore but make all uploaded files available as a hyperlink, possible in multiple notes. Easy linking with search option (like link to note) is key then
Just noting that you can link file already just like any other note.
The reason why files (and images) are visible in the tree is that what happens when you remove the last link to the file? File then becomes inaccessible without you explicitly asking for it to be deleted ...
In 0.42 there's a new option to hide images from the tree if they are included in the parent note, something similar could be done for files too.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/zadam/trilium/issues/1015#issuecomment-628645444, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG3CDWGUSB5OMBATKRSHM73RRPYSNANCNFSM4M7FH5TA .
My usecase is that I have PDF user manuals, datasheets, and reference papers that I'd like to link to from notes. They aren't versioned but in total will end up being hundreds of megabytes.
I'd be completely happy to be able to store the files in a synchronized folder such as by Dropbox and reference them in Trilium. The note would have to store a relative path and the document have an option for the system base path.
Personally I would not use synced folders like dropbox within Trilium but that would be off course your choice. I think only two things need to get done to make this a feasible working option.
So let Trilium use everywhere where the localpath is used replace it the mentioned path with the true path. lhp = "c:/users/username/Documents" on windows of lhp = "~/Documents" on a Mac
Store in Trilium everywhere the path lph:// and replace with the real path.
Hello,
I think Trilium is a great note-taking tool and it is facilitating almost everything I want in such a tool. Since I work with computers I have used Windows, Linux and at the moment a Macbook Pro for work and Linux at home.
I use Trilium as a standalone package on my Mac for the moment. I like the SQLite solution as it gives great advanced options as Zadam has wrote about in https://github.com/zadam/trilium/wiki/FAQ (second heading).
I add relatively a lot of attachments to my notes because I like the combination of the note content with the attachment without changing applications. Those attachments are stored in the SQLite file. This is not a big issue for now (with 512 notes the SQLite file is almost 15Mb) but the more files I add and after a few years of use that might change.
Adding the attachments in the SQLite file is not mandatory in my opinion. File based storage would suffice in many cases. But then there should be a way to abstract the link to the file so changing OS or configuration the links keep working. One way I would like to suggest is something like interwiki links. Both the current way and the interwikilinks ways can (I think) exists next to each other.
Interwiki links add an abstraction layer between links from one wiki to another wiki. You can read about it on https://en.wikipedia.org/wiki/Interwiki_links if you are not familiair with it. It is like a symbolic link almost (https://en.wikipedia.org/wiki/Symbolic_link). As I see it you would configure Trilium to recognize an interwikilink “lhp” (short for localhost path) as “/Users/username/Documents” on a Mac then a internal link to “lhp://Trilium/manual.pdf” would in fact link to "/Users/username/Documents/Trilium/manual.pdf".
When you change OS (to Windows for instance) you would configure Trilium to recognize lhp as “c:/windows/Users/username/Documents” and when you follow that same link in Trilium on Windows it will open “c:/windows/Users/username/Documents/Trilium/manual.pdf”. (I think the link URL is wrong for windows but I am not sure what it would be as I have not worked on Windows for many years now).
This would make the linking to files and the management of the files a lot easier and future-proof. When you change OS or decide to move your data folder to another location or even another disk, that would only require one change in the Trilium configuration to keep all your file links in Trilium working. All without integration all those attachments into the SQLite file. Of course we first need to be able to link to files on the local filesystem.
It would even be possible to have multiple configurations where lhp refers to one directory and another like “dd” would refer to a whole other directory or disk. Maybe even to a dropbox folder.
This is just a thinking experiment to see if something like this would work with Trilium as I have found out that investing hours of work in a hyperlinked personal information system is in most cases not a OS agnostic solution. Links break easily. Wiki's work but I find them limiting compared to a tool like Trilium in combination with SQLite.
Let me know what you think.
Regards, JeRoen