- Apr 4, 2020
- 135
- 385
Dear All,
Over the past while I've collected a respectable pile of DAZ assets which I store in a simple folder structure organised by theme. For example:
characters -> 00_creatures -> 00_dragons
However, on Windows in particular it can be hard to see the jpg images of the asset, as the windows explorer 'extra large icon' size isn't that large. Making it hard to browse/choose assets. To alleviate this issue I hacked together a trivial python script that walks the folders of a directory and pulls any jpg files out of those folders and dumps them into a single folder called '00_catalogue'.
Please note that the '00_catalogue' folder needs to be created by hand and the script should be run from a command line.
After running the script I then enter the '00_catalogue' folder and use
Anyhow, this setup works well for me so I thought I'd share it. Perhaps it might be useful to others.
NOTE: The script uses os.scandir() so you'll need Python 3.5 or later to run it.
Over the past while I've collected a respectable pile of DAZ assets which I store in a simple folder structure organised by theme. For example:
characters -> 00_creatures -> 00_dragons
However, on Windows in particular it can be hard to see the jpg images of the asset, as the windows explorer 'extra large icon' size isn't that large. Making it hard to browse/choose assets. To alleviate this issue I hacked together a trivial python script that walks the folders of a directory and pulls any jpg files out of those folders and dumps them into a single folder called '00_catalogue'.
Please note that the '00_catalogue' folder needs to be created by hand and the script should be run from a command line.
After running the script I then enter the '00_catalogue' folder and use
You must be registered to see the links
to browse the asset images.Anyhow, this setup works well for me so I thought I'd share it. Perhaps it might be useful to others.
NOTE: The script uses os.scandir() so you'll need Python 3.5 or later to run it.
Code:
# catalogue.py Primitive DAZ asset cataloguing utility.
#
# The 00_catalogue folder needs to exist.
# Was too lazy to add the half a line of code to
# check/create the destination folder.
#
# (c)2020 under GPL - 8InchFloppyDick @f95zone.com
import os
CURRENT_DIR = os.getcwd()
CATALOGUE_DIR = CURRENT_DIR + "\\00_catalogue\\"
for entry in os.scandir(CURRENT_DIR):
if entry.is_dir() and not entry.name[0:2] == "00":
for thing in os.scandir(entry.name):
filename, file_extension = os.path.splitext(thing.name)
if (file_extension == ".jpg"):
# sanitise filename
filename = filename.replace("-00-main-", "")
filename = filename.replace("00-main-", "")
filename = filename.replace("-00-main", "")
filename = filename.replace("_main", "")
filename = filename.replace("-daz3d", "")
filename = filename.replace("daz3d-", "")
filename = filename.replace("00-daz3d_", "")
filename = filename.replace("daz3d_", "")
filename = filename.replace("daz3d", "")
filename = filename.replace("product_image_", "")
filename = filename + file_extension
os.system('copy "' + os.path.abspath(thing) + '" "' + CATALOGUE_DIR + filename + '"')