Adding file content overlays by script
I have a script that writes a loader script for each native file in a destination tree and places it, with an optional dummy pz2 file, in a chosen location - the idea being to allow users (me) to rearrange their content, in the form of the loader scripts, without breaking the CMS, on the original, unmoved files. It seems to be working but now I'm wondering if I can write a script to match the loader with the original file (which should be possible by parsing it if nothing else), get the content type from the database, and associate it with the loader or the dummy pz2 so that i get the type overlay in the Content Library - without having to give the file all of the CMS entries for the original (it would be a pain if noth the real file and the loader appeared in the Smart Content pane.
So, is it possible (without Rob's having to write an essay in his copious spare time) to get a file's type from the CMS, and to give a file without an entry in the CMS enough information to show the type overlay without appearing in the same searches as the source file, using scripting?
Comments
-Rob
NOTE: You will need to refresh the Content Library Asset View to see the change.
Thank you, I was expecting it to be much more complex.
OK, that works - but as feared from having to feed in the absolute paths, it works only if the content is in the content folder I installed to, which it isn't a I install to a working folder, make sure everything is working, and then move to the real folder (the intent being to keep relative paths intact). That's a bit of a pain, though for myself I could live with uninstalling and reinstalling after testing (assuming there were no bugs I needed to fix, at least) but that's a bit of a performance to make available to others. If I add the original absolute path to my loader script, so that the script for copying the overlay has both the original, stored in the DB path and the current, obtained from DzContentMgr via the relative path, locations is there a way to update the record for the main file so that it points to the current location and not to the temp install folder? That is
Given:
install content directory
current content directory
relative path
Can I:
update CMS to use current content directory/relative path instead of install content directory/relative path without breaking the rest of the CMS record?
This is equivalent to navigating to a Category or Product in the Content Library pane, right clicking in the Asset View and choosing Database > Edit Base Path(s)...
-Rob
OK, thank you, that should help - though it does appear that it will be a universal replace, which would work OK for me but might not be for other users.
The question prompted me to look at the DzDB* wrapper classes. I noticed that the DzDBContentFoldersTable wrapper was missing a few more recent functions that provide individual file/directory access. I've added those functions to the wrapper, but you being able to access them obviously requires a new build. Right now that means it won't be available until a build after the 4.6.1.14 Release Candidate transitions to General Release. As the additions pose very little risk, IF we end up needing to address any show-stopper bugs in the RC, I'll merge them into the 4.6.1.x branch for the build... otherwise you'll have to wait for the next release cycle. Obviously, once you have that build and you use said function(s), the users of your script must be running the version [or later] that provides the access... which means you should guard against an earlier version; see this example.
-Rob
Thanks Rob - I was wondering the other day how to get a human-friendly version number from the raw value.