Professional Documents
Culture Documents
Xbox Live Gamer Card
Xbox Live Gamer Card
# Name: xbox.gamertag.py()
# Created: 06.25.2011
# Updated: 24.01.2017
#-------------------------------------------------------------------------------
#!/usr/bin/env python
import xbmc
BASE_DIR_CACHE =
xbmc.translatePath("special://profile/script_data/script.xboxlive.gamercard/")
'''
XBLGamercard.Gamertag
XBLGamercard.Picture
XBLGamercard.Avatar
XBLGamercard.Score
XBLGamercard.Location
XBLGamercard.Motto
XBLGamercard.Bio
XBLGamercard.RecentlyPlayed.Title.#
XBLGamercard.RecentlyPlayed.Icon.#
XBLGamercard.RecentlyPlayed.LastPlayed.#
XBLGamercard.RecentlyPlayed.EarnedGamerscore.#
XBLGamercard.RecentlyPlayed.AvailableGamerscore.#
XBLGamercard.RecentlyPlayed.EarnedAchievements.#
XBLGamercard.RecentlyPlayed.AvailableAchievements.#
XBLGamercard.RecentlyPlayed.PercentageComplete.#
XBLGamercard.LastUpdated
'''
def xebi(td):
xbmc.executebuiltin( td )
def log(msg):
#pass
_s = "download--> "
os.makedirs( destination )
try:
log( _s + "success!" )
else:
return 1
except:
return 0
def get_gamercard():
_s = "get_gamercard--> "
try:
response = urllib2.urlopen(request).read()
log(response)
# quick clean up
response = ""
request = ""
xebi( "Skin.SetString(XBLGamercard.Score," +
gamercard.find("div",{"id" : "Gamerscore"}).text + ")" )
xebi( "Skin.SetString(XBLGamercard.Motto," +
gamercard.find("div",{"id" : "Motto"}).text + ")" )
xebi( "Skin.SetString(XBLGamercard.Name," +
gamercard.find("div",{"id" : "Name"}).text + ")" )
xebi( "Skin.SetString(XBLGamercard.Bio," +
gamercard.find("div",{"id" : "Bio"}).text + ")" )
count = 0
# move thru each game item (li) and get appropriate info
# begin count
count += 1
# get game's title id to be used as the name of the image after download
posl = posx + 10
xebi( "Skin.SetString(XBLGamercard.RecentlyPlayed.Title."
+ str(count) + "," + game.find("span",{"class":"Title"}).text.encode("utf-8")
+ ")" )
xebi( "Skin.SetString(XBLGamercard.RecentlyPlayed.LastPlayed."
+ str(count) + "," + game.find("span",{"class":"LastPlayed"}).text + ")" )
xebi( "Skin.SetString(XBLGamercard.RecentlyPlayed.EarnedGamerscore."
+ str(count) + "," + game.find("span",{"class":"EarnedGamerscore"}).text + ")" )
xebi(
"Skin.SetString(XBLGamercard.RecentlyPlayed.AvailableGamerscore." + str(count) + "," +
game.find("span",{"class":"AvailableGamerscore"}).text + ")" )
xebi( "Skin.SetString(XBLGamercard.RecentlyPlayed.EarnedAchievements."
+ str(count) + "," + game.find("span",{"class":"EarnedAchievements"}).text + ")" )
xebi(
"Skin.SetString(XBLGamercard.RecentlyPlayed.AvailableAchievements." + str(count) + "," +
game.find("span",{"class":"AvailableAchievements"}).text + ")" )
xebi( "Skin.SetString(XBLGamercard.RecentlyPlayed.PercentageComplete."
+ str(count) + "," + game.find("span",{"class":"PercentageComplete"}).text + ")" )
xebi( "Skin.SetString(XBLGamercard.RecentlyPlayed.Icon."
+ str(count) + "," + os.path.join( BASE_DIR_CACHE_TILES, tile_name ) + ")"
)
now = datetime.datetime.now()
return True
except:
print_exc()
return False
global mode
mode = -1
def main():
log( "==================================================" )
if get_gamercard():
xebi( "XBMC.Notification(XBox Live: Gamertag," + __XbmcCurrentUser__ + "
Update Complete!)" )
else:
if __name__ == '__main__':
main()