Stand alone product keyword and search - Now mac supported

kaotkblisskaotkbliss Posts: 2,914
edited September 2020 in Freebies

***Update 9/28/20***

Added 2 new buttons, 1 to show just the items that have not had any keywords added yet and another to clear the database of any entries that no longer have an image

*************************

***Update 5/12/20***

Added a total number of products under the product list

Added a button to clear your item selection which also clears the preview image and the keyword list

Added a button to remove an item from the list, which gives the option to just remove it from the list (This option simply removes the entry from the xlsx data and will find the item again next time new items are searched for) or to delete the actual image file as well (This option will remove the item from the data as well as deleting the runtime\support image so it will not be found again. This will also prevent Daz Studio from being able to display the image in the product library though)

*************************

***Update 11/11/19***

Searching for new runtimes should be a little faster

Buttons and labels now let you know the app is working when searching for runtimes or products

Auto install for the modules that appear to be missing from the standard python install

*************************

***Update 11/5/19***

Changed Get Items button to Update Items - it only gets a list of your items now

Added an Add Runtime button to search your computer for runtime folders

Improved filter - searches as you type, matches all words in filter (If you type v4 texture, it will only return items whose name or keywords contain both v4 and texture)

Changed Filter button to Clear Filter

***********************

***Update 10/25/19***

Should work on Macs now!

*************************

***Bug fix***

Found an oddity introduced with the last bug fix :( Where the keyword list would not empty out when selecting an item that has not had any keywords added after selecting an item that did have keywords. 1 simple line fixed that.

**************************

***BUG FIX***

Delete was not working correctly and the keywords were getting all switched around and duplicated

I believe it's fixed now. Update attached!

Let me know if you find oddities please :)

*************************

***Update 10/24/19***

Can now delete keywords

Main list won't lose focus of selected item

Search by filename only, keywords only or both (and saves your preference for the next run)

New zip attached!

*************************

***Update 10/18/19***

New zip making the changes to keywords as talked about below :)

Enjoy!

*************************

 

So I finally got off my butt, picked up python for basically the first time ever yesterday and put together a program that will compile a list of dim installed products, add keywords to products and filter the list based on your searches.

The Dim package assistant sold here definately comes in handy for adding products from other sites that will then be able to be picked up by this app.

Or you could simply add an image to the runtime\support folder

**It uses the name of the thumbnail for the product name**

What this does:

When you first open it, you will be greeted with a couple blank boxes a filter button and a button that says generate.

When you click on the generate button for the first time (This part may take some time) the app will crawl your entire system looking for runtime folders that have a support subfolder. It will make a list of these locations and save them to a file so it won't have to do this again.

The reason I use runtime\support, is that is where Dim installs the product thumbnails when it installs your products.

You can reclick the generate button any time you install new products, it won't search your entire system again as it knows exactly where the runtime folders are, so it can just simply look for and add new thumbnails to the list.

The next thing it does is it goes through those runtime\support folders and makes a list of all the images there with the full path and saves them to an excel sheet to use as a database.

You will then see the center box fill up with all the products it found thumbnails for. When you click on one of the products in the list, you will see a few things happen. First, the box in the center right will fill with the thumbnail of the product. You will see a new box below that, along with an add keywords button and a text box.

Enter your keywords, separated by a semi-colon ; (not really neccessary for the filter, but it seperates them out nicely in the box above) then click the add keywords button.

***A couple things to note about the keywords***

It doesn't immeadiately update the keywords list (yet) and doesn't clear your text box (yet) so it looks like nothing has happened but if you click on a different product, then go back, you will see your keywords in the list.

Another thing is it doesn't append new keywords to a list you already have for a product (yet) it simply overwrites the old keywords with your new list of keywords. So if you have keywords such as space suit;male;textures (I guess it's a texture set for a spacesuit) but then later decide you want to add scifi to the list, you will have to re-enter space suit;male;textures;scifi

I plan to work on fixing these 2 things next

***************************************************

So now that you have some products in a list and some keywords entered, you can then use he Filter option (which is the main feature this was built for).

Type in a word or partial word and it will filter your list of items down to those names and/or keywords that contain your search term.

At this point you will see 3 files on your computer: the DazDB.py (this app), daz_config.ini (will eventaully contain settings and such, but for now just contains your runtime\support locations which you can open and edit in notepad) and the Daz_data.xlsx file (This is the database, column A contains the full path to each thumbnail and column B contains the key words for the product in column A)

For now this is windows only, but I plan on adding Mac support (since I actually have one for use at work, so I will be able to add and test to get it working there too)

And, this is just the bare-bones start of the app which I plan to continue to improve on.

zip
zip
DazDB_09.zip
6K
Post edited by kaotkbliss on
«1

Comments

  • kaotkblisskaotkbliss Posts: 2,914

    Made the changes to keyword entry.

    It will now imeadiately add the keywords to the list box and clear the input box when you click the add keywords button.

    It also will simply add the new keywords to the end of the list if there are already keywords for a product.

     

    The next bit I want to work on is being able to delete keywords from the list. (You can currently do this by opening the xlsx file, finding the product and removing the keywords from there)

    After that, I think maybe a button to rescan your computer in case you add a new runtime folder. (Currently you can open the config file and manually add the path there).

    I'm updating the first post with the new zip (Since the site doesn't accept files with a .py extension. Also, here's a screeny of what it looks like at the moment :)

    DazDB.JPG
    755 x 535 - 86K
  • Faeryl WomynFaeryl Womyn Posts: 3,544

    I really like this, so helpful, thank you

  • kaotkblisskaotkbliss Posts: 2,914

    I really like this, so helpful, thank you

    Thank you :)

    I've had this idea for a long time to make. I have probably just as many products from other sites as I do from Daz and I'm always forgetting about items I own, or miss a really cool shirt when putting together a costume or something because it wasn't tagged.

    With this, I can tag any product from any site (Like listing all the pieces of an outfit or items in a prop set) so I'll be able to find exactly what I'm looking for :)

  • Faeryl WomynFaeryl Womyn Posts: 3,544

    My biggest problem is remembering what I bought from Renderosity, so I don't accidently buy it again. They use to have a notice telling you if you already owned something, don' t know why they removed it.

  • kaotkblisskaotkbliss Posts: 2,914
    edited October 2019

    Made a couple of updates :)

    Keywords can now be selected and deleted (in case you typo or add the wrong word or whatever reason)

    The main list would unselect the item you had selected when clicking elsewhere, it doesn't do that anymore.

    I added checkboxes so you can search by just filenames, your keywords, or both and it saves your change.

     

    Next I'm thinking of adding a button to the left side (plenty of space there :) ) to re-search your computer for when you create a new runtime library in a different location and need it added to the list.

    Also, I'll be looking into making sure it runs on Macs :)

     

    *edit*

    In case anyone was wondering, I downloaded Anaconda and use the included Spyder (selected the python version 3 option) for running the py code. I debated compiling it to an easy to run exe file, but this way everyone can see the code for piece of mind that it's non-malicious and if anyone has code change suggestions (since I am very new to python) or if they just want to add stuff themselves.

    Post edited by kaotkbliss on
  • kaotkblisskaotkbliss Posts: 2,914

    I don't have Daz Studio or any products installed on the Mac I use since it's a work computer but I did take some time to get it running on a mac.

    So what I did was created a runtime folder on my desktop and put a Support folder inside that, then took a bunch of screenshots and placed them in the Support folder.

    I then ran through the code updating object placements and paths for it to switch to in running on a mac.

    Everything seems to work but I am not hugely familiar with macs (I know just enough to use it for what I need at work) so if you are a mac user and find something isn't working as it should, please let me know with as much information as you can (what's not working and where your runtime folder is and such)

  • kaotkblisskaotkbliss Posts: 2,914

    New update :)

    Did a bit of work on the filter.

    Previously it would only look for exactly what you typed in product name and keywords. But now you can enter multiple words and filter items down more specifically.

    For example, say you have a product named green_textures_for_genesis with keywords of tights;robinhood

    If you enter 'genesis texture' this item will show up :) same as if you enter genesis tights

     

    The search also filters as you type so no need to click the button anymore. In fact, the button will now clear your search and reset the list to show all your items.

    There are also 2 separate buttons on the left side now. 1 to get a list of all your items and 1 to search for runtime folders, 1 button no longer does both.

  • Hmmmm.... I might be doing this wrong.  I grabbed the script, placed it into an own folder on my E: drive, and ran it.  I saw the black, text-commands window come up breifly, then..... nothing.  That pane just disappeared and no GUI came up.  This might be because I have both my My DAZ 3D Library and my InstallManager folders moved to the E: drive and the script doesn't know the new location.  Or am I missing something?

  • kaotkblisskaotkbliss Posts: 2,914

    What version of python are you running? This was made with the 3+ code which has significant differences in the tkinter module used for the GUI interface

  • nomad-ads_8ecd56922enomad-ads_8ecd56922e Posts: 1,933
    edited November 2019

    Hmmmm....  clicking on my Start button and scrolling down in there to see what programs I have, I see I have a folder for version 2.7 in there, and below that a folder for version 3.6, but I'm not sure which one is invoked when I click the icon for this script.  How do I determine which version I'm running?

    Python in Start -- 20191107.png
    408 x 620 - 199K
    Post edited by nomad-ads_8ecd56922e on
  • kaotkblisskaotkbliss Posts: 2,914
    edited November 2019

    You can right click the DazDB.py file and select properties and it will have a label in the first tab that says "open with"

    Next to it, it should tell you which one it's using. There's also a button to change which program will open the file.

    Post edited by kaotkbliss on
  • kaotkblisskaotkbliss Posts: 2,914

    Since I use Anaconda's Spyder interface for writing code and have simply executed it from there, I wasn't aware of this.

    I opened a cmd prompt and ran it from there, which gives me an error that it can't load the PIL module (used for creating the preview image)

    Googling the error it may be that the version of the module isn't matching the version of python that's being run.

    Make sure these imports are installed and up to date:

    os
    platform
    configparser
    glob
    tkinter
    openpyxl
    PIL

    Also if you run the IDLE, you can load and run the script from there. It will also show you the error causing it not to run

     

  • nomad-ads_8ecd56922enomad-ads_8ecd56922e Posts: 1,933
    edited November 2019

    Bah, I am a complete novice noob when it comes to Python here.  Is there some kind of automatically-install-everything-needed doohicky for this?  It looks like I'm expected to do a bunch of manual downloading of packages, manually unpack a bunch of zip files, and do a bunch of command line fingertangling lists of commands to get all the bits and bobs in place before I can finally run this script.  0o

    DazDB python 20191107.png
    919 x 644 - 92K
    IDLE error 20191107.png
    761 x 800 - 76K
    powershell pip problems 20191107.png
    861 x 732 - 55K
    Post edited by nomad-ads_8ecd56922e on
  • kaotkblisskaotkbliss Posts: 2,914
    edited November 2019

    After some more experimenting:

    If you run the IDLE and it gives missing module errors:

    You can open your cmd window, then cd C:\path\to\python\exe

    The run the appropriate command to install the module:

    openpyxl error: python -m pip install openpyxl

    PIL error: python -m pip install pillow

    win32api error: python -m pip install pywin32

    then 

    python "C:\Users\kaotk\AppData\Local\Programs\Python\Python38-32\Scripts\pywin32_postinstall.py" -install

    Where C:\Users\kaotk\AppData\Local\Programs\Python\Python38-32\ is the location of your python exe

     

    After I ran all those, I was able to start the app through the python IDLE

     

    *edit*

    Just saw your reply above mine. Yeah, it was a bit of a pain to go through and get things working which is why I added the list of the exact commands/steps I used to get it working outside anaconda. I wish it were easier :(

    Once you get it working, you can change the "open with" from the python.exe to the pythonw.exe and it will run the app (just the python.exe will still bring up the cmd window and close right away)

    *another edit*

    Fixed the win32api post install command

    Post edited by kaotkbliss on
  • Bah, still having issues....

     

    install troubles 20191107.png
    863 x 738 - 80K
  • kaotkblisskaotkbliss Posts: 2,914
    edited November 2019

    Don't change directory all the way into openpyxl

    Stop at the python38-32 folder because that is where the python exe is at

    Didn't notice that you continued from the same window and are now on the win32api

    The full command after you do python -m pip install pywin32 would be

    python "C:\Users\kaotk\AppData\Local\Programs\Python\Python38-32\Scripts\pywin32_postinstall.py" -install

    (I forgot python at the beginning :O )

    Post edited by kaotkbliss on
  • nomad-ads_8ecd56922enomad-ads_8ecd56922e Posts: 1,933
    edited November 2019

    Okay, I did the revised version of that last command..

    In addition to that, I've been trying to follow instructions I was lead to by a search for what to do if you get such and such an error, and which are over here, which said something about: to fix this error, go get THIS archive, unpack it, place the resulting directory INSIDE the Python folder, then from command line navigate to inside THAT folder and invoke such-and-such command (which I did last in this screen grab, and was also trying to do earlier).  In any event, I'm still getting errors on this stuff, and am having no luck getting your script to run.

    It's irritating that when I invoke the various commands you listed earler, and some others, it never gives any feedback on those commands, so I don't even know if it actually, genuinely carried out the commands, or if those just quietly failed and it didn't bother to tell me as much.  0o

     

    more python install issues 20191107.png
    860 x 739 - 85K
    Post edited by nomad-ads_8ecd56922e on
  • kaotkblisskaotkbliss Posts: 2,914
    edited November 2019

    I did think that was strange, maybe a powershell thing? I'll run the commands there and see what I get.

    In the cmd prompt I see stuff like the attached

     

    *edit*

    Just tried in powershell and it told me it does not load commands from the current dirrectory, if I trust the command python, then use .\python

    When I then entered .\python -m pip install openpyxl I got feedback on the progress

    pythoninstallmod.JPG
    979 x 511 - 77K
    powershellpython.JPG
    859 x 734 - 153K
    Post edited by kaotkbliss on
  • nomad-ads_8ecd56922enomad-ads_8ecd56922e Posts: 1,933
    edited November 2019

    Okay, went back in and redid the commands you listed earlier, with .\ inserted at the beginning of each, and in the order you gave them (and I did nothing with that other directory I moved into there), and now, loading the script from IDLE and running it, I get the expected interface, but the GUI for that seems to just lock up when I click on the Add Runtime button.

    On a different note, I see one of the invoked commands said something to the effect of "I see you're running version such-and-such of this, you might want to update to so-and-so version."  Is that something I need to go poke with a stick?

    updated using dot-slash 20191107.png
    865 x 986 - 119K
    DazDB gui hung 20191107.png
    898 x 967 - 145K
    Post edited by nomad-ads_8ecd56922e on
  • kaotkblisskaotkbliss Posts: 2,914
    edited November 2019

    I found that once I click the runtime button and if I try to click another part of the window, windows will say it's no longer responding (even though it really is) but it makes the search take quite a bit longer.

    The search for a runtime will take quite a bit of time as it crawls through all the folders on all of your drives looking for runtime\support. Fortunately it's just once (maybe twice if you add a new runtime later)

    After it knows the location(s), then when you search for items, it just goes straight to those locations and gathers up the promo images to build the library list

     

    *edit*

    Those upgrade suggestions just look like pip upgrades, which is simply the downloader/installer for python to get the other packages. I don't see a need to upgrade since it got and installed everything

    Post edited by kaotkbliss on
  • So, it finds them, even if they're on another drive than C:?  I have all of mine on drive E:

     

  • kaotkblisskaotkbliss Posts: 2,914
    edited November 2019

    Yep :) That's what these 2 lines do

    drives = win32api.GetLogicalDriveStrings()
            drives = drives.split('\000')[:-1]

    The first gets all the disks from the system, and the 2nd line strips off the internal name leaving just the drive letter and puts them into an array

    which I then loop through the array 1 item at a time searching all the folders for each drive

    *edit*

    I should note, you'll know when it's finished searching as the add runtime button will depress when it's complete

    Post edited by kaotkbliss on
  • Should I be seeing lots of disk activity for this?  I'm seeing none.

  • kaotkblisskaotkbliss Posts: 2,914

    I don't think my pc showed much disk activity either. I believe what it does behind the scenes is gets a list of all the folders for the drive first, then goes through that large list of folders checking if they match the condition so it would be mostly cpu work.

  • kaotkblisskaotkbliss Posts: 2,914

    @nomad-ads_8ecd56922e

    How did it go?

    I was finally able to get the py script compiled to an exe and run so now I'm testing everything for the exe

    Scanning my C drive took about 10 minutes or so still leaving D, E, F, G and H     :O

     

    I'm trying to think of ways to speed this up while still being thorough. I know that if there are no subfolders, the current folder can be skipped

    If it only has 1 subfolder and the current folder is not Runtime, it can be skipped. That's all I can think of right now and I'll have to see if that information is given durring the os.walk method.

  • Ok, I'm trying this without any luck. I downloaded the latest Python for Windows x64 installer (3.8.0), installed it and all I get when running your script is a flashing CMD window.

  • kaotkblisskaotkbliss Posts: 2,914
    edited November 2019

    Either open and run it in python's IDLE version or open cmd then type cd C:\path\to\pythons\exe and hit enter then type python "C:\path\to\my\app\DazDB.py"

    Both will leave the window open so you can see which module/s you need to install from the list in the previous comments, repeated here for simplicity:

    From the same directory as the python exe in cmd, run the appropriate command to install the module:

    openpyxl error: python -m pip install openpyxl

    PIL error: python -m pip install pillow

    win32api error: python -m pip install pywin32

    then 

    python "C:\Users\kaotk\AppData\Local\Programs\Python\Python38-32\Scripts\pywin32_postinstall.py" -install

    Where C:\Users\kaotk\AppData\Local\Programs\Python\Python38-32\ is the location of your python exe

     

    *edit*

    For the next update, I will look to see if there's a way to have the app automatically install missing modules

    Post edited by kaotkbliss on
  • Thank you.

    Alright, now I'm getting


    C:\Users\Doc Bean\AppData\Local\Programs\Python\Python38>python -m pip install pywin32
    Collecting pywin32
      Downloading https://files.pythonhosted.org/packages/ab/3f/a7a622573408bd63061a5e3a7de9912eda7623502b9e41572a4852a2c1d1/pywin32-225-cp38-cp38-win_amd64.whl (9.1MB)
         |████████████████████████████████| 9.1MB 3.3MB/s
    Installing collected packages: pywin32
    Successfully installed pywin32-225

    C:\Users\Doc Bean\AppData\Local\Programs\Python\Python38>python "F:\Libraries\Downloads\IDM\Pairs\DazDB\DazDB.py"
    Windows
    Traceback (most recent call last):
      File "F:\Libraries\Downloads\IDM\Pairs\DazDB\DazDB.py", line 24, in <module>
        import win32api;
    ImportError: DLL load failed while importing win32api: The specified module could not be found.

    C:\Users\Doc Bean\AppData\Local\Programs\Python\Python38>

  • kaotkblisskaotkbliss Posts: 2,914

    After installing the win32api module, you then need to do:

    python "C:\Users\Doc Bean\AppData\Local\Programs\Python\Python38\Scripts\pywin32_postinstall.py" -install

  • Hallelujah! Sure a lot of hoops to jump through laugh

    Thank you.

Sign In or Register to comment.