manyfold3d / manyfold

A self-hosted digital asset manager for 3d print files.
https://manyfold.app
MIT License
742 stars 47 forks source link

Model path template with / before {modelId} not auto populating metadata #2889

Open gavinmcfall opened 1 week ago

gavinmcfall commented 1 week ago

Tested on Version 0.81.0

Expected behavior: When scanning for new files. The application should interpret the folder structure and Automatically create new Creators/Collections etc based on the paths and then automatically assign those to the models

Actual Behavior: The models are imported with no collection or creator, the new creators and collections are not established

Images of my instance of Manyfold showing its configuration and the outcome of a new model that was scanned it image image image image image image image

Floppy commented 2 days ago

So, in this case, "Yanahri" should be the creator, and the collection should be "Genshin Impact"?

I'm not sure this is related, but try changing {modelName}/{modelId} to {modelName}{modelId} - the extra folder level there might be confusing things.

The code has tests which are passing, so it's working on some level, but perhaps you've hit an edge case somewhere. I'll keep digging into it.

Floppy commented 2 days ago

Ah! That is it! I've tested the situation with the folder separator between the name and ID, and it fails the tests! You can remove the / for an immediate fix and move on, or wait for me to include a proper fix.

Floppy commented 2 days ago

I'm not really sure how to resolve this; you've told it that the bottom-level folder is an ID, then a model name, then other stuff, and so it's failing the regexp match there. The ID is optional and is discarded, we just use it to throw away existing IDs when they're present on the file system; the problem is that the final / in the string isn't optional.

I've got this replicated in a test case now, but I'm not currently sure how to change things to get the right outcome for all situations.

I'd definitely recommend removing that last / for now; it might take me a while to redo the path parsing to handle the situation you've found here. I need to think on it. Maybe the parser should handle it, or maybe Manyfold should forbid IDs from being used that way in the template.

Floppy commented 2 days ago

I've also wondered if {modelId} should always be added, not be part of the template.

gavinmcfall commented 2 days ago

I removed the / so its just {creator}/{collection}/{modelName}{modelId} and deleted the library and scanned again and it got inconsistent results image

You can see here that some are missing Creator and Collection whist others have it, its not even a case of not creating them, because I have a NieR Automata collection already, it just didnt assign it

Floppy commented 1 day ago

OK, that's an improvement at least; The problem is that if the regex doesn't match in some part of the path, it won't parse anything, hence you get all of it or nothing. Can you post some paths that didn't parse properly so I can test them against the regex and see what's going wrong?

Floppy commented 1 day ago

Actually I'm surprised you've got some there with collection but not creator. I would have expected all or nothing, as I said in the last comment. 🤔

gavinmcfall commented 1 day ago

Thats what I would have assumed as well, I am not sure why its being inconsistent. Not sure if I am doing something wrong with my folders? I don't believe so

My Folder structure looks like this

Library
    3DModels
        Busts
        Diorama
        Chibi
            NomNom Figures
                Pokemon
                    Pikachu
                        pikachu.stl
                        pikachu-presupported.zip
                        pikachu01.jpeg
        Statue

In Manyfold I have the NAS mounted:

    persistence:
      media:
        type: nfs
        server: 10.90.1.69
        path: /mnt/storage0/media
        globalMounts:
          - path: /media

Then the Libaries are configured: /media/Library/3DModels/Chibi

So in this example {creator}/{collection}/{modelName}{modelId}

Chibi
    NomNom Figures {creator}
        Pokemon {collection}
            Pikachu {mopdelName}{modelId}
                pikachu.stl
                pikachu-presupported.zip
                pikachu01.jpeg
Floppy commented 10 hours ago

That structure looks fine; can you post the specific paths of models that didn't fill the metadata properly? Like that "Chibi Ankha" model in your screenshot that only has a collection, no creator? Or "Chibi 2b & 9s"? It's possible that there are characters in there that I'm not letting through the regex check, or something.