def main(paramstring): params = dict(parse_qsl(paramstring)) # First of all I need to Verify the settings before put it into the class _settings = xbmcaddon.Addon() dialog = xbmcgui.DialogProgress() dialog.create("Xteam...", "Loading your Games") addonID = _settings.getAddonInfo('id') addonPath = _settings.getAddonInfo('path') userdata = xbmc.translatePath('special://profile/addon_data/' + addonID) profilesFolder = os.path.join(userdata, "profiles") #Parsing Folders if not os.path.isdir(userdata): os.mkdir(userdata) if not os.path.isdir(profilesFolder): os.mkdir(profilesFolder) WINE = _settings.getSetting("steam_wine") steamID = _settings.getSetting("steam_id") if os.path.isdir(WINE) is not True: error_wine = xbmcgui.Dialog() error_wine.ok("ERROR!", "WINE PATH IS NOT A VALID PATH!") if os.path.isdir(os.getenv('HOME') + "/.steam/steam/") is not True: error_steam = xbmcgui.Dialog() error_steam.ok("ERROR!", "DOES NOT FIND THE STEAM PATH", "CHECK IF STEAM IS INSTALLED!") steam = SteamAPI.SteamAPI(WINE, steamID, userdata) dialog.close() check_params(steam, paramstring)
def get_game_list(steam_key, user_id): steamConn = SteamAPI.SteamAPI(steam_key) #gather user's list of owned games into list of (id, playtime) games = steamConn.getOwnedGames(user_id)['response']['games'] gameList = [] for game in games: gameList.append((game['appid'], game['playtime_forever'])) gameListSorted = sorted(gameList, key=lambda x: x[1]) return gameListSorted
def handle(self, *args, **options): steamConn = SteamAPI.SteamAPI(steam_key) #get list of all games and organize into map of id -> name updates = 0 new_games = 0 current_games = GameInfo.objects.count() appJson = steamConn.getAppList() apps = appJson['applist']['apps'] appDetails = {} with progressbar.ProgressBar(max_value=len(apps), redirect_stdout=True) as progress: for idx, app in enumerate(apps): appid = app['appid'] name = app['name'] app = GameInfo.objects.filter(game_id=int(appid)) if app.exists(): # self.stdout.write(self.style.SUCCESS("Already have %s" % name)) app = app.first() if app.game_name != name: self.stdout.write( self.style.SUCCESS("%s, %s" % (app.game_name, name))) updates += 1 app.game_name = name app.save() else: #self.stdout.write(self.style.SUCCESS("New game found: %s" % name)) new_games += 1 app = GameInfo(game_name=name, game_id=appid, fetch_date=timezone.now()) try: app.save() except Exception as e: self.stdout.write(self.style.SUCCESS(name)) self.stdout.write(self.style.ERROR(e)) progress.update(idx) self.stdout.write( self.style.SUCCESS( "Out of %s games, %s were updated. %s new games found." % (current_games, updates, new_games)))
def __init__(self): filename = "PySteam.glade" self.builder = gtk.Builder() self.builder.add_from_file(filename) self.builder.connect_signals(self) self.window = self.builder.get_object("windowMain") self.window.show() self.friendsView = self.builder.get_object("friendsView") self.AddListColumn("Name", 0) self.AddListColumn("steamid", 1) self.AddListColumn("Status", 2) self.friendsList = gtk.ListStore(str, str, str) self.friendsList.set_default_sort_func(None) self.friendsView.set_model(self.friendsList) self.login = self.builder.get_object("loginDlg") self.login.show() self.steam = SteamAPI()
import sys import requests import SteamAPI import random import os from secret_steam_key import * random.seed(os.urandom(4)) steamConn = SteamAPI.SteamAPI(steam_key) steamID = sys.argv[1] try: int(steamID) except: steamID = steamConn.getPlayerID(steamID) #get username player = steamConn.getPlayerSummary(steamID) print("Username: ", player.name) #gather user's list of owned games into list of (id, playtime) games = steamConn.getOwnedGames(steamID)['response']['games'] gameList = [] for game in games: gameList.append((game['appid'], game['playtime_forever'])) gameListSorted = sorted(gameList, key=lambda x: x[1]) #get list of all games and organize into map of id -> name appJson = steamConn.getAppList()
from SteamAPI import * steam = SteamAPI() username = raw_input("Username: "******"Password: "******"") if status == LoginStatus.SteamGuard: steamguard = raw_input("SteamGuard Code: ") status = steam.Authenticate(str(username), str(password), str(steamguard)) if status == LoginStatus.LoginSuccessful: poll = steam.Poll() friends = steam.GetFriends() users = steam.GetUserInfo(friends) count = 0 for user in users: print str(count) + ": Nick: " + user.nickname + " Steamid: " + str(user.steamid) count = count + 1 msgid = raw_input("Who do you want to msg?: ") msg = raw_input("Message: ") steam.SendMessage(users[int(msgid)], msg) else: print "Failed to login!"
def get_user_name(steam_key, user_id): steamConn = SteamAPI.SteamAPI(steam_key) #get username player = steamConn.getPlayerSummary(user_id) return player.name
def get_user_id(steam_key, user_id): steamConn = SteamAPI.SteamAPI(steam_key) #get username playerID = steamConn.getPlayerID(user_id) return playerID