Adds some fixes found during in-wild testing.
This commit is contained in:
@@ -311,7 +311,10 @@ def writeShortcuts(apps, shortcutFile):
|
|||||||
i = 1
|
i = 1
|
||||||
for app in apps:
|
for app in apps:
|
||||||
data.append(0x00)
|
data.append(0x00)
|
||||||
data.append(app.appIndx or i)
|
if app.appIndx > 0 and app.appIndx < 256:
|
||||||
|
data.append(app.appIndx)
|
||||||
|
else:
|
||||||
|
data.append(i)
|
||||||
i += 1
|
i += 1
|
||||||
data += bytearray([0x00, 0x02])
|
data += bytearray([0x00, 0x02])
|
||||||
data += bytearray("appid", encoding)
|
data += bytearray("appid", encoding)
|
||||||
@@ -595,47 +598,63 @@ def copyContents(ids):
|
|||||||
data = client.get_product_info(apps=fromCodes)
|
data = client.get_product_info(apps=fromCodes)
|
||||||
i = 0
|
i = 0
|
||||||
for i in range(len(ids)):
|
for i in range(len(ids)):
|
||||||
|
if not ids[i][0] in data["apps"]:
|
||||||
|
print("Could not find app ID %s for %s" % (ids[i][0], ids[i][1]), file=sys.stderr)
|
||||||
|
continue
|
||||||
# Generate the positioning data for logos and such
|
# Generate the positioning data for logos and such
|
||||||
logo = data["apps"][ids[i][0]]["common"]["library_assets"]["logo_position"]
|
assets = data["apps"][ids[i][0]]
|
||||||
logo2 = {
|
if not "common" in assets:
|
||||||
"nVersion": 1,
|
print("Could not find common data for %s from %s" % (ids[i], assets), file=sys.stderr)
|
||||||
"logoPosition": {
|
continue
|
||||||
"pinnedPosition": logo["pinned_position"],
|
if not "library_assets" in assets["common"]:
|
||||||
"nWidthPct": logo["width_pct"],
|
print("Could not find common data for %s from %s" % (ids[i], assets), file=sys.stderr)
|
||||||
"nHeightPct": logo["height_pct"]
|
continue
|
||||||
|
if "logo_position" in assets["common"]["library_assets"]:
|
||||||
|
logo = assets["common"]["library_assets"]["logo_position"]
|
||||||
|
logo2 = {
|
||||||
|
"nVersion": 1,
|
||||||
|
"logoPosition": {
|
||||||
|
"pinnedPosition": logo["pinned_position"],
|
||||||
|
"nWidthPct": logo["width_pct"],
|
||||||
|
"nHeightPct": logo["height_pct"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
toCode = ids[i][1]
|
||||||
toCode = ids[i][1]
|
if isinstance(toCode, App):
|
||||||
if isinstance(toCode, App):
|
toCode = toCode.appId
|
||||||
toCode = toCode.appId
|
# Stores the logo positioning to file.
|
||||||
# Stores the logo positioning to file.
|
copyContent(Path("config", "grid", str(toCode) + ".json"), json.dumps(logo2), byte=False)
|
||||||
copyContent(Path("config", "grid", str(toCode) + ".json"), json.dumps(logo2), byte=False)
|
|
||||||
|
|
||||||
# Generate the data for other stuff.
|
# Generate the data for other stuff.
|
||||||
logo2 = [[
|
logo2 = [[
|
||||||
"achievements", {
|
"achievements", {
|
||||||
"version":2,
|
"version":2,
|
||||||
"data": {
|
"data": {
|
||||||
"vecHighlight": [],
|
"vecHighlight": [],
|
||||||
"vecUnachieved": [],
|
"vecUnachieved": [],
|
||||||
"vecAchievedHidden": [],
|
"vecAchievedHidden": [],
|
||||||
"nTotal": 0,
|
"nTotal": 0,
|
||||||
"nAchieved": 0
|
"nAchieved": 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
], [
|
||||||
], [
|
"customimage", {
|
||||||
"customimage", {
|
"version": 1,
|
||||||
"version": 1,
|
"data": logo2["logoPosition"]
|
||||||
"data": logo2["logoPosition"]
|
}
|
||||||
}
|
]
|
||||||
]
|
]
|
||||||
]
|
copyContent(Path("config", "librarycache", str(toCode) + ".json"), json.dumps(logo2), byte=False)
|
||||||
copyContent(Path("config", "librarycache", str(toCode) + ".json"), json.dumps(logo2), byte=False)
|
else:
|
||||||
|
print("No logo for %s %s" % (ids[i], json.dumps(assets, indent=4)), file=sys.stderr)
|
||||||
|
|
||||||
# Write the actual shortcut data.
|
# Write the actual shortcut data.
|
||||||
for user in userdata.iterdir():
|
for user in userdata.iterdir():
|
||||||
shortcutPath = Path(user, "config", "shortcuts.vdf")
|
shortcutPath = Path(user, "config", "shortcuts.vdf")
|
||||||
shortcutData = parseShortcuts(shortcutPath)
|
if shortcutPath.is_file():
|
||||||
|
shortcutData = parseShortcuts(shortcutPath)
|
||||||
|
else:
|
||||||
|
shortcutData = []
|
||||||
toWrite = []
|
toWrite = []
|
||||||
for app in apps:
|
for app in apps:
|
||||||
toWrite.append(apps[app])
|
toWrite.append(apps[app])
|
||||||
@@ -643,7 +662,7 @@ def copyContents(ids):
|
|||||||
# Add existing apps back to the queue
|
# Add existing apps back to the queue
|
||||||
if app.appId in apps:
|
if app.appId in apps:
|
||||||
eApp = apps[app.appId]
|
eApp = apps[app.appId]
|
||||||
eApp.appIndx = eApp.appIndx or app.appIndx
|
eApp.appIndx = app.appIndx or eApp.appIndx
|
||||||
eApp.name = eApp.name.strip() or app.name.strip()
|
eApp.name = eApp.name.strip() or app.name.strip()
|
||||||
eApp.executable = eApp.executable.strip() or app.executable.strip()
|
eApp.executable = eApp.executable.strip() or app.executable.strip()
|
||||||
eApp.start = eApp.start.strip() or app.start.strip()
|
eApp.start = eApp.start.strip() or app.start.strip()
|
||||||
@@ -710,6 +729,8 @@ if __name__ == "__main__":
|
|||||||
ids = []
|
ids = []
|
||||||
ops = []
|
ops = []
|
||||||
opArgs = {}
|
opArgs = {}
|
||||||
|
#for term in sys.argv[1:]:
|
||||||
|
# print(term)
|
||||||
# Gather the parameters
|
# Gather the parameters
|
||||||
for term in sys.argv[1:]:
|
for term in sys.argv[1:]:
|
||||||
if not term.startswith('-'):
|
if not term.startswith('-'):
|
||||||
@@ -732,7 +753,7 @@ if __name__ == "__main__":
|
|||||||
if '=' in term:
|
if '=' in term:
|
||||||
ops.append(term[2:term.index('=')])
|
ops.append(term[2:term.index('=')])
|
||||||
opArgs[ops[-1]] = term[term.index('=') + 1:]
|
opArgs[ops[-1]] = term[term.index('=') + 1:]
|
||||||
if opArgs[ops[-1]][0] == '"' and opArgs[ops[-1]][-1] == '"' or opArgs[ops[-1]][0] == '\'' and opArgs[ops[-1]][-1] == '\'':
|
if len(opArgs[ops[-1]]) > 0 and (opArgs[ops[-1]][0] == '"' and opArgs[ops[-1]][-1] == '"' or opArgs[ops[-1]][0] == '\'' and opArgs[ops[-1]][-1] == '\''):
|
||||||
# Remove quotation marks used to demark the argument
|
# Remove quotation marks used to demark the argument
|
||||||
opArgs[ops[-1]] = opArgs[ops[-1]][1:-1]
|
opArgs[ops[-1]] = opArgs[ops[-1]][1:-1]
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user