Skip to content

Commit

Permalink
fix user_id
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoonDorise committed Nov 1, 2024
1 parent 939fbe3 commit e510e47
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tools/vdf/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
import sys
import argparse

filepath = rf"C:\Program Files (x86)\Steam\userdata\{latest_userid}\config\shortcuts.vdf"
user_id = get_latest_userid() # Obtener el UserID más reciente

def add_shortcut_if_not_exists(filepath, appname, exe_path, startdir, icon=None, tags=None):
# Cargar el archivo VDF existente
if os.path.exists(filepath):
Expand Down Expand Up @@ -81,17 +78,17 @@ def remove_shortcut(filepath, appname=None, exe_path=None):
vdf.binary_dump(shortcuts, f)


def get_latest_userid():
def get_user_id():
userdata_path = r"C:\Program Files (x86)\Steam\userdata"

# Listar las subcarpetas en userdata
user_dirs = [os.path.join(userdata_path, d) for d in os.listdir(userdata_path) if os.path.isdir(os.path.join(userdata_path, d))]

# Encontrar la carpeta con la última fecha de modificación
latest_dir = max(user_dirs, key=os.path.getmtime)
latest_userid = os.path.basename(latest_dir)
user_id = os.path.basename(latest_dir)

return latest_userid
return user_id

def get_steam_game_id(exe_path, appname):
# Crea el ID hash de Steam
Expand Down Expand Up @@ -121,4 +118,7 @@ def set_steam_artwork(user_id, game_id, artwork_path):

# Copia la imagen personalizada al destino
shutil.copy2(artwork_path, dest_path)
print(f"Artwork añadido en: {dest_path}")
print(f"Artwork añadido en: {dest_path}")

user_id = get_user_id()
filepath = rf"C:\Program Files (x86)\Steam\userdata\{user_id}\config\shortcuts.vdf"

0 comments on commit e510e47

Please sign in to comment.