示例#1
0
 def cacheLeague(self, leagueid, league_obj):
     league_dict = league_obj.__dict__
     FileIO.filewrite(
         os.path.join(
             os.path.join(addon_userdata_cached_leagues,
                          "%s.txt" % (str(leagueid)))), str(league_dict))
     return
示例#2
0
 def cacheTeam(self, teamid, team_obj):
     team_dict = team_obj.__dict__
     FileIO.filewrite(
         os.path.join(
             os.path.join(addon_userdata_cached_teams,
                          "%s.txt" % (str(teamid)))), str(team_dict))
     return
示例#3
0
def savecurrenthash(_hash):
    media_file = xbmc.getInfoLabel('Player.Filenameandpath')
    media_dict = {"file": media_file, "hash": _hash}
    if not os.path.exists(tweet_file):
        if not os.path.exists(addon_userdata):
            os.mkdir(addon_userdata)
    FileIO.filewrite(tweet_file, json.dumps(media_dict))
    return
示例#4
0
def savecurrenthash(_hash):
    media_file = xbmc.getInfoLabel('Player.Filenameandpath')
    media_dict = {"file" : media_file, "hash":_hash}
    if not os.path.exists(tweet_file):
        if not os.path.exists(addon_userdata):
            os.mkdir(addon_userdata)
    FileIO.filewrite(tweet_file,json.dumps(media_dict))
    return
示例#5
0
 def cacheLeagueTeams(self, leagueid, team_obj_list):
     team_list = []
     for team in team_obj_list:
         team_list.append(team.__dict__)
     FileIO.filewrite(
         os.path.join(
             os.path.join(addon_userdata_cached_leagueteams,
                          "%s.txt" % (str(leagueid)))), str(team_list))
     return
示例#6
0
 def getcachedLeague(self, leagueid):
     league_str = FileIO.fileread(
         os.path.join(
             os.path.join(addon_userdata_cached_leagues,
                          "%s.txt" % (str(leagueid)))))
     league = thesportsdb.league.as_league(eval(league_str))
     return league
示例#7
0
def get_twitter_history():
    twitter_history = []
    if os.path.exists(twitter_history_file):
        twitter_history = FileIO.fileread(twitter_history_file)
        twitter_history = [
            hashtag for hashtag in twitter_history.split('\n') if hashtag
        ]
    return twitter_history
示例#8
0
 def getcachedLeagueTeams(self, leagueid):
     team_list_str = FileIO.fileread(
         os.path.join(
             os.path.join(addon_userdata_cached_leagueteams,
                          "%s.txt" % (str(leagueid)))))
     teams_list = [
         thesportsdb.team.as_team(team) for team in eval(team_list_str)
     ]
     return teams_list
示例#9
0
def get_twitter_history():
    twitter_history = []
    if os.path.exists(twitter_history_file):
        twitter_history = FileIO.fileread(twitter_history_file)
        twitter_history = [hashtag for hashtag in twitter_history.split('\n') if hashtag]
    return twitter_history
示例#10
0
def add_hashtag_to_twitter_history(hashtag):
    history = get_twitter_history()
    if hashtag.lower() in history:
        history.remove(hashtag.lower())
    history.append(hashtag.lower())
    return FileIO.filewrite(twitter_history_file, "\n".join(history))
	def getcachedTeam(self,teamid):
		team = FileIO.fileread(os.path.join(os.path.join(addon_userdata_cached_teams,"%s.txt" % (str(teamid)))))
		return thesportsdb.team.as_team(eval(team))
	def cacheTeam(self,teamid,team_obj):
		team_dict = team_obj.__dict__
		FileIO.filewrite(os.path.join(os.path.join(addon_userdata_cached_teams,"%s.txt" % (str(teamid)))),str(team_dict))
		return
	def cacheLeagueTeams(self,leagueid,team_obj_list):
		team_list = []
		for team in team_obj_list:
			team_list.append(team.__dict__)
		FileIO.filewrite(os.path.join(os.path.join(addon_userdata_cached_leagueteams,"%s.txt" % (str(leagueid)))),str(team_list))
		return
	def getcachedLeague(self,leagueid):
		league_str = FileIO.fileread(os.path.join(os.path.join(addon_userdata_cached_leagues,"%s.txt" % (str(leagueid)))))
		league = thesportsdb.league.as_league(eval(league_str))
		return league
	def cacheLeague(self,leagueid,league_obj):
		league_dict = league_obj.__dict__
		FileIO.filewrite(os.path.join(os.path.join(addon_userdata_cached_leagues,"%s.txt" % (str(leagueid)))),str(league_dict))
		return
示例#16
0
def add_hashtag_to_twitter_history(hashtag):
    history = get_twitter_history()
    if hashtag.lower() in history:
        history.remove(hashtag.lower())
    history.append(hashtag.lower())
    return FileIO.filewrite(twitter_history_file,"\n".join(history))
	def getcachedLeagueTeams(self,leagueid):
		team_list_str = FileIO.fileread(os.path.join(os.path.join(addon_userdata_cached_leagueteams,"%s.txt" % (str(leagueid)))))
		teams_list = [thesportsdb.team.as_team(team) for team in eval(team_list_str)]
		return teams_list