Invoke with custom file list

Describe any features you would like to see in future versions of FastPictureViewer Professional.

Invoke with custom file list

Postby matt25121 on Sat Jan 29, 2011 5:24 pm

Would it be feasible to add the ability to invoke FastPictureViewer with a custom file list instead of just a folder?

I'm developing an SQLite-based picture browser application whose purpose is to quickly generate various file lists to be passed to an picture viewer of choice - for example, files with specific tags (with boolean operators), N latest files, N random files based on certain criteria, similar files, and so on.

I have no need to create an picture viewer component, because there are plenty of those. And FastPictureViewer is just about awesome in that regard.

So, I'm humbly asking for a feature to somehow pass FastPictureViewer a custom list of files that would be used in place of a single folder. One alternative could be just to pass each file path as a command-line argument, though there are probably length limitations to this. Another option would be passing a text file that lists each file path on a separate line. Or it could be as simple as a folder filled with shortcuts to the actual picture files. A more advanced system could be some form of integration with Windows Scripting, possibly through .NET, though that might require a bit more work.

Thanks in advance for even considering this suggestion.
Posts: 2
Joined: Sat Jan 29, 2011 5:03 pm

Re: Invoke with custom file list

Postby Axel on Sun Jan 30, 2011 3:10 pm

At the moment the only option is to pass a folder name (or file name) on the command-line, and the program will load the folder in question, or the file and all its siblings. Depending on preference options, the program will also load any images in sub-folders (this is the default behavior).

There is no mechanism to pass a custom list of images to FastPictureViewer at this time. I've considered adding such a mechanism previously, to open Explorer's search results when clicking an image that was part of a search result set, but I did not find a way to get access to the search results which seems to be internal to the shell, so I did not implement the mechanism in question in FPV.

You could fake something using hard links: create a dummy folder, say "SearchResults", and populate it with hard links pointing to the real images. To experiment with hard links, FSUtil.exe is your friend:

Code: Select all
fsutil hardlink create "C:\SearchResults\img1.jpg "C:\SomePathname\SomeImage.jpg"

Your application only needs to manage the content of the SearchResults folder (clean it, populate it with current search results...) then launch FPV on this folder.

This will do what you want with some restrictions (from the top of my head):

  • All files must live on the same volume.
  • Deleting/renaming a file from FPV will only delete/rename the hard link, not the actual file.
  • Rating in FPV will rate the original file if the format is JPEG, TIFF or HD Photo and XMP embedding is enabled, but if the program is configured to create XMP sidecar files (as when rating raw files) the sidecars will be created in your SearchResults folder, with the same base name as the one you used when creating the image's hard link.
You can probably get around most of this by careful management of the SearchResults folder, for example you could detect deletions and delete the originals. You could also create hard-links to existing sidecars (so the program will update the original sidecars when rating) and detect then move back newly created sidecars.

With some (seemingly reasonable) work, the only limitation that might remain is the “same volume” restriction, as hard-links cannot point to files on a different volume. But then there are junctions (reparse points) and symbolic links, where you can mount a volume within a folder or join folders from different volumes, so there is probably some way to work around that last issue too.

I'm sure you can hack together something basic in a half hour or less. Then if you see it works for you, you can tackle the special cases described above (you may find more special cases along the way).

Besides FSUtil.exe, you can create hard links using the straightforward CreateHardLink() Win32 API function.
Site Admin
Posts: 795
Joined: Thu Nov 06, 2008 1:54 am
Location: Geneva, Switzerland

Re: Invoke with custom file list

Postby matt25121 on Sun Jan 30, 2011 5:13 pm

Ah yes, hardlinks! I completely forgot about those. I just thought about shortcuts and saw that FastPictureViewer didn't support them, and promptly dismissed that approach.

I'm building the GUI using Adobe AIR, which doesn't directly support creating hard links. FSUtil worked, but it's rather slow to call many times in a row. Luckily, in the environment I'm working in, I can assume an installation of Python or Windows Script Host. It's a bit of a hack, but I dynamically create a Python or WSH script on disk that calls CreateHardLink() for all relevant files, and then run the script using just one native process call, minimizing the operating system overhead. It only takes a second even for a list of hundreds of files.

And you were right, it really did take half an hour. :) The basic setup works. Now I can start thinking about the special cases. I already handle file deletion from within my GUI, so that's off the list. Ratings should be fine as my environment doesn't use sidecars. The other restrictions from hardlinks themselves will take a bit more work, but I see nothing too difficult there.

Thanks for the quick response!
Posts: 2
Joined: Sat Jan 29, 2011 5:03 pm

Re: Invoke with custom file list

Postby bxf on Wed Jun 05, 2013 3:09 pm

I've developed a small program that enables one to invoke FPV from Windows Explorer, and process only selected files. This is done without copying the files - hard-links are used.

The process is reasonable efficient - at least on my laptop - even if a large number of files is selected (there is some asynchronous processing, which reduces the time one has to wait for FPV to start). I suspect it would require a user to be running with Administrator privileges, though there may be ways around this. Also, it requires the installation of Classic Explorer (a component of Classic Shell), which is a useful application quite apart from its use for the purposes indicated herein.

If anybody is interested, I'll post the program and instructions.
Posts: 19
Joined: Sat Apr 03, 2010 9:54 pm

Return to Suggestions