ViviAshe / XIVSnapper

Plugin to save current appearance and applied mods of a character
6 stars 0 forks source link

Not working #5

Open Linsteado opened 2 months ago

Linsteado commented 2 months ago

Maybe I just don't know what I'm doing, but I do exactly as the readme says, I copy glamourer design, I set up a folder in the settings, I hit snapshot on someone (all types of combinations, individual sync'd, shell synced, friend, not friend, same world, different world, same datacenter, different datacenter, etc) and while it creates a folder with their name it doesn't actually do anything.

aftff commented 2 months ago

Sounds like you aren't manually adding the glamourer design to your snapshot.json as required.

I used a bot to make a quick and dirty python script to replace the glamourerstring for you which'll make things a lot easier

It's fairly easy to use, all you need is Python and some basic understanding of command line, if you are running in to issues just copy the code and ask ChatGPT/Perplexity/Gemini to explain to you on how to use it.

But basically

  1. Copy code
  2. Make a python script (rename a .txt file to something like stringfix.py and paste the code in that)
  3. Type CMD in your file explorer address bar.
  4. Type in python stringfix.py (change stringfix.py to what ever you named your python script)
  5. It'll pop up a folder selector, select your MAIN snapper folder
  6. Select the folder with the snapshot you've created from the options (just type the number in front of it)
  7. Paste the glamourer design in there. (usually with right click in cmd)
  8. Load the snap in-game

It'll slightly change the formatting in the snapshot file but it should still work and will just look a bit more readable. Happy to help if you or anyone else runs in to any issues

import os
import json
from tkinter import Tk, filedialog

# Hide the root window
Tk().withdraw()

# Select the main folder containing subfolders
main_folder = filedialog.askdirectory(title="Select the main folder")

if not main_folder:
    print("No folder selected. Exiting...")
    exit()

# List subfolders in the main folder
subfolders = [f.path for f in os.scandir(main_folder) if f.is_dir()]

# Let the user select a subfolder
if not subfolders:
    print("No subfolders found.")
    exit()

print("Subfolders:")
for idx, folder in enumerate(subfolders):
    print(f"{idx + 1}: {folder}")

try:
    selected_idx = int(input("\nEnter the number of the subfolder to select: ")) - 1
    selected_folder = subfolders[selected_idx]
except (ValueError, IndexError):
    print("Invalid selection. Exiting...")
    exit()

# Check if snapshot.json exists in the selected folder
json_file_path = os.path.join(selected_folder, 'snapshot.json')

if not os.path.isfile(json_file_path):
    print(f"No snapshot.json found in {selected_folder}. Exiting...")
    exit()

# Ask the user for the string to replace 'GlamourerString'
new_GlamourerString = input("Enter the new string to replace 'GlamourerString': ")

# Load and modify the JSON
with open(json_file_path, 'r', encoding='utf-8') as json_file:
    data = json.load(json_file)

# Check if 'GlamourerString' exists in the JSON
if 'GlamourerString' in data:
    original_value = data['GlamourerString']
    data['GlamourerString'] = new_GlamourerString

    # Save the modified JSON back to the file
    with open(json_file_path, 'w', encoding='utf-8') as json_file:
        json.dump(data, json_file, indent=4, ensure_ascii=False)

    print(f"Replaced 'GlamourerString': '{original_value}' with '{new_GlamourerString}' in {json_file_path}")
else:
    print("'GlamourerString' not found in the JSON.")

I am not the best programmer but it works for me so I hope it does for you as well

PS: If you want to just manually change it go in to the folder, open snapshot.json in your preferred text editor, then edit the GlamourerString":"..." where the ... is the existing string with the one you copied from glamourer, it's a bit more annoying but works all the same.