2022-09-20 17:01:09 -04:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
2022-10-28 02:02:37 -04:00
|
|
|
# We need binascii to convert the path and app name to crc32 and sys to
|
|
|
|
# get the command line arguments
|
2022-09-20 17:01:09 -04:00
|
|
|
import binascii
|
|
|
|
import sys
|
|
|
|
|
2022-10-28 02:02:37 -04:00
|
|
|
|
2022-09-20 17:01:09 -04:00
|
|
|
def get_app_id(exe, appname):
|
|
|
|
"""Get APP ID for non-steam shortcut.
|
|
|
|
|
|
|
|
get_api_id(file, str, str) -> int
|
|
|
|
"""
|
|
|
|
comboString = ''.join([exe, appname])
|
|
|
|
id_int = binascii.crc32(str.encode(comboString)) | 0x80000000
|
|
|
|
|
|
|
|
return id_int
|
|
|
|
|
2022-10-28 02:02:37 -04:00
|
|
|
|
2022-09-20 17:01:09 -04:00
|
|
|
def main():
|
|
|
|
"""Get the two arguments and send them to get_app_id"""
|
|
|
|
exe = sys.argv[1]
|
|
|
|
appname = sys.argv[2]
|
|
|
|
|
|
|
|
print(get_app_id(exe, appname))
|
|
|
|
|
2022-10-28 02:02:37 -04:00
|
|
|
|
2023-11-30 16:39:36 -05:00
|
|
|
if __name__ == "__main__":
|
2022-09-20 17:01:09 -04:00
|
|
|
# If there aren't the correct number of arguments, fail with error
|
2022-10-28 02:02:37 -04:00
|
|
|
if len(sys.argv) != 3:
|
|
|
|
sys.exit("Not enough arguments")
|
|
|
|
main()
|