Thursday, October 8, 2009

User overlay virtual softlinks

This was introduced in libferris 1.3.8, The feature lets you have libferris create virtual softlinks for you when a directory is read. Overlay links are setup in the config file ~/.ferris/user-overlay-links.xml. The file sets up regex matches, when the regex is matched to a directory, a virtual link is created to a target location. The target location must actually exist at the moment, no dangling links are permitted. There is an example XML file in the dot-files subdirectory of the tarball.

For the gphoto:// filesystem I have this which creates the link G7 -> Canon PowerShot G7 (PTP mode) in the root of the gphoto:// filesystem.


<user-overlay-links>
<link-by-regex>
<vlink>
<match>^gphoto:[/]+$</match>
<target>Canon PowerShot G7 (PTP mode)</target>
<link-name>G7</link-name>
</vlink>
...



If the camera as a stable subdirectory that new images are written too, then a link right into that can be made in the root, "latest" takes me right to the images subsubdirectory.


...
<vlink>
<match>^gphoto:[/]+$</match>
<target>gphoto://G7/store_00010001/DCIM/102CANON</target>
<link-name>latest</link-name>
</vlink>
...


It seemed like a good idea to abstract this out of any specific filesystem like upnp and gphoto so virtual links can be made anywhere. In particular, for upnp a/v devices sometimes the server likes to use an insanely long name for itself, with virtual soft links, the client machine can give the server a nice short name of it's choosing.


No comments: