Sort by folder?

A user just asked:

Is there any way to sort by folder? I find it strange it can dig and crawl through folder structures yet I see no way to sort it out by these structures.

Sorting by folder (or any other hierarchical tag) is actually a bit tricky…

First off, know that PhotoStructure works with “assets,” each of which have one or more asset file “variations.” More details are here.

Each asset file variation will contribute tags to the asset, so when browsing by folders, the correct assets show up.

If you enable automatic organization, or have other sources of duplicate asset files in your library, each asset will actually belong to several folders.

So: if an asset belongs in multiple folders, it’s not clear-cut on how sorting would work.

I could arbitrarily pick the “least” folder name, but I suspect that would be confusing.

I’m happy to entertain alternative solutions!

1 Like

Hey I am the original user that asked. Was just curious since i have it set so it only will not move or reorganize any of my folders and all my images are already saved and sorted into about 50 different folders ranging with over 10k photos and 1k videos. Is there not a way to display it as it sees it for instance it found file “001 in /folder/folder1” while it found file “048 in /folder/folder6” and displays each folder as a “When” essentially and the folders sort by either last added to or by alphabetical order. by using each individual folder it found each image in it just adds a new “When” asset that would not be When but instead “Folder Name” when opened you can sort images inside this asset by Name, Date added, or Random. I am not big with code but these are the best descriptions of understanding I can give. Big thing I am noting is I am not having PhotoStructure move or copy any of my files instead reading directly out of the original folder tree.

Seems like any time you’re looking at the file structure, you should include any asset file within that file structure, regardless if it has other variants. You can use the asset in other stream contexts, but when the context is file structure, use the asset file.

Just a thought!

The When and Filesystem root tags actually use exactly the same frontend code to render themselves: they’re both just hierarchical tags.

This is a great idea! I just added this as a feature (feel free to vote on it): Support different "view by" treatments for tag galleries

Right, this is how it works!

Know that the tags associated to an “asset” are gathered together by “merging” the collective metadata of all the asset file variations: which is why an asset may have more than one folder tag.

So what your saying is PhotoStructure takes the original file path and distorts it to a simpler easier to read format that only allows you to show certain formats for instance “when” which makes sense keeps the code speedy.

I am just curious you mention assets are you taking each image and video and creating it into an asset? then each asset is then taken and broken down by keywords instilled to the photo which means essentially if I want my file structure I need to use a batch tool to add a tag to all my images that are in each folder with the name of said folder so they each will show up where they should properly. By tagging all images inside folder for example if I have images inside “/Folder/Folder06” I need to tag all those files with “Folder06” and then under the tag tab that you have it will put all those into 1 area which would be the folder tag itself. But what if instead of that being on our end what about an option built into the software to instill a tag to files in sub folders with the subfolder name to keep all files in a subfolder together as a tag.

Final Edit sorry -

Upon adding a tag you could somehow possibly make that tag you add into the image a “Master” tag. So when you sort through your tags you can sort by the “Master” tag which could be done simply by adding a special symbol in like & or % or $ in front and have it so the master would be the tags with that character in front. So you can differentiate between the folder tag and the image tags.

Yeah, that’s how deduping works: if you check out your library database (sitting in .photostructure/models/db.sqlite3), check out the Asset and AssetFile tables.

This shouldn’t be necessary. Version 1.0.0 added folder tags that should be added automatically: if you’re using v0.9.1 you’ll need to try a beta build.

Rather than relying on magick prefix characters, PhotoStructure uses tag hierarchies: you can add them adhoc via exiftool (for now, and via PhotoStructure once this feature is implemented). Image tags are placed under Keywords/, and filesystem tags are placed under fs/.

So I did not realize there was an extra hidden beta for 1.0.0 I use the Docker version and in order to update I didn’t realize I had to change the pull location I figured it updated with the docker itself. I Apologize for the confusion on that I missed the new version completely.

So I tried to use this method and i updated it into 1.0.0 now i am having issues with it saying Library is already opened by and refuses to start

Sorry about that! v0.9.1 sometimes didn’t shut down cleanly, and leave those library locks around.

If you rm LIBRARY/.photostructure/opened-by/*.json (replace LIBRARY with the path that you bind-mount to /ps/library), it should start.

do i type that into the terminal of the server itself or?

On the server that’s hosting docker containers. If you can’t get a shell on your host server, you can browse to the .photostructure directory and just delete the whole opened-by directory.

beta.14 will automatically remove these spurious opened-by lockfiles, fwiw.

Apologies again for the hassle!

Despite it taking me a second to learn how to remove the open by directory in Unraid realized just editing the file and deleting all info on it worked great now it works and with this new folder view by ability i can say 100% this is what i have been looking for. This docker is my favorite thing ever. I use to use SMB galleries but i ran into issues where it would load slow or if at all videos wouldn’t run but having all that happen at the source on the NAS makes it work perfect plus this gives a neat little website i can look at which is perfect offline discrete and secure.

I was using Jellyfin which is okay except that um you can sort it out but when you click an image and go to slide it stays in its original defaulted order doesnt rebuild it for that which is dumb