now search games in the extra folders and skip proton and steamworks items

master
kirbylife 2019-06-23 00:52:53 -05:00
parent 3e72640178
commit f6573f2f44
1 changed files with 22 additions and 6 deletions

View File

@ -42,8 +42,6 @@ def set_item(name, appid=None):
def main(args): def main(args):
games = []
### Header ### ### Header ###
print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>") print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
print("<openbox_pipe_menu>") print("<openbox_pipe_menu>")
@ -52,14 +50,30 @@ def main(args):
if getstatusoutput("cd " + STEAM_URL)[0] == 1: if getstatusoutput("cd " + STEAM_URL)[0] == 1:
set_item("Steam not installed") set_item("Steam not installed")
else: else:
games = getoutput("ls " + STEAM_URL + " | grep acf").split("\n") folders = [STEAM_URL]
try:
# Search if you have games in other folders
with open(STEAM_URL + "/libraryfolders.vdf") as extras:
for line in extras:
if "/" in line:
folder = line.split("\t")[-1].strip()[1:-1]
folder = folder + "/steamapps"
folders.append(folder)
except Exception:
pass
games = []
for folder in folders:
library = getoutput("ls " + folder + " | grep acf").split("\n")
games.extend([folder + "/" + game for game in library])
if not games: if not games:
set_item("0 games installed") set_item("0 games installed")
else: else:
for c in games: for game in games:
appid = "" appid = ""
name = "" name = ""
manifest = open(STEAM_URL + "/" + c, "r") manifest = open(game, "r")
data = manifest.read().split("\n") data = manifest.read().split("\n")
manifest.close() manifest.close()
for f in data: for f in data:
@ -67,7 +81,9 @@ def main(args):
appid = f.split('"')[3] appid = f.split('"')[3]
elif '"name"' in f: elif '"name"' in f:
name = f.split('"')[3] name = f.split('"')[3]
set_item(name, appid) if "Proton" in name or "Steamworks" in name:
continue
set_item(name, appid)
### Footer ### ### Footer ###
print("</openbox_pipe_menu>") print("</openbox_pipe_menu>")