mfarragher / obsidiantools

Obsidian tools - a Python package for analysing an Obsidian.md vault
Other
402 stars 28 forks source link

Reference to non-md files #25

Closed martinlackner closed 1 year ago

martinlackner commented 1 year ago

It seems that obsidiantools does not track non-markdown files (pictures, etc). As a consequence, vault.nonexistent_notes list all references to such files. I suggest to include non-markdown files in the graph as well.

And, on a related note, vault.nonexistent_notes wrongly includes notes that are referenced with extension. For example, a reference of the form [[note.md]] leads to note.md being listed as non-existent even if the file note.md exists.

mfarragher commented 1 year ago

:one: I actually have non-existent files in my test vault so I could explore this. It's a good time to explore features involving non-md files, with the new canvas file format.

:two: I've created a new issue for this #26 and will deploy a fix now. I hadn't included .md extension inside wikilinks before, but think that will cover it.

I should probably ask people for their Obsidian settings for wikilinks when raising issues for my future sanity, as I avoid using any filepaths in my wikilinks. :smile: These are my settings: files-settings

mfarragher commented 1 year ago

I've implemented changes on a new branch, which should cover this. The latest commit for it is https://github.com/mfarragher/obsidiantools/commit/ef02f2c4365b68aa1eebe32bd18d89dd7379da26 , where I've created a get_media_file_metadata method.

From other changes on that branch, nonexistent_notes will only include md files and there is a new nonexistent_media_files attribute to cover the media file types supported in the Obsidian app.

Similarly, there is a new isolated_media_files attribute for media files (the md equivalent is isolated_notes).

The new attributes are working as I expect on my largest personal vault but I'll add some tests for the dummy vault.

mfarragher commented 1 year ago

The new attributes look fine and things still function as expected for .connect(..., attachments=False) default, but things are a bit broken for the note-related attributes when attachments=True. There's still some more work for me to do.

mfarragher commented 1 year ago

Done - changes now in dev. PR has more detail.

Test vault

Example of media file metadata for test vault: media-file-functionality

Large personal vault

In my largest personal vault with 9 media files not embedded in notes, they are correctly showing as being the 'isolated' media files. media-file-functionality-large-vault