This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
steamutils.py
59 lines (44 loc) · 1.76 KB
/
steamutils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#coding=utf-8
__author__ = 'ron975'
import os
import steamapi
import steamshortcut.steam_shortcut_manager as shortcutmanager
import steamshortcut.steam_user_manager as usermanager
def insert_shortcut(manager, name, exe, icon=""):
manager.add_shortcut(name, "\""+exe+"\"", "\""+os.path.dirname(exe)+"\"", icon=icon)
manager.save()
def shortcut_exists(manager, name):
for shortcut in manager.shortcuts:
if shortcut.appname == name:
return True
return False
def associate_ids_with_users():
steamusers = []
for steamid in usermanager.user_ids_on_this_machine():
try:
steamusers.append({'steamid32': steamid, 'customurl': usermanager.name_from_communityid32(steamid)})
except TypeError:
steamusers.append({'steamid32': steamid, 'customurl': ''})
return steamusers
def get_customurls_on_machine():
steamusers = []
for steamid in usermanager.user_ids_on_this_machine():
try:
steamusers.append(usermanager.name_from_communityid32(steamid))
except TypeError:
steamusers.append("ID64:{0}".format(usermanager.communityid64_from_communityid32(steamid)))
return steamusers
def choose_userdata_folder():
for index, user in enumerate(associate_ids_with_users()):
print index+1, user['steamid32'], user['customurl']
index = int(raw_input())
return shortcutmanager.SteamShortcutManager(
usermanager.shortcuts_file_for_user_id(associate_ids_with_users()[index-1]['steamid32'])
)
def check_steam_version(steamid, name):
steamapi.core.APIConnection('26CD88279076DCE178B6D47E167850AB')
user = steamapi.user.SteamUser(steamid)
for game in user.owned_games:
if game.name == name:
return True
return False