Relative paths without `mediapath`?

Feel free to ask if you need any help.

This has already been agreed and we will start introducing type hints in the next release.

1 Like

In case you want to watch that GitHub discussion:

2 Likes

@Nick-Hall

Would it be a reasonable enhancement request to add a Gramps XML and package export option to: “convert relative media paths to absolute”?

If you run Betty on another machine, there’s a big chance that its home or users directory is not exactly the same as on the machine that did the export. And in fact, it may even run another OS.

This means that even if you have a base media path, it may not work, and absolute paths may not work either. And in most cases, the user does or should know where the files really are, and should hence be able to specify a base path and/or a replacement path.

1 Like

Excellent work on adding type hints! I left a few comments based on my experience converting Betty from untyped to typed. I hope they’re useful :slight_smile:

Updating Gramps to ensure a media path is set whenever an export is created, would solve my problem, and others (including migrating a family tree from one machine to another, assuming the same OS family). I’d be happy with such an update :slight_smile:

Thank you. Any feedback is always appreciated and often very helpful.

Thanks, everyone, for your comments! I went ahead and implemented a solution that raises a helpful error as soon as it encounters a file with a relative path, and the family tree XML does not specify a base media path: Support relative file/media paths when loading Gramps family trees by bartfeenstra · Pull Request #2194 · bartfeenstra/betty · GitHub

1 Like

It would probably be better to export the default media path if one isn’t defined in the settings.

2 Likes

Submitted Feature Request

0013493: [XML export] include a default media path for those not explicitly…

Setting a default media path in an export would meet the needs of Betty. But what of the backup being imported into a new Gramps database. You would be setting a media path that the original did not have.

There are a number of issues that need to be resolved for importing XML with regards to media and their paths.

Right now, import chokes on repeated attempts to import a .gpkg archive. This is because the import first creates a folder for the Relative Path media files. It that folder already exists, the import fails with a very unhelpful message.

This could be resolved in any of 3 ways…

  1. if the folder exists as a subfolder of a designated “temporary” folder, the destination folder could be removed (with confirmation) and recreated
  2. the error dialog could include a hotlink to the destination folder. Then the users could manually resolve the conflict without having to discover where autonomously and transparently created a folder in a past action.
  3. Gramps offers to continue the import but skip the Media portion of the restoration

A better but MUCH more complex option would be to compare the directory and MD5 checksums of the existing folder against the archive. Then flag differences kmissing, new, MD5 mismatches) with resolution options.

If you do an import, you may need to change the path to fit the directory structure on the importing machine, especially when you work with a different account on that, because that often leads to a different home directory.

And further on, the whole thing is futile, if you run Betty on a machine that doesn’t have a Gramps at all.

1 Like

I like the idea of a base media path and I use it.

My issue is that if Gramps does not need a base path and will accept media without a path set, why on a backup/export is Gramps now saying the base path is needed.

On a major upgrade, I will often make the transition by doing an import, not letting Gramps ‘convert’ the database. If I did not have the base path previously set, after the import, I know have one. ???

1 Like

Good point, and that may be a reason to keep it empty, because in that case, it moves with your home folder, and there is no reason to change it when you move to another machine.

And if that works, it can save us a lot of support ‘calls’.

1 Like

Yes. This probably needs more thought.

2 Likes

We should probably link an old (2008) MantisBT in the discussion. Any resolution here will resolve it too.

  • 0002450: photo import : media path can not be found

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.