From d3e0a9e4b09c55f2dd52548ca150eea4090377c3 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Thu, 25 Mar 2021 15:52:41 +0530 Subject: [PATCH 01/15] Match event from chain with event from feed, #66 --- feed/feed.py | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/feed/feed.py b/feed/feed.py index 778fac6..e79aff3 100644 --- a/feed/feed.py +++ b/feed/feed.py @@ -5,7 +5,7 @@ from datetime import datetime, timezone import json # import pandas as pd -from cp_local import Cp, rpc, config +from cp_local import Cp, rpc, config, normalize, substitution import _thread import time @@ -87,11 +87,11 @@ def Call(self, event, incident): print("Postponed Event") elif ( - event["strStatus"] == "FT") or ( - event["strStatus"] == "Match Finished") or ( - event["strStatus"] == "AP") or ( - event["strStatus"] == "AOT") or ( - (now - startTime).days > 1): + event["strStatus"] == "FT") or ( + event["strStatus"] == "Match Finished") or ( + event["strStatus"] == "AP") or ( + event["strStatus"] == "AOT") or ( + (now - startTime).days > 1): incident["call"] = INCIDENT_CALLS[3] incident["arguments"] = dict() incident["arguments"]["home_score"] = event["intHomeScore"] @@ -227,6 +227,35 @@ def Timed(self): self.flagWhileForThread = "run" _thread.start_new_thread(self.WhileForThread, ()) + def EventsToDf(self, events): + pass + + def MatchingEvent(self, eventsFromFeed, eventFromChain): + for eventFromFeed in eventsFromFeed: + toCp = self.ToCp(eventFromFeed) + toCp = normalize(toCp) + if toCp["id"]["start_time"][:-1] == eventFromChain["start_time"]: + eventScheme = self.cp.EventScheme(toCp["id"]["sport"], toCp[ + "id"]["event_group_name"]) + home = toCp["id"]["home"] + away = toCp["id"]["away"] + homeAway = substitution([home, away], eventScheme) + if homeAway == eventFromChain["name"][0][1]: + return toCp + return None + + def MatchingEvents(self, leagueId): + eventsFromFeed = self.Past15(4328) + eventsFromChain = self.cp.EventsAllSorted() + matchingEvents = [] + for k in range(len(eventsFromChain)): + eventFromChain = eventsFromChain.iloc[k] + # for eventFromChain in eventsFromChain: + toCp = self.MatchingEvent(eventsFromFeed, eventFromChain) + if not isinstance(toCp, type(None)): + matchingEvents.append([eventFromChain, toCp]) + return matchingEvents + class Updater: @@ -271,6 +300,12 @@ def UpdateInThread(self): _thread.start_new_thread(self.WhileForUpdate, ()) +class Compare: + + def __init__(self): + pass + + class FeedDetails: def __init__(self): From 9757fba9a70ad3dffc43f9e1667f4057d91d4f05 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Fri, 26 Mar 2021 03:33:28 +0530 Subject: [PATCH 02/15] Matched events time sorted for API --- feed/cp_local.py | 26 ++++++++++++++++++-------- feed/feed.py | 29 ++++++++++++++++++----------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/feed/cp_local.py b/feed/cp_local.py index 53c9df0..d908110 100644 --- a/feed/cp_local.py +++ b/feed/cp_local.py @@ -46,6 +46,8 @@ "dynamic_bmgs", ] +STATUSES = ["upcoming", "in_progress", "finished"] + # normalizer = IncidentsNormalizer(chain="elizabeth") normalizer = IncidentsNormalizer(chain=chainName) normalize = normalizer.normalize @@ -101,7 +103,7 @@ def GetEventGroupsList(self, sport): def GetParticipants(self, sport, participantKey): participants = self.bookiesports[sport]["participants"][ - participantKey]["participants"] + participantKey]["participants"] particpantIdentifiers = [] participantDisplays = [] for participant in participants: @@ -121,9 +123,9 @@ def GetForCreate(self, sport=None, eventGroup=None): # self._eventGroupIdentifier = self.bookiesports[sport][ # "eventgroups"][eventGroup]["identifier"] self._participantKey = self.bookiesports[sport]["eventgroups"][ - eventGroup]["participants"] + eventGroup]["participants"] self._participants, participantDisplays = self.GetParticipants( - sport, self._participantKey) + sport, self._participantKey) return self._participants def CreateForApi(self, sport, eventGroup, home, away, startTime): @@ -133,7 +135,7 @@ def CreateForApi(self, sport, eventGroup, home, away, startTime): incident["id"] = dict() incident["id"]["sport"] = sport eventGroupIdentifier = self.bookiesports[sport][ - "eventgroups"][eventGroup]["identifier"] + "eventgroups"][eventGroup]["identifier"] incident["id"]["event_group_name"] = eventGroupIdentifier # incident["id"]["event_group_name"] = self._eventGroup startTime = date_to_string(startTime) @@ -158,7 +160,7 @@ def CreateForApiWithPotato( incident["id"] = dict() incident["id"]["sport"] = sport eventGroupIdentifier = self.bookiesports[sport][ - "eventgroups"][eventGroup]["identifier"] + "eventgroups"][eventGroup]["identifier"] incident["id"]["event_group_name"] = eventGroupIdentifier # incident["id"]["event_group_name"] = self._eventGroup startTime = date_to_string(startTime) @@ -249,14 +251,22 @@ def EventsAllSortedForApi(self): eventsAllList = [] for k in range(len(eventsAll)): eventsAllList.append(dict(eventsAll.iloc[k])) + eventsAllList = self.EventsAllWithEventGroupName(eventsAllList) return eventsAllList def EventsAllWithEventGroupName(self, eventsAll): - # resEvents = [] for event in eventsAll: event_group_id = event["event_group_id"] - event["event_group_name"] = rpc.get_object( - event_group_id)["name"][1][1] + # event["event_group_name"] = rpc.get_object( + # event_group_id)["name"][1][1] + eventGroup = rpc.get_object(event_group_id) + + event["event_group_name"] = dict(eventGroup["name"])["identifier"] + # event["event_group_name"] = eventGroup["name"][1][1] + sport = rpc.get_object(eventGroup["sport_id"]) + sport = dict(sport["name"])["identifier"] + event["sport"] = sport + # sport = normalizer._get_sport_identifier(sport, True) return eventsAll def Event2Update(self): diff --git a/feed/feed.py b/feed/feed.py index e79aff3..40fcdb9 100644 --- a/feed/feed.py +++ b/feed/feed.py @@ -87,11 +87,11 @@ def Call(self, event, incident): print("Postponed Event") elif ( - event["strStatus"] == "FT") or ( - event["strStatus"] == "Match Finished") or ( - event["strStatus"] == "AP") or ( - event["strStatus"] == "AOT") or ( - (now - startTime).days > 1): + event["strStatus"] == "FT") or ( + event["strStatus"] == "Match Finished") or ( + event["strStatus"] == "AP") or ( + event["strStatus"] == "AOT") or ( + (now - startTime).days > 1): incident["call"] = INCIDENT_CALLS[3] incident["arguments"] = dict() incident["arguments"]["home_score"] = event["intHomeScore"] @@ -244,16 +244,23 @@ def MatchingEvent(self, eventsFromFeed, eventFromChain): return toCp return None - def MatchingEvents(self, leagueId): - eventsFromFeed = self.Past15(4328) - eventsFromChain = self.cp.EventsAllSorted() + def MatchingEvents(self, leagueIds): + eventsFromFeed = [] + for leagueId in leagueIds: + # print(leagueId) + eventsFromFeed = eventsFromFeed + self.Past15(leagueId) + eventsFromChain = self.cp.EventsAllSortedForApi() matchingEvents = [] for k in range(len(eventsFromChain)): - eventFromChain = eventsFromChain.iloc[k] + # eventFromChain = eventsFromChain.iloc[k] + eventFromChain = eventsFromChain[k] # for eventFromChain in eventsFromChain: toCp = self.MatchingEvent(eventsFromFeed, eventFromChain) - if not isinstance(toCp, type(None)): - matchingEvents.append([eventFromChain, toCp]) + # if not isinstance(toCp, type(None)): + matchingEvent = dict() + matchingEvent["eventFromChain"] = eventFromChain + matchingEvent["eventFromFeed"] = toCp + matchingEvents.append(matchingEvent) return matchingEvents From 923abfef292d45fbac554fd1faf3ed4fc4762e29 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Tue, 30 Mar 2021 21:58:42 +0530 Subject: [PATCH 03/15] #78, Update page with feed support --- couchpotato/cp_local.py | 758 +++++++++++++++++++++++++- couchpotato/game/views.py | 9 + couchpotato/home/templates/index.html | 2 +- couchpotato/home/urls.py | 1 + couchpotato/home/views.py | 29 +- feed/feed.py | 10 +- 6 files changed, 801 insertions(+), 8 deletions(-) mode change 120000 => 100644 couchpotato/cp_local.py diff --git a/couchpotato/cp_local.py b/couchpotato/cp_local.py deleted file mode 120000 index e848dd4..0000000 --- a/couchpotato/cp_local.py +++ /dev/null @@ -1 +0,0 @@ -../feed/cp_local.py \ No newline at end of file diff --git a/couchpotato/cp_local.py b/couchpotato/cp_local.py new file mode 100644 index 0000000..d908110 --- /dev/null +++ b/couchpotato/cp_local.py @@ -0,0 +1,757 @@ +import _thread +import time +import numpy as np +import pandas as pd +from bos_mint.node import Node +from bookiesports.normalize import IncidentsNormalizer +from bookiesports import BookieSports +from bos_incidents.format import string_to_incident, incident_to_string +from bos_incidents.datestring import date_to_string, string_to_date +from datetime import datetime, timezone +import requests +import yaml +import logging + + +with open("config-bos-mint.yaml", "r") as f: + config = yaml.safe_load(f) +chainName = config["connection"]["use"] +bosApis = config["bosApis"] +potatoNames = config["potatoNames"] + + +# Create and configure logger +# logging.basicConfig(filename="za.log", +# format='%(asctime)s %(message)s', +# filemode='a') +# Creating an object +logger = logging.getLogger() + +# Setting the threshold of logger to DEBUG +logger.setLevel(logging.INFO) + +node = Node() +# node.unlock("peerplays**") +# node.unlock(config["password"]) +ppy = node.get_node() +rpc = ppy.rpc + + +INCIDENT_CALLS = [ + "create", + "in_progress", + "finish", + "result", + "canceled", + "dynamic_bmgs", +] + +STATUSES = ["upcoming", "in_progress", "finished"] + +# normalizer = IncidentsNormalizer(chain="elizabeth") +normalizer = IncidentsNormalizer(chain=chainName) +normalize = normalizer.normalize + + +def substitution(teams, scheme): + class Teams: + home = " ".join([x for x in teams[0].split(" ")]) + away = " ".join([x for x in teams[1].split(" ")]) + + ret = dict() + for lang, name in scheme.items(): + ret[lang] = name.format(teams=Teams) + ret = ret["en"] + return ret + + +class Cp(): + + def __init__(self): + self.delayBetweenBosPushes = 1 # in seconds + self.bookiesports = BookieSports(chainName) + pass + + def GetKey(self, keys): + keys = list(keys) + k = 0 + for key in keys: + print(k, key) + k = k + 1 + index = input("Enter index of key: ") + index = int(index) + return keys[index] + + def GetKeyParticipant(self, keys, participantDisplays): + keys = list(keys) + k = 0 + for key in keys: + # print(k, participantDisplays[k]) + print(k, key) + k = k + 1 + index = input("Enter index of key: ") + index = int(index) + return keys[index] + + def GetSportsList(self): + return list(self.bookiesports.keys()) + + def GetEventGroupsList(self, sport): + eventGroupsList = self.bookiesports[sport]["eventgroups"].keys() + eventGroupsList = list(eventGroupsList) + return eventGroupsList + + def GetParticipants(self, sport, participantKey): + participants = self.bookiesports[sport]["participants"][ + participantKey]["participants"] + particpantIdentifiers = [] + participantDisplays = [] + for participant in participants: + # particpantIdentifiers.append(participant["aliases"][0]) + participantDisplays.append(participant.values()) + particpantIdentifiers.append(participant["identifier"]) + # particpantIdentifiers.append(participant["name"]["en"]) + return particpantIdentifiers, participantDisplays + + def GetForCreate(self, sport=None, eventGroup=None): + if isinstance(sport, type(None)): + self._sportsList = self.GetSportsList() + return self._sportsList + if isinstance(eventGroup, type(None)): + self._eventGroupsList = self.GetEventGroupsList(sport) + return self._eventGroupsList +# self._eventGroupIdentifier = self.bookiesports[sport][ +# "eventgroups"][eventGroup]["identifier"] + self._participantKey = self.bookiesports[sport]["eventgroups"][ + eventGroup]["participants"] + self._participants, participantDisplays = self.GetParticipants( + sport, self._participantKey) + return self._participants + + def CreateForApi(self, sport, eventGroup, home, away, startTime): + incident = dict() + incident["call"] = INCIDENT_CALLS[0] + + incident["id"] = dict() + incident["id"]["sport"] = sport + eventGroupIdentifier = self.bookiesports[sport][ + "eventgroups"][eventGroup]["identifier"] + incident["id"]["event_group_name"] = eventGroupIdentifier + # incident["id"]["event_group_name"] = self._eventGroup + startTime = date_to_string(startTime) + incident["id"]["start_time"] = startTime + incident["arguments"] = {"whistle_start_time": startTime} + incident["id"]["home"] = home + incident["id"]["away"] = away + incident["timestamp"] = date_to_string(datetime.now(tz=timezone.utc)) + incident["arguments"]["season"] = "" + + rs = [] + for potatoName in potatoNames: + r = self.Push2bos(incident, potatoName) + rs.append(r) + return incident, rs + + def CreateForApiWithPotato( + self, sport, eventGroup, home, away, startTime, potato): + incident = dict() + incident["call"] = INCIDENT_CALLS[0] + + incident["id"] = dict() + incident["id"]["sport"] = sport + eventGroupIdentifier = self.bookiesports[sport][ + "eventgroups"][eventGroup]["identifier"] + incident["id"]["event_group_name"] = eventGroupIdentifier + # incident["id"]["event_group_name"] = self._eventGroup + startTime = date_to_string(startTime) + incident["id"]["start_time"] = startTime + incident["arguments"] = {"whistle_start_time": startTime} + incident["id"]["home"] = home + incident["id"]["away"] = away + incident["timestamp"] = date_to_string(datetime.now(tz=timezone.utc)) + incident["arguments"]["season"] = "" + + self.Push2bos(incident, potato) + return incident + + def CliManufactureCreateIncident(self): + self._call = INCIDENT_CALLS[0] + self._sportsList = self.GetSportsList() + print("") + print("Select Sport") + self._sport = self.GetKey(self._sportsList) + # self._sport = self.bookiesports[self._sport]["aliases"][0] + self._eventGroupsList = self.GetEventGroupsList(self._sport) + print("") + print("Select Event Group") + self._eventGroup = self.GetKey(self._eventGroupsList) + self._eventGroupIdentifier = self.bookiesports[self._sport][ + "eventgroups"][self._eventGroup]["identifier"] + # self._eventGroupIdentifier = self.bookiesports[self._sport][ + # "eventgroups"][self._eventGroup]["aliases"][0] + self._participantKey = self.bookiesports[self._sport]["eventgroups"][ + self._eventGroup]["participants"] + self._participants, participantDisplays = self.GetParticipants( + self._sport, self._participantKey) + print("") + print("Select Home Team") + self._home = self.GetKeyParticipant( + self._participants, participantDisplays) + print("") + print("Select Away Team") + self._away = self.GetKeyParticipant( + self._participants, participantDisplays) + + incident = dict() + incident["call"] = self._call + + # incident["arguments"] = { + # "whistle_start_time": "2020-08-25T22:22:45.00Z"} + incident["id"] = dict() + incident["id"]["sport"] = self._sport + incident["id"]["event_group_name"] = self._eventGroupIdentifier + # incident["id"]["event_group_name"] = self._eventGroup + print("") + startTime = input( + "Enter Start Time in the format 2020-08-25T22:00:00Z :") + startTime = date_to_string(startTime) + incident["id"]["start_time"] = startTime + incident["arguments"] = {"whistle_start_time": startTime} + # incident["id"]["start_time"] = "2020-08-25T22:00:00Z" + incident["id"]["home"] = self._home + incident["id"]["away"] = self._away + incident["timestamp"] = date_to_string(datetime.now(tz=timezone.utc)) + incident["arguments"]["season"] = "" + + # string = incident_to_string(incident) + + return incident + + def EventsAllSorted(self): + print('Fetching all active events, wait a few seconds') + eventsAll = node.getEvents("all") + eventsAll = pd.DataFrame(eventsAll) + if len(eventsAll) == 0: + return None + eventsAll = eventsAll.sort_values("start_time") + return eventsAll + + def EventsAllSortedForApi(self): + print('Fetching all active events, wait a few seconds') + try: + eventsAllRaw = node.getEvents("all") + self.eventsAllRaw = eventsAllRaw + except Exception as e: + logger.info(e) + eventsAllRaw = self.eventsAllRaw + eventsAll = pd.DataFrame(eventsAllRaw) + if len(eventsAll) == 0: + return None + eventsAll = eventsAll.sort_values("start_time") + eventsAllList = [] + for k in range(len(eventsAll)): + eventsAllList.append(dict(eventsAll.iloc[k])) + eventsAllList = self.EventsAllWithEventGroupName(eventsAllList) + return eventsAllList + + def EventsAllWithEventGroupName(self, eventsAll): + for event in eventsAll: + event_group_id = event["event_group_id"] + # event["event_group_name"] = rpc.get_object( + # event_group_id)["name"][1][1] + eventGroup = rpc.get_object(event_group_id) + + event["event_group_name"] = dict(eventGroup["name"])["identifier"] + # event["event_group_name"] = eventGroup["name"][1][1] + sport = rpc.get_object(eventGroup["sport_id"]) + sport = dict(sport["name"])["identifier"] + event["sport"] = sport + # sport = normalizer._get_sport_identifier(sport, True) + return eventsAll + + def Event2Update(self): + eventsAll = self.EventsAllSorted() + if isinstance(eventsAll, type(None)): + return None + self._eventsAll = eventsAll + for k in range(len(eventsAll)): + event = eventsAll.iloc[k] + print("") + print(event) + eventGroup = node.getEventGroup(event["event_group_id"]) + print(eventGroup["name"]) + sport = node.getSport(eventGroup["sport_id"]) + print(sport) + choice = input( + "'U'pdate the event/'S'kip to the next event, u/s : ") + if choice == "u": + return event + else: + k = k + 1 + return None + + def HomeAway(self, homeAway): + try: + home, away = homeAway.split(" @ ") + except ValueError: + home, away = homeAway.split(" v ") + return home, away + + def EventGroupAlias(self, sport, eventGroup): + bookieEventGroups = self.bookiesports[sport]["eventgroups"] + keys = list(bookieEventGroups.keys()) + for key in keys: + if eventGroup == bookieEventGroups[key]["identifier"]: + return bookieEventGroups[key]["aliases"][0] + print("eventGroup Identifier NOT found: ", sport, eventGroup) + + def EventScheme(self, sport, eventGroup): + sports = self.bookiesports[sport] + eventGroups = sports["eventgroups"] + for eg in eventGroups: + if eventGroups[eg]["identifier"] == eventGroup: + eventScheme = eventGroups[eg] + eventScheme = eventScheme["eventscheme"]["name"] + return eventScheme + + def UpdateForApi(self, event, call, homeScore=None, awayScore=None): + self._event = event + self._call = call + incident = dict() + incident["call"] = self._call + + startTime = event["start_time"] + "Z" + self._starttime = startTime + incident["id"] = dict() + eventGroup = rpc.get_object(event["event_group_id"]) + + sport = rpc.get_object(eventGroup["sport_id"]) + + eventGroup = dict(eventGroup["name"])["identifier"] + sport = dict(sport["name"])["identifier"] + sport = normalizer._get_sport_identifier(sport, True) + self._sport = sport + sportAlias = self.bookiesports[sport]["aliases"][0] + + print(sport, eventGroup, startTime) + + eventGroup = normalizer._get_eventgroup_identifier( + sport, + eventGroup, + startTime, + True) + + self._eventGroup = eventGroup + # eventGroupAlias = self.EventGroupAlias(sport, eventGroup) + # eventGroupAlias = self.bookiesports[sport]["eventgroups"][ + # eventGroup]["aliases"][0] + + homeAway = event["name"][0][1] + self._homeAway = homeAway + home, away = self.HomeAway(homeAway) + eventScheme = self.EventScheme(sport, eventGroup) + homeAway = substitution([home, away], eventScheme) + home, away = self.HomeAway(homeAway) + + homeAlias = normalizer._get_participant_identifier( + sport, + eventGroup, + home, + True) + + awayAlias = normalizer._get_participant_identifier( + sport, + eventGroup, + away, + True) + + # incident["id"]["event_group_name"] = eventGroupAlias + incident["id"]["event_group_name"] = eventGroup + + incident["id"]["sport"] = sportAlias + + incident["id"]["start_time"] = startTime + incident["arguments"] = {"whistle_start_time": startTime} + # incident["id"]["start_time"] = "2020-08-25T22:00:00Z" + + incident["id"]["home"] = homeAlias + incident["id"]["away"] = awayAlias + incident["timestamp"] = date_to_string(datetime.now(tz=timezone.utc)) + incident["arguments"]["season"] = event["season"][0][1] + + if self._call == "result": + incident["arguments"]["home_score"] = homeScore + incident["arguments"]["away_score"] = awayScore + + self._incident = incident + # string = incident_to_string(incident) + + rs = [] + for potatoName in potatoNames: + r = self.Push2bos(incident, potatoName) + rs.append(r) + return incident, rs + + def UpdateForApiWithPotato( + self, event, call, potato, homeScore=None, awayScore=None): + self._event = event + self._call = call + incident = dict() + incident["call"] = self._call + + startTime = event["start_time"] + "Z" + self._starttime = startTime + incident["id"] = dict() + eventGroup = rpc.get_object(event["event_group_id"]) + + sport = rpc.get_object(eventGroup["sport_id"]) + + eventGroup = dict(eventGroup["name"])["identifier"] + sport = dict(sport["name"])["identifier"] + sport = normalizer._get_sport_identifier(sport, True) + self._sport = sport + sportAlias = self.bookiesports[sport]["aliases"][0] + + eventGroup = normalizer._get_eventgroup_identifier( + sport, + eventGroup, + startTime, + True) + + self._eventGroup = eventGroup + # eventGroupAlias = self.EventGroupAlias(sport, eventGroup) + # eventGroupAlias = self.bookiesports[sport]["eventgroups"][ + # eventGroup]["aliases"][0] + + homeAway = event["name"][0][1] + self._homeAway = homeAway + home, away = self.HomeAway(homeAway) + eventScheme = self.EventScheme(sport, eventGroup) + homeAway = substitution([home, away], eventScheme) + home, away = self.HomeAway(homeAway) + + homeAlias = normalizer._get_participant_identifier( + sport, + eventGroup, + home, + True) + + awayAlias = normalizer._get_participant_identifier( + sport, + eventGroup, + away, + True) + + # incident["id"]["event_group_name"] = eventGroupAlias + incident["id"]["event_group_name"] = eventGroup + + incident["id"]["sport"] = sportAlias + + incident["id"]["start_time"] = startTime + incident["arguments"] = {"whistle_start_time": startTime} + # incident["id"]["start_time"] = "2020-08-25T22:00:00Z" + + incident["id"]["home"] = homeAlias + incident["id"]["away"] = awayAlias + incident["timestamp"] = date_to_string(datetime.now(tz=timezone.utc)) + incident["arguments"]["season"] = event["season"][0][1] + + if self._call == "result": + incident["arguments"]["home_score"] = homeScore + incident["arguments"]["away_score"] = awayScore + + self._incident = incident + # string = incident_to_string(incident) + + self.Push2bos(incident, potato) + return incident + + def CliUpdate(self): + event = self.Event2Update() + if isinstance(event, type(None)): + return None + self._event = event + print("") + print("Select Call") + self._call = self.GetKey(INCIDENT_CALLS[1:-1]) + incident = dict() + incident["call"] = self._call + + # incident["arguments"] = { + # "whistle_start_time": "2020-08-25T22:22:45.00Z"} + startTime = event["start_time"] + "Z" + self._starttime = startTime + incident["id"] = dict() + eventGroup = rpc.get_object(event["event_group_id"]) + + sport = rpc.get_object(eventGroup["sport_id"]) + + # eventGroup = dict(eventGroup["name"])["identifier"] + eventGroup = dict(eventGroup["name"])["identifier"] + # sport = dict(sport["name"])["identifier"] + sport = dict(sport["name"])["identifier"] + sport = normalizer._get_sport_identifier(sport, True) + self._sport = sport + sportAlias = self.bookiesports[sport]["aliases"][0] + + eventGroup = normalizer._get_eventgroup_identifier( + sport, + eventGroup, + startTime, + True) + + self._eventGroup = eventGroup + # eventGroupAlias = self.EventGroupAlias(sport, eventGroup) + # eventGroupAlias = self.bookiesports[sport]["eventgroups"][ + # eventGroup]["aliases"][0] + + homeAway = event["name"][0][1] + self._homeAway = homeAway + home, away = self.HomeAway(homeAway) + eventScheme = self.EventScheme(sport, eventGroup) + homeAway = substitution([home, away], eventScheme) + home, away = self.HomeAway(homeAway) + + homeAlias = normalizer._get_participant_identifier( + sport, + eventGroup, + home, + True) + + awayAlias = normalizer._get_participant_identifier( + sport, + eventGroup, + away, + True) + + # incident["id"]["event_group_name"] = eventGroupAlias + incident["id"]["event_group_name"] = eventGroup + + incident["id"]["sport"] = sportAlias + + incident["id"]["start_time"] = startTime + incident["arguments"] = {"whistle_start_time": startTime} + # incident["id"]["start_time"] = "2020-08-25T22:00:00Z" + + incident["id"]["home"] = homeAlias + incident["id"]["away"] = awayAlias + incident["timestamp"] = date_to_string(datetime.now(tz=timezone.utc)) + incident["arguments"]["season"] = event["season"][0][1] + + if self._call == "result": + print("") + homeScore = input("Enter Home " + homeAlias + " Score: ") + print("") + awayScore = input("Enter Away " + awayAlias + " Score: ") + incident["arguments"]["home_score"] = homeScore + incident["arguments"]["away_score"] = awayScore + + self._incident = incident + # string = incident_to_string(incident) + + return incident + + def EventFromChain(self, event): + # event = self.Event2Update() + if isinstance(event, type(None)): + return None + self._event = event + incident = dict() + + # incident["arguments"] = { + # "whistle_start_time": "2020-08-25T22:22:45.00Z"} + startTime = event["start_time"] + "Z" + self._starttime = startTime + incident["id"] = dict() + eventGroup = rpc.get_object(event["event_group_id"]) + + sport = rpc.get_object(eventGroup["sport_id"]) + + # eventGroup = dict(eventGroup["name"])["identifier"] + eventGroup = dict(eventGroup["name"])["identifier"] + # sport = dict(sport["name"])["identifier"] + sport = dict(sport["name"])["identifier"] + sport = normalizer._get_sport_identifier(sport, True) + self._sport = sport + sportAlias = self.bookiesports[sport]["aliases"][0] + + eventGroup = normalizer._get_eventgroup_identifier( + sport, + eventGroup, + startTime, + True) + + self._eventGroup = eventGroup + # eventGroupAlias = self.EventGroupAlias(sport, eventGroup) + # eventGroupAlias = self.bookiesports[sport]["eventgroups"][ + # eventGroup]["aliases"][0] + + homeAway = event["name"][0][1] + self._homeAway = homeAway + home, away = self.HomeAway(homeAway) + eventScheme = self.EventScheme(sport, eventGroup) + homeAway = substitution([home, away], eventScheme) + home, away = self.HomeAway(homeAway) + + homeAlias = normalizer._get_participant_identifier( + sport, + eventGroup, + home, + True) + + awayAlias = normalizer._get_participant_identifier( + sport, + eventGroup, + away, + True) + + # incident["id"]["event_group_name"] = eventGroupAlias + incident["id"]["event_group_name"] = eventGroup + + incident["id"]["sport"] = sportAlias + + incident["id"]["start_time"] = startTime + incident["arguments"] = {"whistle_start_time": startTime} + # incident["id"]["start_time"] = "2020-08-25T22:00:00Z" + + incident["id"]["home"] = homeAlias + incident["id"]["away"] = awayAlias + incident["timestamp"] = date_to_string(datetime.now(tz=timezone.utc)) + incident["arguments"]["season"] = event["season"][0][1] + + self._incident = incident + # string = incident_to_string(incident) + + return incident + + def Update(self): + incident = self.CliUpdate() + if isinstance(incident, type(None)): + print("No incident to update") + return None, None + rs = [] + for potatoName in potatoNames: + r = self.Push2bos(incident, potatoName) + rs.append(r) + return rs + # r = self.Push2dp(incident) + + def Push2dp(self, incident): + self._incident = incident + string = incident_to_string(incident) + self._string = string + # normalize(string_to_incident(string), True) + params = dict() + params["manufacture"] = string + params["restrict_witness_group"] = "elizabeth" + params["token"] = "pbsabookie" + self._params = params + # r = requests.get(url=dps["local"], params=params) + # return r + + def Push2bos(self, incident, providerName): + _thread.start_new_thread(self.Push2bosMethod, (incident, providerName)) + print("thread started") + + def Push2bosMethod(self, incident, providerName): + string = incident_to_string(incident) + self._string = string + incident["unique_string"] = string + incident["provider_info"] = dict() + incident["provider_info"]["name"] = providerName + incident["provider_info"]["pushed"] = date_to_string( + datetime.now(tz=timezone.utc)) + self._incident = incident + incident = normalize(incident, True) + self._incident = incident + logger.info(str(incident)) + + # r = requests.post(url=bos["local"], json=incident) + rng = np.random.default_rng() + lBosApis = len(bosApis) + ks = rng.choice(lBosApis, size=lBosApis, replace=False) + # print(incident) + for k in ks: + # for api in bosApis: + print("inthread:", k) + api = bosApis[k] + # print(api) + try: + requests.post(url=api, json=incident) + except Exception as e: + print(e) + logger.warning(api + ": failed") + time.sleep(self.delayBetweenBosPushes) + print("thread finished") + return + + def Push2bosBetter(self, incident, providerNames): + string = incident_to_string(incident) + self._string = string + incident["unique_string"] = string + incident["provider_info"] = dict() + incident["provider_info"]["pushed"] = date_to_string( + datetime.now(tz=timezone.utc)) + self._incident = incident + incident = normalize(incident, True) + self._incident = incident + logger.info(str(incident)) + + # r = requests.post(url=bos["local"], json=incident) + rng = np.random.default_rng() + lBosApis = len(bosApis) + ks = rng.choice(lBosApis, size=lBosApis, replace=False) + # print(incident) + for k in ks: + # for api in bosApis: + print("inthread:", k) + api = bosApis[k] + for providerName in providerNames: + incident["provider_info"]["name"] = providerName + # print(api) + try: + requests.post(url=api, json=incident) + except Exception as e: + print(e) + logger.warning(api + ": failed") + time.sleep(self.delayBetweenBosPushes) + print("thread finished") + return + + def Push2bosAll(self, incident): + self.Push2bosBetter(incident, config["potatoNames"]) + # for potato in config["potatoNames"]: + # self.Push2bosMethod(incident, potato) + + def Create(self): + incident = self.CliManufactureCreateIncident() + rs = [] + for potatoName in potatoNames: + r = self.Push2bos(incident, potatoName) + rs.append(r) + # r = self.Push2bos(incident, "jemshid1") + # r2 = self.Push2bos(incident, "jemshid2") + # r = self.Push2dp(self._incident) + # return r, r2 + return rs + + def Choose(self): + # print("Choose u or c:") + print("u: Update event") + print("c: Create event") + choice = input("Enter your choice u/c: ") + if choice == "u": + self.Update() + elif choice == "c": + self.Create() + else: + print("You didn't make a relevant choice, try again") + + +if __name__ == "__main__": + cp = Cp() + # self.Choose() + # self.Create() + # incident = self.CliManufactureIncident() + string_to_incident + string_to_date diff --git a/couchpotato/game/views.py b/couchpotato/game/views.py index 71b6771..e6143ab 100644 --- a/couchpotato/game/views.py +++ b/couchpotato/game/views.py @@ -6,6 +6,13 @@ import cp_local cp = cp_local.Cp() +from feed import Feed +fd = Feed() + +def GetMatchingEvents(): + listDist = fd.MatchingEventsAll() + return listDist + def GetEvents(params={}): rDict = dict() sport = None @@ -132,3 +139,5 @@ def UpdatePotato(record): # print(rDict) # print(e) return rDict + + diff --git a/couchpotato/home/templates/index.html b/couchpotato/home/templates/index.html index 4363ec4..1aba7e5 100644 --- a/couchpotato/home/templates/index.html +++ b/couchpotato/home/templates/index.html @@ -31,7 +31,7 @@

diff --git a/couchpotato/home/urls.py b/couchpotato/home/urls.py index 71319c3..696d574 100644 --- a/couchpotato/home/urls.py +++ b/couchpotato/home/urls.py @@ -13,6 +13,7 @@ path('', views.Home, name='index'), path('create/', views.CreateList, name='create'), path('u/', views.UpdateList, name='update_new'), + path('uv/', views.UpdateListVersionOne, name='updateversion1'), path('settingspanel/', views.admin, name='admin'), path('save_features', views.SaveApplicationFeatures, name='savefeatures'), path('save_user_status', views.SaveUserStatus, name='savefeatures'), diff --git a/couchpotato/home/views.py b/couchpotato/home/views.py index 5cd75ab..4a1d241 100644 --- a/couchpotato/home/views.py +++ b/couchpotato/home/views.py @@ -11,7 +11,7 @@ from django.contrib.auth.models import User from home.models import ApplicationFeatures from django.contrib.auth import logout -from game.views import GetEvents , CreatePotato , UpdatePotato +from game.views import GetEvents , CreatePotato , UpdatePotato , GetMatchingEvents from django.contrib.auth.decorators import login_required from django.core import serializers from home.utilities import index_page_permitted , register_login_page_permitted , allow_login , allow_register @@ -119,6 +119,31 @@ def UpdateList(request): return render(request, '404.html') +def getstaticEvents(): + newDict = [{'eventFromChain': {'id': '1.22.602', 'name': [['en', 'Lazio v Crotone']], 'season': [['en', '']], 'start_time': '2021-03-12T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.534', 'name': [['en', 'Augsburg v Mönchengladbach']], 'season': [['en', '']], 'start_time': '2021-03-12T19:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.533', 'name': [['en', 'Augsburg v Mönchengladbach']], 'season': [['en', '']], 'start_time': '2021-03-12T19:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.604', 'name': [['en', 'Atalanta v Spezia']], 'season': [['en', '']], 'start_time': '2021-03-12T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.603', 'name': [['en', 'Atalanta v Spezia']], 'season': [['en', '']], 'start_time': '2021-03-12T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'finished', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.490', 'name': [['en', 'Levante v Valencia']], 'season': [['en', '']], 'start_time': '2021-03-12T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.766', 'name': [['en', 'Vegas Golden Knights @ St. Louis Blues']], 'season': [['en', '']], 'start_time': '2021-03-13T01:00:00', 'event_group_id': '1.21.0', 'scores': [], 'status': 'finished', 'event_group_name': 'NHL Regular Season', 'sport': 'Ice Hockey'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.645', 'name': [['en', 'Denver Nuggets @ Memphis Grizzlies']], 'season': [['en', '']], 'start_time': '2021-03-13T01:00:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'finished', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.646', 'name': [['en', 'Cleveland Cavaliers @ New Orleans Pelicans']], 'season': [['en', '']], 'start_time': '2021-03-13T01:00:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'finished', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.763', 'name': [['en', 'Philadelphia 76ers @ Washington Wizards']], 'season': [['en', '']], 'start_time': '2021-03-13T01:00:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'finished', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.767', 'name': [['en', 'Los Angeles Kings @ Colorado Avalanche']], 'season': [['en', '']], 'start_time': '2021-03-13T02:00:00', 'event_group_id': '1.21.0', 'scores': [], 'status': 'finished', 'event_group_name': 'NHL Regular Season', 'sport': 'Ice Hockey'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.764', 'name': [['en', 'Miami Heat @ Chicago Bulls']], 'season': [['en', '']], 'start_time': '2021-03-13T02:00:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'finished', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.768', 'name': [['en', 'Ottawa Senators @ Edmonton Oilers']], 'season': [['en', '']], 'start_time': '2021-03-13T02:00:00', 'event_group_id': '1.21.0', 'scores': [], 'status': 'finished', 'event_group_name': 'NHL Regular Season', 'sport': 'Ice Hockey'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.769', 'name': [['en', 'San Jose Sharks @ Anaheim Ducks']], 'season': [['en', '']], 'start_time': '2021-03-13T03:00:00', 'event_group_id': '1.21.0', 'scores': [], 'status': 'finished', 'event_group_name': 'NHL Regular Season', 'sport': 'Ice Hockey'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.491', 'name': [['en', 'Alaves v Cadiz']], 'season': [['en', '']], 'start_time': '2021-03-13T13:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.634', 'name': [['en', 'Sassuolo v Verona']], 'season': [['en', '']], 'start_time': '2021-03-13T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.653', 'name': [['en', 'Werder Bremen v Bayern Munich']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Werder Bremen', 'away': 'Bayern Munich'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:55.104013Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.540', 'name': [['en', 'Union Berlin v FC Koln']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Union Berlin', 'away': 'FC Koln'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:55.188676Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.539', 'name': [['en', 'Union Berlin v FC Koln']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Union Berlin', 'away': 'FC Koln'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:55.270535Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.537', 'name': [['en', 'Wolfsburg v Schalke 04']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.538', 'name': [['en', 'Wolfsburg v Schalke 04']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.541', 'name': [['en', 'Mainz v Freiburg']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Mainz', 'away': 'Freiburg'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:55.493435Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.542', 'name': [['en', 'Mainz v Freiburg']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Mainz', 'away': 'Freiburg'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:55.575429Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.652', 'name': [['en', 'Real Madrid v Elche']], 'season': [['en', '']], 'start_time': '2021-03-13T15:15:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.606', 'name': [['en', 'Benevento v Fiorentina']], 'season': [['en', '']], 'start_time': '2021-03-13T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.605', 'name': [['en', 'Benevento v Fiorentina']], 'season': [['en', '']], 'start_time': '2021-03-13T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.535', 'name': [['en', 'Dortmund v Hertha']], 'season': [['en', '']], 'start_time': '2021-03-13T17:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.536', 'name': [['en', 'Dortmund v Hertha']], 'season': [['en', '']], 'start_time': '2021-03-13T17:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.494', 'name': [['en', 'Osasuna v Valladolid']], 'season': [['en', '']], 'start_time': '2021-03-13T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.607', 'name': [['en', 'Genoa v Udinese']], 'season': [['en', '']], 'start_time': '2021-03-13T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'finished', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.608', 'name': [['en', 'Genoa v Udinese']], 'season': [['en', '']], 'start_time': '2021-03-13T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.493', 'name': [['en', 'Getafe v Ath Madrid']], 'season': [['en', '']], 'start_time': '2021-03-13T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.492', 'name': [['en', 'Getafe v Ath Madrid']], 'season': [['en', '']], 'start_time': '2021-03-13T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'finished', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.727', 'name': [['en', 'Bologna v Sampdoria']], 'season': [['en', '']], 'start_time': '2021-03-14T11:30:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T11:30:00Z', 'home': 'Bologna', 'away': 'Sampdoria'}, 'arguments': {'home_score': '3', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:56.397061Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.726', 'name': [['en', 'Bologna v Sampdoria']], 'season': [['en', '']], 'start_time': '2021-03-14T11:30:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T11:30:00Z', 'home': 'Bologna', 'away': 'Sampdoria'}, 'arguments': {'home_score': '3', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:56.460689Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.687', 'name': [['en', 'Southampton v Brighton']], 'season': [['en', '']], 'start_time': '2021-03-14T12:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'finished', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T12:00:00Z', 'home': 'Southampton', 'away': 'Brighton'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:56.464189Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.688', 'name': [['en', 'Southampton v Brighton']], 'season': [['en', '']], 'start_time': '2021-03-14T12:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T12:00:00Z', 'home': 'Southampton', 'away': 'Brighton'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:56.467013Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.673', 'name': [['en', 'Leverkusen v Bielefeld']], 'season': [['en', '']], 'start_time': '2021-03-14T12:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T12:30:00Z', 'home': 'Leverkusen', 'away': 'Bielefeld'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:56.540579Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.672', 'name': [['en', 'Leverkusen v Bielefeld']], 'season': [['en', '']], 'start_time': '2021-03-14T12:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T12:30:00Z', 'home': 'Leverkusen', 'away': 'Bielefeld'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:56.61041Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.660', 'name': [['en', 'Celta Vigo v Ath Bilbao']], 'season': [['en', '']], 'start_time': '2021-03-14T13:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.684', 'name': [['en', 'Leicester v Sheffield United']], 'season': [['en', '']], 'start_time': '2021-03-14T14:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T14:00:00Z', 'home': 'Leicester', 'away': 'Sheffield United'}, 'arguments': {'home_score': '5', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:56.692313Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.725', 'name': [['en', 'Parma Calcio 1913 v Roma']], 'season': [['en', '']], 'start_time': '2021-03-14T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T14:00:00Z', 'home': 'Parma Calcio 1913', 'away': 'Roma'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:56.757793Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.724', 'name': [['en', 'Torino v Inter']], 'season': [['en', '']], 'start_time': '2021-03-14T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.723', 'name': [['en', 'Torino v Inter']], 'season': [['en', '']], 'start_time': '2021-03-14T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.671', 'name': [['en', 'RasenBallsport Leipzig v Ein Frankfurt']], 'season': [['en', '']], 'start_time': '2021-03-14T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T14:30:00Z', 'home': 'RasenBallsport Leipzig', 'away': 'Ein Frankfurt'}, 'arguments': {'home_score': '1', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:56.97345Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.670', 'name': [['en', 'RasenBallsport Leipzig v Ein Frankfurt']], 'season': [['en', '']], 'start_time': '2021-03-14T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T14:30:00Z', 'home': 'RasenBallsport Leipzig', 'away': 'Ein Frankfurt'}, 'arguments': {'home_score': '1', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.060972Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.664', 'name': [['en', 'Granada v Sociedad']], 'season': [['en', '']], 'start_time': '2021-03-14T15:15:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T15:15:00Z', 'home': 'Granada', 'away': 'Sociedad'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.114467Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.663', 'name': [['en', 'Granada v Sociedad']], 'season': [['en', '']], 'start_time': '2021-03-14T15:15:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T15:15:00Z', 'home': 'Granada', 'away': 'Sociedad'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.164568Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.681', 'name': [['en', 'Arsenal v Tottenham']], 'season': [['en', '']], 'start_time': '2021-03-14T16:30:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T16:30:00Z', 'home': 'Arsenal', 'away': 'Tottenham'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.169648Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.682', 'name': [['en', 'Arsenal v Tottenham']], 'season': [['en', '']], 'start_time': '2021-03-14T16:30:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T16:30:00Z', 'home': 'Arsenal', 'away': 'Tottenham'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.17497Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.667', 'name': [['en', 'Cagliari v Juventus']], 'season': [['en', '']], 'start_time': '2021-03-14T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T17:00:00Z', 'home': 'Cagliari', 'away': 'Juventus'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:57.251487Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.668', 'name': [['en', 'Cagliari v Juventus']], 'season': [['en', '']], 'start_time': '2021-03-14T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T17:00:00Z', 'home': 'Cagliari', 'away': 'Juventus'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:57.32255Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.734', 'name': [['en', 'Stuttgart v Hoffenheim']], 'season': [['en', '']], 'start_time': '2021-03-14T17:00:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T17:00:00Z', 'home': 'Stuttgart', 'away': 'Hoffenheim'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.401101Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.735', 'name': [['en', 'Stuttgart v Hoffenheim']], 'season': [['en', '']], 'start_time': '2021-03-14T17:00:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T17:00:00Z', 'home': 'Stuttgart', 'away': 'Hoffenheim'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.474476Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.661', 'name': [['en', 'Eibar v Villarreal']], 'season': [['en', '']], 'start_time': '2021-03-14T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T17:30:00Z', 'home': 'Eibar', 'away': 'Villarreal'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:57.523987Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.662', 'name': [['en', 'Eibar v Villarreal']], 'season': [['en', '']], 'start_time': '2021-03-14T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T17:30:00Z', 'home': 'Eibar', 'away': 'Villarreal'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:57.583102Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.669', 'name': [['en', 'Milan v Napoli']], 'season': [['en', '']], 'start_time': '2021-03-14T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T19:45:00Z', 'home': 'Milan', 'away': 'Napoli'}, 'arguments': {'home_score': '0', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.653676Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.666', 'name': [['en', 'Sevilla v Betis']], 'season': [['en', '']], 'start_time': '2021-03-14T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T20:00:00Z', 'home': 'Sevilla', 'away': 'Betis'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.702612Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.665', 'name': [['en', 'Sevilla v Betis']], 'season': [['en', '']], 'start_time': '2021-03-14T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T20:00:00Z', 'home': 'Sevilla', 'away': 'Betis'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.750823Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.715', 'name': [['en', 'Barcelona v Huesca']], 'season': [['en', '']], 'start_time': '2021-03-15T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-15T20:00:00Z', 'home': 'Barcelona', 'away': 'Huesca'}, 'arguments': {'home_score': '4', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.796495Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.728', 'name': [['en', 'Torino v Sassuolo']], 'season': [['en', '']], 'start_time': '2021-03-17T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-17T14:00:00Z', 'home': 'Torino', 'away': 'Sassuolo'}, 'arguments': {'home_score': '3', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:57.860354Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.729', 'name': [['en', 'Torino v Sassuolo']], 'season': [['en', '']], 'start_time': '2021-03-17T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-17T14:00:00Z', 'home': 'Torino', 'away': 'Sassuolo'}, 'arguments': {'home_score': '3', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:57.925802Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.716', 'name': [['en', 'Sevilla v Elche']], 'season': [['en', '']], 'start_time': '2021-03-17T18:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-17T18:00:00Z', 'home': 'Sevilla', 'away': 'Elche'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.970711Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.717', 'name': [['en', 'Sevilla v Elche']], 'season': [['en', '']], 'start_time': '2021-03-17T18:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-17T18:00:00Z', 'home': 'Sevilla', 'away': 'Elche'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.027846Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.674', 'name': [['en', 'Bielefeld v RasenBallsport Leipzig']], 'season': [['en', '']], 'start_time': '2021-03-19T19:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-19T19:30:00Z', 'home': 'Bielefeld', 'away': 'RasenBallsport Leipzig'}, 'arguments': {'home_score': '0', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:58.149687Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.675', 'name': [['en', 'Bielefeld v RasenBallsport Leipzig']], 'season': [['en', '']], 'start_time': '2021-03-19T19:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-19T19:30:00Z', 'home': 'Bielefeld', 'away': 'RasenBallsport Leipzig'}, 'arguments': {'home_score': '0', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:58.235135Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.730', 'name': [['en', 'Parma Calcio 1913 v Genoa']], 'season': [['en', '']], 'start_time': '2021-03-19T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-19T19:45:00Z', 'home': 'Parma Calcio 1913', 'away': 'Genoa'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.298623Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.718', 'name': [['en', 'Betis v Levante']], 'season': [['en', '']], 'start_time': '2021-03-19T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-19T20:00:00Z', 'home': 'Betis', 'away': 'Levante'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.344717Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.719', 'name': [['en', 'Betis v Levante']], 'season': [['en', '']], 'start_time': '2021-03-19T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-19T20:00:00Z', 'home': 'Betis', 'away': 'Levante'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.403064Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.692', 'name': [['en', 'Fulham v Leeds']], 'season': [['en', '']], 'start_time': '2021-03-19T20:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-19T20:00:00Z', 'home': 'Fulham', 'away': 'Leeds'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.405637Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.691', 'name': [['en', 'Fulham v Leeds']], 'season': [['en', '']], 'start_time': '2021-03-19T20:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-19T20:00:00Z', 'home': 'Fulham', 'away': 'Leeds'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.409635Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.720', 'name': [['en', 'Ath Bilbao v Eibar']], 'season': [['en', '']], 'start_time': '2021-03-20T13:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T13:00:00Z', 'home': 'Ath Bilbao', 'away': 'Eibar'}, 'arguments': {'home_score': '1', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:58.460529Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.721', 'name': [['en', 'Ath Bilbao v Eibar']], 'season': [['en', '']], 'start_time': '2021-03-20T13:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T13:00:00Z', 'home': 'Ath Bilbao', 'away': 'Eibar'}, 'arguments': {'home_score': '1', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:58.507307Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.731', 'name': [['en', 'Crotone v Bologna']], 'season': [['en', '']], 'start_time': '2021-03-20T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-20T14:00:00Z', 'home': 'Crotone', 'away': 'Bologna'}, 'arguments': {'home_score': '2', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:58.566822Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.762', 'name': [['en', 'Werder Bremen v Wolfsburg']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'Werder Bremen', 'away': 'Wolfsburg'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.630686Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.678', 'name': [['en', 'Ein Frankfurt v Union Berlin']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'Ein Frankfurt', 'away': 'Union Berlin'}, 'arguments': {'home_score': '5', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.768115Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.677', 'name': [['en', 'Bayern Munich v Stuttgart']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'Bayern Munich', 'away': 'Stuttgart'}, 'arguments': {'home_score': '4', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.84996Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.738', 'name': [['en', 'FC Koln v Dortmund']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'FC Koln', 'away': 'Dortmund'}, 'arguments': {'home_score': '2', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.917591Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.676', 'name': [['en', 'Bayern Munich v Stuttgart']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'Bayern Munich', 'away': 'Stuttgart'}, 'arguments': {'home_score': '4', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.986362Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.758', 'name': [['en', 'Celta Vigo v Real Madrid']], 'season': [['en', '']], 'start_time': '2021-03-20T15:15:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T15:15:00Z', 'home': 'Celta Vigo', 'away': 'Real Madrid'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.029494Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.733', 'name': [['en', 'Spezia v Cagliari']], 'season': [['en', '']], 'start_time': '2021-03-20T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-20T17:00:00Z', 'home': 'Spezia', 'away': 'Cagliari'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:59.088149Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.732', 'name': [['en', 'Spezia v Cagliari']], 'season': [['en', '']], 'start_time': '2021-03-20T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-20T17:00:00Z', 'home': 'Spezia', 'away': 'Cagliari'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:59.143532Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.759', 'name': [['en', 'Huesca v Osasuna']], 'season': [['en', '']], 'start_time': '2021-03-20T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T17:30:00Z', 'home': 'Huesca', 'away': 'Osasuna'}, 'arguments': {'home_score': '0', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:59.185056Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.760', 'name': [['en', 'Huesca v Osasuna']], 'season': [['en', '']], 'start_time': '2021-03-20T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T17:30:00Z', 'home': 'Huesca', 'away': 'Osasuna'}, 'arguments': {'home_score': '0', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:59.226237Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.736', 'name': [['en', 'Schalke 04 v Mönchengladbach']], 'season': [['en', '']], 'start_time': '2021-03-20T17:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T17:30:00Z', 'home': 'Schalke 04', 'away': 'Mönchengladbach'}, 'arguments': {'home_score': '0', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.293945Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.737', 'name': [['en', 'Schalke 04 v Mönchengladbach']], 'season': [['en', '']], 'start_time': '2021-03-20T17:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T17:30:00Z', 'home': 'Schalke 04', 'away': 'Mönchengladbach'}, 'arguments': {'home_score': '0', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.364111Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.761', 'name': [['en', 'Inter v Sassuolo']], 'season': [['en', '']], 'start_time': '2021-03-20T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-20T19:45:00Z', 'home': 'Inter', 'away': 'Sassuolo'}, 'arguments': {'whistle_start_time': '2021-03-20T19:45:00Z', 'season': ''}, 'timestamp': '2021-03-29T06:47:59.419867Z', 'call': 'canceled'}}, {'eventFromChain': {'id': '1.22.693', 'name': [['en', 'Brighton v Newcastle']], 'season': [['en', '']], 'start_time': '2021-03-20T20:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-20T20:00:00Z', 'home': 'Brighton', 'away': 'Newcastle'}, 'arguments': {'home_score': '3', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:59.42212Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.694', 'name': [['en', 'Brighton v Newcastle']], 'season': [['en', '']], 'start_time': '2021-03-20T20:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-20T20:00:00Z', 'home': 'Brighton', 'away': 'Newcastle'}, 'arguments': {'home_score': '3', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:59.423875Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.747', 'name': [['en', 'West Ham v Arsenal']], 'season': [['en', '']], 'start_time': '2021-03-21T15:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-21T15:00:00Z', 'home': 'West Ham', 'away': 'Arsenal'}, 'arguments': {'home_score': '3', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.4243Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.746', 'name': [['en', 'West Ham v Arsenal']], 'season': [['en', '']], 'start_time': '2021-03-21T15:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-21T15:00:00Z', 'home': 'West Ham', 'away': 'Arsenal'}, 'arguments': {'home_score': '3', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.424729Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.745', 'name': [['en', 'Aston Villa v Tottenham']], 'season': [['en', '']], 'start_time': '2021-03-21T19:30:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-21T19:30:00Z', 'home': 'Aston Villa', 'away': 'Tottenham'}, 'arguments': {'home_score': '0', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:59.425529Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.772', 'name': [['en', 'Utah Jazz @ Golden State Warriors']], 'season': [['en', '']], 'start_time': '2021-03-23T10:30:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'in_progress', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.773', 'name': [['en', 'Denver Broncos @ Cincinnati Bengals']], 'season': [['en', '']], 'start_time': '2021-03-23T16:30:00', 'event_group_id': '1.21.16', 'scores': [], 'status': 'in_progress', 'event_group_name': 'NFL Regular Season', 'sport': 'AmericanFootball'}, 'eventFromFeed': None}] + return newDict + +def UpdateListVersionOne(request): + ''' + param : request + description : To load update page + ''' + try: + if index_page_permitted(request): + params = {'filter':'events'} + # events = getstaticEvents() + events = GetMatchingEvents() + # events = [] + # events = None + list_values = {} + if events is not None: + list_values = dict(enumerate(events , start=1)) + return render(request, 'update_match_events.html',{"data": list_values}) + else: + return render(request, 'login.html') + except: + return render(request, '404.html') + def Home(request): ''' @@ -220,6 +245,8 @@ def UpdatePost(request): away_score = request.POST.get("awayScore") username = request.user.username data = {'event':eval(event),'call':call,'homeScore':home_score,'awayScore':away_score,'username':username} + print(data) + # result={} result = UpdatePotato(data) if(len(result) == 0) : return JsonResponse({'success':'Update Done as ' + call}) diff --git a/feed/feed.py b/feed/feed.py index 40fcdb9..a6fb744 100644 --- a/feed/feed.py +++ b/feed/feed.py @@ -84,7 +84,7 @@ def Call(self, event, incident): if (event["strPostponed"] == "yes") or ( event["strStatus"] == "POST"): incident["call"] = INCIDENT_CALLS[4] - print("Postponed Event") + # print("Postponed Event") elif ( event["strStatus"] == "FT") or ( @@ -96,23 +96,23 @@ def Call(self, event, incident): incident["arguments"] = dict() incident["arguments"]["home_score"] = event["intHomeScore"] incident["arguments"]["away_score"] = event["intAwayScore"] - print("Match Finished") + # print("Match Finished") elif ( event["strStatus"] == "Not Started") or ( event["strStatus"] == "NS"): incident["call"] = INCIDENT_CALLS[0] - print("Not started or NS") + # print("Not started or NS") elif ( startTime - now).days >= 1 and isinstance( event["strStatus"], type(None)): incident["call"] = INCIDENT_CALLS[0] - print("None elif case and event created") + # print("None elif case and event created") elif (event["strStatus"] == "Second Half"): incident["call"] = INCIDENT_CALLS[1] - print('Second Half', "to in_progress", event["strFilename"]) + # print('Second Half', "to in_progress", event["strFilename"]) else: self.failedEvents.append(event) From e8609a2c95cb34c63e6d8849480616635c3ff8dc Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Wed, 31 Mar 2021 15:19:57 +0530 Subject: [PATCH 04/15] minor --- couchpotato/feed.py | 408 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 408 insertions(+) create mode 100644 couchpotato/feed.py diff --git a/couchpotato/feed.py b/couchpotato/feed.py new file mode 100644 index 0000000..4f7be7f --- /dev/null +++ b/couchpotato/feed.py @@ -0,0 +1,408 @@ +import yaml +from dateutil.parser import parse +import requests +from bos_incidents.datestring import date_to_string, string_to_date +from datetime import datetime, timezone +import json +# import pandas as pd +from cp_local import Cp, rpc, config, normalize, substitution +import _thread +import time + +leagueIds = [4328, 4391, 4387, 4380, 4424, 4335, 4332, 4331] +# 4380 : NHL # Ice Hockey +# 4424 : MLB # Baseball +# 4328 : EPL +# 4391 : NFL +# 4387 : NBA +# 4335 : LaLiga +# 4332 : Serie A +# 4562 : Friendly International : International Friendlies +# 4482 : FA Cup +# 4481 : UEFA Europa Lague +# 4480 : UEFA Champions League +# 4331 : Bundesliga + + +INCIDENT_CALLS = [ + "create", # 0 + "in_progress", # 1 + "finish", # 2 + "result", # 3 + "canceled", # 4 + "dynamic_bmgs", # 5 +] + +# https://www.thesportsdb.com/api/v1/json/1/eventspastleague.php?id=4391 +# apiBase = "https://www.thesportsdb.com/api/v1/json/1/" +apiBase = "https://www.thesportsdb.com/api/v1/json/" +apiBase = apiBase + str(config["token"][0]) + "/" +apiEventsNextLeague = "eventsnextleague.php?id=" +apiEventsPastLeague = "eventspastleague.php?id=" +apiTeamsFromLeagueId = "lookup_all_teams.php?id=" + +apiAllLeagues = "all_leagues.php" + + +class Feed: + + def __init__(self): + self.cp = Cp() + self.failedEvents = [] + self.constCheckPeriod = 60 * 60 * 24 # in seconds + self.maxOpenProposals = 1 + pass + + def Past15(self, leagueid): + url = apiBase + apiEventsPastLeague + str(leagueid) + schedule15 = requests.get(url) + schedule15 = schedule15.text + schedule15 = json.loads(schedule15) + events = schedule15["events"] + # return(schedule15) + # def CreateForApi(self, sport, eventGroup, home, away, startTime): + return events + + def Schedule15(self, leagueid): + url = apiBase + apiEventsNextLeague + str(leagueid) + schedule15 = requests.get(url) + self._schedule15 = schedule15 + schedule15 = schedule15.text + schedule15 = json.loads(schedule15) + events = schedule15["events"] + # return(schedule15) + # def CreateForApi(self, sport, eventGroup, home, away, startTime): + return events + + def Call(self, event, incident): + + startTime = string_to_date(incident["id"]["start_time"]) + now = datetime.now(timezone.utc) + self.now = now + self.startTime = startTime + + if (event["strPostponed"] == "yes") or ( + event["strStatus"] == "POST"): + incident["call"] = INCIDENT_CALLS[4] + # print("Postponed Event") + + elif ( + event["strStatus"] == "FT") or ( + event["strStatus"] == "Match Finished") or ( + event["strStatus"] == "AP") or ( + event["strStatus"] == "AOT") or ( + (now - startTime).days > 1): + incident["call"] = INCIDENT_CALLS[3] + incident["arguments"] = dict() + incident["arguments"]["home_score"] = event["intHomeScore"] + incident["arguments"]["away_score"] = event["intAwayScore"] + # print("Match Finished") + + elif ( + event["strStatus"] == "Not Started") or ( + event["strStatus"] == "NS"): + incident["call"] = INCIDENT_CALLS[0] + # print("Not started or NS") + + elif ( + startTime - now).days >= 1 and isinstance( + event["strStatus"], type(None)): + incident["call"] = INCIDENT_CALLS[0] + # print("None elif case and event created") + + elif (event["strStatus"] == "Second Half"): + incident["call"] = INCIDENT_CALLS[1] + # print('Second Half', "to in_progress", event["strFilename"]) + + else: + self.failedEvents.append(event) + print("Call Not Managed:") + return incident + + def ToCp(self, event): + sport = None + eventGroup = None + home = None + away = None + startTime = None + # strEvent = event["strEvent"] + # home, away = strEvent.split(" vs ") + sport = event["strSport"] + eventGroup = event["strLeague"] + home = event["strHomeTeam"] + away = event["strAwayTeam"] + dateEvent = event["dateEvent"] + strTime = event["strTime"] + # if len(strTime.split(":")[0]) == 1: + # strTime = "0" + strTime + startTime = dateEvent + "T" + strTime + "Z" + startTime = date_to_string(parse(startTime)) + incident = self.CreateIncident( + sport, eventGroup, home, away, startTime) + + incident = self.Call(event, incident) + return incident + + def CreateIncident(self, sport, eventGroup, home, away, startTime): + incident = dict() + # incident["call"] = INCIDENT_CALLS[0] + + incident["id"] = dict() + incident["id"]["sport"] = sport + # eventGroupIdentifier = self.bookiesports[sport][ + # "eventgroups"][eventGroup]["identifier"] + # incident["id"]["event_group_name"] = eventGroupIdentifier + incident["id"]["event_group_name"] = eventGroup + # incident["id"]["event_group_name"] = self._eventGroup + # startTime = date_to_string(startTime) + incident["id"]["start_time"] = startTime + incident["arguments"] = {"whistle_start_time": startTime} + incident["id"]["home"] = home + incident["id"]["away"] = away + incident["timestamp"] = date_to_string(datetime.now(tz=timezone.utc)) + incident["arguments"]["season"] = "" + return incident + + def ForLeague(self, leagueId): + events = self.Schedule15(leagueId) + self.Push2Bos(events) + events = self.Past15(leagueId) + self.Push2Bos(events) + + def Push2Bos(self, events): + if isinstance(events, type(None)): + return + for k in range(len(events)): + while True: + proposalsOpen = rpc.get_proposed_transactions("1.2.1") + print("Len proposalsOpen: ", len(proposalsOpen)) + if len(proposalsOpen) <= self.maxOpenProposals: + break + else: + time.sleep(60) + event = events[k] + toCp = self.ToCp(event) + try: + self.cp.Push2bosAll(toCp) + except Exception as e: + # self.failedEvents.append(toCp) + self.failedEvents.append(event) + print("Failed Event: ", k, toCp) + print(e) + return + + def PushLeague(self, leagueid, call="create"): + if call == "create": + events = self.Schedule15(leagueid) + elif call == "result": + events = self.Past15(leagueid) + else: + print("Wrong call") + return + for k in range(len(events)): + event = events[k] + toCp = self.ToCp(event) + # print(k, "/", len(events), "-------event------: ", toCp) + print(k, "/", len(events)) + try: + self.cp.Push2bosAll(toCp) + except Exception as e: + print(e) + print("FAILED: ", event) + + def PushAll(self): + for leagueId in leagueIds: + self.ForLeague(leagueId) + # self.PushLeague(leagueId) + + def WhileForThread(self): + while self.flagWhileForThread == "run": + print('WhileForThreadStarted') + self.PushAll() + print('WhileForThreadOver') + time.sleep(self.constCheckPeriod) + print("WhileForThred EXITED") + + def Timed(self): + self.flagWhileForThread = "run" + _thread.start_new_thread(self.WhileForThread, ()) + + def EventsToDf(self, events): + pass + + def MatchingEvent(self, eventsFromFeed, eventFromChain): + for eventFromFeed in eventsFromFeed: + toCp = self.ToCp(eventFromFeed) + toCp = normalize(toCp) + if toCp["id"]["start_time"][:-1] == eventFromChain["start_time"]: + eventScheme = self.cp.EventScheme(toCp["id"]["sport"], toCp[ + "id"]["event_group_name"]) + home = toCp["id"]["home"] + away = toCp["id"]["away"] + homeAway = substitution([home, away], eventScheme) + if homeAway == eventFromChain["name"][0][1]: + return toCp + return None + + def MatchingEvents(self, leagueIds): + eventsFromFeed = [] + for leagueId in leagueIds: + # print(leagueId) + eventsFromFeed = eventsFromFeed + self.Past15(leagueId) + eventsFromChain = self.cp.EventsAllSortedForApi() + matchingEvents = [] + for k in range(len(eventsFromChain)): + # eventFromChain = eventsFromChain.iloc[k] + eventFromChain = eventsFromChain[k] + # for eventFromChain in eventsFromChain: + toCp = self.MatchingEvent(eventsFromFeed, eventFromChain) + # if not isinstance(toCp, type(None)): + matchingEvent = dict() + matchingEvent["eventFromChain"] = eventFromChain + matchingEvent["eventFromFeed"] = toCp + matchingEvents.append(matchingEvent) + return matchingEvents + + def MatchingEventsAll(self): + matchingEventsAll = self.MatchingEvents(leagueIds) + return matchingEventsAll + + +class Updater: + + def __init__(self): + self.cp = Cp() + self.delayMax = 3600 + self.delay = 60 + self.flagWhileForThread = "stop" + pass + + def Update(self): + eventsAllSorted = self.cp.EventsAllSorted() + self.eventsAllSorted = eventsAllSorted + for k in range(len(eventsAllSorted)): + event = eventsAllSorted.iloc[k] + self.event = event + print(k, "/", len(eventsAllSorted), event["start_time"]) + startTime = event["start_time"] + "Z" + startTime = string_to_date(startTime) + nowInUtc = datetime.now(startTime.tzinfo) + if startTime <= nowInUtc: + if event["status"] == "upcoming": + self.cp.UpdateForApi( + event, "in_progress") + else: + time2nextEvent = startTime - nowInUtc + time2nextEvent = time2nextEvent.total_seconds() + print("Wait Started at:", nowInUtc) + if time2nextEvent > self.delayMax: + time.sleep(self.delayMax) + else: + time.sleep(time2nextEvent) + break + + def WhileForUpdate(self): + while self.flagWhileForThread == "run": + self.Update() + print("WhileForUpdateThred EXITED") + + def UpdateInThread(self): + self.flagWhileForThread = "run" + _thread.start_new_thread(self.WhileForUpdate, ()) + + +class Compare: + + def __init__(self): + pass + + +class FeedDetails: + + def __init__(self): + pass + + def Leagues(self): + leagues = requests.get(apiBase + apiAllLeagues) + leagues = leagues.text + leagues = json.loads(leagues) + leagues = leagues["leagues"] + return leagues + + def FindLeague(self): + leagues = self.Leagues() + while True: + query = input("Enter Search String For Leagues: ") + for k in range(len(leagues)): + # print(k, "/", len(leagues)) + if query in str(leagues[k]): + print(leagues[k]) + + def TeamsFromLeagueId(self, leagueid): + url = apiBase + apiTeamsFromLeagueId + str(leagueid) + teams = requests.get(url) + teams = teams.text + teams = json.loads(teams) + teams = teams["teams"] + # teamsShort = [] + for k in range(len(teams)): + team = teams[k] + print( + team[ + "strTeam"], "|", team[ + "strTeamShort"], "|", team["strAlternate"]) + # teamShort = dict() + # teamShort["str"] + # team["strTeam"] = + return teams + + def TeamsToDict(self, teams): + participants = [] + for i in teams: + participant = dict() + strTeam = i["strTeam"] + strAlternate = i["strAlternate"] + strTeamShort = i["strTeamShort"] + if isinstance(strAlternate, type(None)): + strAlternate = strTeam + elif len(strAlternate) == 0: + strAlternate = strTeam + if isinstance(strTeamShort, type(None)): + strTeamShort = strTeam + elif len(strTeamShort) == 0: + strTeamShort = strTeam + participant["identifier"] = strTeam + participant["aliases"] = [] + participant["aliases"].append(strTeam) + strAlternates = strAlternate.split(", ") + for item in strAlternates: + participant["aliases"].append(item) + # participant["aliases"].append(strAlternate) + participant["aliases"].append(strTeamShort) + participant["name"] = dict() + participant["name"]["en"] = strTeam + participant["name"]["sen"] = strTeamShort + participants.append(participant) + return participants + + def TeamsToYaml(self, leagueId, filename): + teams = self.TeamsFromLeagueId(leagueId) + participants = self.TeamsToDict(teams) + toFile = dict() + toFile["participants"] = participants + with open(filename, "w") as f: + f.write(yaml.dump(toFile)) + return toFile + + +if __name__ == "__main__": + feed = Feed() + self = feed + feedDetails = FeedDetails() + updater = Updater() + # leagues = feedDetails.Leagues() + # leagues = leagues["leagues"] + # print(leagues) + + # self = feed + string_to_date() From 94fc920e9d38c75da9ee7a66ab7bc181db59e158 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Wed, 31 Mar 2021 15:38:37 +0530 Subject: [PATCH 05/15] minor --- .../home/templates/update_match_events.html | 386 ++++++++++++++++++ 1 file changed, 386 insertions(+) create mode 100644 couchpotato/home/templates/update_match_events.html diff --git a/couchpotato/home/templates/update_match_events.html b/couchpotato/home/templates/update_match_events.html new file mode 100644 index 0000000..ad3455b --- /dev/null +++ b/couchpotato/home/templates/update_match_events.html @@ -0,0 +1,386 @@ + + + + + Couch Potato + + + + + + + + + + + + + + {% include "navbar.html" %} + +
+
+ +

+ + + + +
+ + + + + + + + + + + + + + + + {% for a , b in data.items %} + + + + + + + + + + + + + + + + + + + {% endfor %} + + + +
Event on ChainUpdate from FeedScoresCallStart Time in Local Time
+ {{b.eventFromChain}} + + {{b.eventFromFeed}} + + Home Score : +
+ Away Score : +
+

+ +

+ +

+ + +
+ + + + + Return to Home + +
+ + +
+
+ + + + + + + + + + + + + + + + + + From 15f6f8c7e743bcb4d0989b7ba8e2cecfa0f23045 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Thu, 1 Apr 2021 14:00:18 +0530 Subject: [PATCH 06/15] Better feedback text and sorting removal --- .../home/templates/update_match_events.html | 19 ++++++++++++++++++- couchpotato/home/views.py | 6 +++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/couchpotato/home/templates/update_match_events.html b/couchpotato/home/templates/update_match_events.html index ad3455b..cc26dc4 100644 --- a/couchpotato/home/templates/update_match_events.html +++ b/couchpotato/home/templates/update_match_events.html @@ -349,7 +349,24 @@

}, - + columnDefs: [ + + { + orderable: false, targets: 0 + }, + { + orderable: false, targets: 1 + }, + { + orderable: false, targets: 2 + }, + { + orderable: false, targets: 3 + }, + { + orderable: false, targets: 4 + }, + ], // responsive: { // details: { // display: $.fn.dataTable.Responsive.display.modal( { diff --git a/couchpotato/home/views.py b/couchpotato/home/views.py index 4a1d241..b1a3190 100644 --- a/couchpotato/home/views.py +++ b/couchpotato/home/views.py @@ -131,8 +131,8 @@ def UpdateListVersionOne(request): try: if index_page_permitted(request): params = {'filter':'events'} - # events = getstaticEvents() - events = GetMatchingEvents() + events = getstaticEvents() + # events = GetMatchingEvents() # events = [] # events = None list_values = {} @@ -249,7 +249,7 @@ def UpdatePost(request): # result={} result = UpdatePotato(data) if(len(result) == 0) : - return JsonResponse({'success':'Update Done as ' + call}) + return JsonResponse({'success':event + " : " + call}) else: return JsonResponse({'success':'Error'}) From ffd78a4765fa5d59b41cb48a5027ef57093eb67b Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Thu, 1 Apr 2021 14:08:07 +0530 Subject: [PATCH 07/15] Only list order --- couchpotato/home/templates/update_match_events.html | 2 +- couchpotato/home/views.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/couchpotato/home/templates/update_match_events.html b/couchpotato/home/templates/update_match_events.html index cc26dc4..1612df9 100644 --- a/couchpotato/home/templates/update_match_events.html +++ b/couchpotato/home/templates/update_match_events.html @@ -339,7 +339,7 @@

$('#utcgen_date_time').html(utc.toString()) var table = $('#example').DataTable( { - + "ordering": false, "initComplete": function(settings, json) { $("#example_wrapper").removeClass('form-inline'); diff --git a/couchpotato/home/views.py b/couchpotato/home/views.py index b1a3190..78f7981 100644 --- a/couchpotato/home/views.py +++ b/couchpotato/home/views.py @@ -131,8 +131,10 @@ def UpdateListVersionOne(request): try: if index_page_permitted(request): params = {'filter':'events'} - events = getstaticEvents() - # events = GetMatchingEvents() + # events = getstaticEvents() + # print(events) + events = GetMatchingEvents() + # print(events) # events = [] # events = None list_values = {} From 027fe9b09113715dec3c0986afc63562453192b8 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Sun, 4 Apr 2021 00:13:24 +0530 Subject: [PATCH 08/15] Admin to moderate/authorize signup, and Baseball removed from feed due to missing start time --- couchpotato/feed.py | 5 +- couchpotato/home/forms.py | 45 ++++++++++++++++ couchpotato/home/templates/admin.html | 36 ++++++++++++- couchpotato/home/templates/login.html | 14 +++-- couchpotato/home/urls.py | 1 + couchpotato/home/utilities.py | 1 + couchpotato/home/views.py | 74 ++++++++++++++------------- 7 files changed, 133 insertions(+), 43 deletions(-) diff --git a/couchpotato/feed.py b/couchpotato/feed.py index 4f7be7f..2c6c4ba 100644 --- a/couchpotato/feed.py +++ b/couchpotato/feed.py @@ -9,7 +9,8 @@ import _thread import time -leagueIds = [4328, 4391, 4387, 4380, 4424, 4335, 4332, 4331] +# leagueIds = [4328, 4391, 4387, 4380, 4424, 4335, 4332, 4331] +leagueIds = [4328, 4391, 4387, 4380, 4335, 4332, 4331] # 4380 : NHL # Ice Hockey # 4424 : MLB # Baseball # 4328 : EPL @@ -136,6 +137,7 @@ def ToCp(self, event): # if len(strTime.split(":")[0]) == 1: # strTime = "0" + strTime startTime = dateEvent + "T" + strTime + "Z" + # print(startTime, type(startTime)) startTime = date_to_string(parse(startTime)) incident = self.CreateIncident( sport, eventGroup, home, away, startTime) @@ -232,6 +234,7 @@ def EventsToDf(self, events): def MatchingEvent(self, eventsFromFeed, eventFromChain): for eventFromFeed in eventsFromFeed: + self._eventFromFeed = eventFromFeed toCp = self.ToCp(eventFromFeed) toCp = normalize(toCp) if toCp["id"]["start_time"][:-1] == eventFromChain["start_time"]: diff --git a/couchpotato/home/forms.py b/couchpotato/home/forms.py index 183c7fc..a1d4add 100644 --- a/couchpotato/home/forms.py +++ b/couchpotato/home/forms.py @@ -1,7 +1,52 @@ from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User +from django.contrib.auth import login, authenticate +from django.contrib.auth.forms import AuthenticationForm + + +class LoginForm(AuthenticationForm): + def confirm_login_allowed(self, user): + if not user.is_active: + raise forms.ValidationError( + 'The user is awating admin approval', + code='inactive', + ) + elif self.user_cache is None: + raise forms.ValidationError( + self.error_messages['invalid_login'], + code='invalid_login', + params={'username': self.username_field.verbose_name}, + ) + def clean(self): + username = self.cleaned_data.get('username') + password = self.cleaned_data.get('password') + if username is None or username is '': + raise forms.ValidationError( + 'Username cannot be left blank', + code='invalid_login', + params={'username': self.username_field.verbose_name}, + ) + elif username is not None and password: + self.user_cache = authenticate(self.request, username=username, password=password) + print(self.user_cache) + if self.user_cache is None: + try: + user_temp = User.objects.get(username=username) + except: + user_temp = None + + if user_temp is not None: + self.confirm_login_allowed(user_temp) + else: + raise forms.ValidationError( + self.error_messages['invalid_login'], + code='invalid_login', + params={'username': self.username_field.verbose_name}, + ) + + return self.cleaned_data class SignUpForm(UserCreationForm): # first_name = forms.CharField(label='First Name') diff --git a/couchpotato/home/templates/admin.html b/couchpotato/home/templates/admin.html index 6963ccf..d259186 100644 --- a/couchpotato/home/templates/admin.html +++ b/couchpotato/home/templates/admin.html @@ -81,13 +81,14 @@

User Settings

Last Name Email Address Active + Delete {% for u in users %} - {{ u.username }} + {{ u.username }} {{ u.first_name}} {{u.last_name}} {{u.email}} @@ -102,6 +103,10 @@

User Settings

{%endif%} + + + + @@ -153,6 +158,33 @@

User Settings

}); + $(".btn").click(function() { + // alert((this).id) + console.log((this).id) + var r = confirm("Do you need to delete the user " + $(this).closest('tr').find('.name').text()); + if (r == true) { + + // $(this).closest('tr').remove() + var row = $(this).closest('tr') + + $.post("/delete_user", + { + user_id: (this).id, + csrfmiddlewaretoken: '{{ csrf_token }}' , + }, + function(data){ + // $(this).closest('tr').remove() + row.remove() + alert(data.success) + + }); + + + + } + + }); + $( "#autoSizingCheck" ).click(function() { console.log($('#autoSizingCheck').is(":checked")) @@ -209,7 +241,7 @@

User Settings

- } ); + } ); diff --git a/couchpotato/home/templates/login.html b/couchpotato/home/templates/login.html index e9e595f..c38e352 100644 --- a/couchpotato/home/templates/login.html +++ b/couchpotato/home/templates/login.html @@ -71,12 +71,16 @@ {% if messages %} -
    - {% for message in messages %} + + + + {% for message in messages %} + {{message}} + + {% endfor %} + -
  • {{ message }}
  • - {% endfor %} -
+ {% endif %} diff --git a/couchpotato/home/urls.py b/couchpotato/home/urls.py index 696d574..687bfcb 100644 --- a/couchpotato/home/urls.py +++ b/couchpotato/home/urls.py @@ -16,6 +16,7 @@ path('uv/', views.UpdateListVersionOne, name='updateversion1'), path('settingspanel/', views.admin, name='admin'), path('save_features', views.SaveApplicationFeatures, name='savefeatures'), + path('delete_user', views.DeleteUser, name='delete_user'), path('save_user_status', views.SaveUserStatus, name='savefeatures'), path('logout/', views.LogoutUser, name='logout'), path('login/', views.AuthenticateUser, name='login'), diff --git a/couchpotato/home/utilities.py b/couchpotato/home/utilities.py index 201698a..52ae7c5 100644 --- a/couchpotato/home/utilities.py +++ b/couchpotato/home/utilities.py @@ -1,5 +1,6 @@ from home.models import ApplicationFeatures +#limit_user_signup is the feature added to prevent the create account option in the software. def index_page_permitted(request): app_feature = ApplicationFeatures.objects.filter(id=1).first() diff --git a/couchpotato/home/views.py b/couchpotato/home/views.py index 78f7981..71a6ef9 100644 --- a/couchpotato/home/views.py +++ b/couchpotato/home/views.py @@ -1,13 +1,13 @@ - + # Create your views here. -from django.http import Http404 , JsonResponse , HttpResponseRedirect +from django.http import Http404, JsonResponse, HttpResponseRedirect from django.shortcuts import render import json import requests import pytz, datetime from django.contrib.auth import login, authenticate from django.shortcuts import render, redirect -from home.forms import SignUpForm +from home.forms import SignUpForm ,LoginForm from django.contrib.auth.models import User from home.models import ApplicationFeatures from django.contrib.auth import logout @@ -25,9 +25,10 @@ def AuthenticateUser(request): param: request description: Loads the login page and does the authentication. ''' - if request.method == 'POST': - form = AuthenticationForm(request=request, data=request.POST) + form = LoginForm(request=request, data=request.POST) + + if form.is_valid(): username = form.cleaned_data.get('username').strip() password = form.cleaned_data.get('password') @@ -35,17 +36,12 @@ def AuthenticateUser(request): if user is not None: login(request, user) return redirect('/') - else: - if username is None or username is '': - messages.error(request, 'Username cannot be blank') - else: - messages.error(request, "Invalid username or password.") + else: - username = request.POST.get('username').strip() - if username is None or username is '': - messages.error(request, 'Username cannot be blank') - else: - messages.error(request, "Invalid username or password.") + print("Invalid") + for key , value in form.errors.items(): + error = value + messages.error(request, error) return HttpResponseRedirect('/') @@ -72,24 +68,19 @@ def LogoutSwagger(request): def SignUp(request): ''' param: request - description : Loads the registration page and does the sign up and authentication. + description : Loads the registration page and does the sign up. + New user is set inactive intially before admin approval. ''' # print("In sign up ") # try: if allow_register(): - # print("in allow register " , request.method ) if request.method == 'POST': form = SignUpForm(request.POST) - # print(form) if form.is_valid(): - # print("Form is valid") - form.save() - username = form.cleaned_data.get('username') - raw_password = form.cleaned_data.get('password1') - user = authenticate(username=username, password=raw_password) - if user is not None: - login(request, user) - return redirect('/') + user = form.save() + user.is_active = False + user.save() + return redirect('/') else: form = SignUpForm() return render(request, 'register.html',{'form':form}) @@ -153,13 +144,13 @@ def Home(request): description : To load home page ''' - try: - if index_page_permitted(request): - return render(request, 'index.html') - elif register_login_page_permitted(): - return render(request, 'login.html') - except: - return render(request, '404.html') + # try: + if index_page_permitted(request): + return render(request, 'index.html') + elif register_login_page_permitted(): + return render(request, 'login.html') + # except: + # return render(request, '404.html') def CreateList(request,num=1): ''' @@ -275,6 +266,19 @@ def admin(request): return render(request, 'login.html') +def DeleteUser(request): + ''' + param : request + description : Delete user + ''' + + user_id = request.POST.get("user_id") + print("User Id " , user_id) + user = User.objects.get(id=user_id) + user.delete() + return JsonResponse({'success':'Success'}) + + def SaveApplicationFeatures(request): ''' param : request @@ -287,12 +291,12 @@ def SaveApplicationFeatures(request): try: value_sign = None value_user_limit = None - if req_signup is not '': + if req_signup != '': if(req_signup == 'true'):value_sign = True else:value_sign = False signup, created = ApplicationFeatures.objects.update_or_create(id=1, defaults={'signup':value_sign}) - if req_limit_users is not '': + if req_limit_users != '': if(req_limit_users == 'true'):value_user_limit = True else:value_user_limit = False limit_users, created = ApplicationFeatures.objects.update_or_create(id=1, defaults={'limit_user_signup':value_user_limit}) From 333a302fc8afa79d4f409d777bb9510097b826c1 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Wed, 7 Apr 2021 17:23:55 +0530 Subject: [PATCH 09/15] telegram bot support --- couchpotato/feed.py | 10 ++++++++++ requirements.txt | 1 + 2 files changed, 11 insertions(+) diff --git a/couchpotato/feed.py b/couchpotato/feed.py index 2c6c4ba..19b98a7 100644 --- a/couchpotato/feed.py +++ b/couchpotato/feed.py @@ -1,3 +1,4 @@ +import telegram import yaml from dateutil.parser import parse import requests @@ -44,6 +45,9 @@ apiAllLeagues = "all_leagues.php" +tokenTelegram = config["token_telegram"] +telegramChatIds = config["telegram_chat_ids"] + class Feed: @@ -278,6 +282,7 @@ def __init__(self): self.delayMax = 3600 self.delay = 60 self.flagWhileForThread = "stop" + self.telegramBot = telegram.Bot(token=tokenTelegram) pass def Update(self): @@ -292,8 +297,13 @@ def Update(self): nowInUtc = datetime.now(startTime.tzinfo) if startTime <= nowInUtc: if event["status"] == "upcoming": + for chatId in telegramChatIds: + text = "Update " + str(event) + " to in_progress!" + self.bot.sendMessage(chat_id=chatId, text=text) + self.cp.UpdateForApi( event, "in_progress") + else: time2nextEvent = startTime - nowInUtc time2nextEvent = time2nextEvent.total_seconds() diff --git a/requirements.txt b/requirements.txt index deee423..604de16 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +telegram bookiesports bos-mint bos-incidents From 03ba72dae8d2ea89551a87cbb9f02314e41c0858 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Thu, 8 Apr 2021 15:54:20 +0530 Subject: [PATCH 10/15] Single view event create and simplified update page --- couchpotato/home/templates/index.html | 2 +- .../home/templates/update_match_events.html | 59 ++++++++++++++-- couchpotato/home/urls.py | 1 + couchpotato/home/views.py | 67 ++++++++++++++++++- 4 files changed, 120 insertions(+), 9 deletions(-) diff --git a/couchpotato/home/templates/index.html b/couchpotato/home/templates/index.html index 1aba7e5..0935fb8 100644 --- a/couchpotato/home/templates/index.html +++ b/couchpotato/home/templates/index.html @@ -30,7 +30,7 @@

--> diff --git a/couchpotato/home/templates/update_match_events.html b/couchpotato/home/templates/update_match_events.html index 1612df9..9fd8e86 100644 --- a/couchpotato/home/templates/update_match_events.html +++ b/couchpotato/home/templates/update_match_events.html @@ -65,7 +65,9 @@

Event on Chain + Event Update from Feed + Feed Scores Call Start Time in Local Time @@ -76,17 +78,64 @@

{% for a , b in data.items %} - + {{b.eventFromChain}} - - + +
    +
  • + {{b.eventFromChain.name.0.1}} +
  • +
  • + {{b.eventFromChain.start_time}} +
  • +
  • + {{b.eventFromChain.scores}} +
  • +
  • + {{b.eventFromChain.status}} +
  • +
  • + {{b.eventFromChain.sport}} +
  • +
+ + + + {{b.eventFromFeed}} + + {% if b.eventFromFeed is not none%} +
    +
  • + {{b.eventFromFeed.id.sport}} +
  • +
  • + {{b.eventFromFeed.id.start_time}} +
  • +
  • + {{b.eventFromFeed.id.home}} +
  • +
  • + {{b.eventFromFeed.id.away}} +
  • +
  • + {{b.eventFromFeed.arguments.home_score}} +
  • +
  • + {{b.eventFromFeed.arguments.away_score}} +
  • +
  • + {{b.eventFromFeed.call}} +
  • +
+ {% endif %} + - + Home Score : -
+

Away Score : diff --git a/couchpotato/home/urls.py b/couchpotato/home/urls.py index 687bfcb..e6fd8da 100644 --- a/couchpotato/home/urls.py +++ b/couchpotato/home/urls.py @@ -12,6 +12,7 @@ urlpatterns = [ path('', views.Home, name='index'), path('create/', views.CreateList, name='create'), + path('select/', views.LoadSelectOptions, name='createselect'), path('u/', views.UpdateList, name='update_new'), path('uv/', views.UpdateListVersionOne, name='updateversion1'), path('settingspanel/', views.admin, name='admin'), diff --git a/couchpotato/home/views.py b/couchpotato/home/views.py index 71a6ef9..d674794 100644 --- a/couchpotato/home/views.py +++ b/couchpotato/home/views.py @@ -1,6 +1,6 @@ # Create your views here. -from django.http import Http404, JsonResponse, HttpResponseRedirect +from django.http import Http404 , JsonResponse , HttpResponseRedirect ,HttpResponse from django.shortcuts import render import json import requests @@ -113,7 +113,8 @@ def UpdateList(request): def getstaticEvents(): newDict = [{'eventFromChain': {'id': '1.22.602', 'name': [['en', 'Lazio v Crotone']], 'season': [['en', '']], 'start_time': '2021-03-12T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.534', 'name': [['en', 'Augsburg v Mönchengladbach']], 'season': [['en', '']], 'start_time': '2021-03-12T19:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.533', 'name': [['en', 'Augsburg v Mönchengladbach']], 'season': [['en', '']], 'start_time': '2021-03-12T19:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.604', 'name': [['en', 'Atalanta v Spezia']], 'season': [['en', '']], 'start_time': '2021-03-12T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.603', 'name': [['en', 'Atalanta v Spezia']], 'season': [['en', '']], 'start_time': '2021-03-12T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'finished', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.490', 'name': [['en', 'Levante v Valencia']], 'season': [['en', '']], 'start_time': '2021-03-12T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.766', 'name': [['en', 'Vegas Golden Knights @ St. Louis Blues']], 'season': [['en', '']], 'start_time': '2021-03-13T01:00:00', 'event_group_id': '1.21.0', 'scores': [], 'status': 'finished', 'event_group_name': 'NHL Regular Season', 'sport': 'Ice Hockey'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.645', 'name': [['en', 'Denver Nuggets @ Memphis Grizzlies']], 'season': [['en', '']], 'start_time': '2021-03-13T01:00:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'finished', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.646', 'name': [['en', 'Cleveland Cavaliers @ New Orleans Pelicans']], 'season': [['en', '']], 'start_time': '2021-03-13T01:00:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'finished', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.763', 'name': [['en', 'Philadelphia 76ers @ Washington Wizards']], 'season': [['en', '']], 'start_time': '2021-03-13T01:00:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'finished', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.767', 'name': [['en', 'Los Angeles Kings @ Colorado Avalanche']], 'season': [['en', '']], 'start_time': '2021-03-13T02:00:00', 'event_group_id': '1.21.0', 'scores': [], 'status': 'finished', 'event_group_name': 'NHL Regular Season', 'sport': 'Ice Hockey'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.764', 'name': [['en', 'Miami Heat @ Chicago Bulls']], 'season': [['en', '']], 'start_time': '2021-03-13T02:00:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'finished', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.768', 'name': [['en', 'Ottawa Senators @ Edmonton Oilers']], 'season': [['en', '']], 'start_time': '2021-03-13T02:00:00', 'event_group_id': '1.21.0', 'scores': [], 'status': 'finished', 'event_group_name': 'NHL Regular Season', 'sport': 'Ice Hockey'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.769', 'name': [['en', 'San Jose Sharks @ Anaheim Ducks']], 'season': [['en', '']], 'start_time': '2021-03-13T03:00:00', 'event_group_id': '1.21.0', 'scores': [], 'status': 'finished', 'event_group_name': 'NHL Regular Season', 'sport': 'Ice Hockey'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.491', 'name': [['en', 'Alaves v Cadiz']], 'season': [['en', '']], 'start_time': '2021-03-13T13:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.634', 'name': [['en', 'Sassuolo v Verona']], 'season': [['en', '']], 'start_time': '2021-03-13T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.653', 'name': [['en', 'Werder Bremen v Bayern Munich']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Werder Bremen', 'away': 'Bayern Munich'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:55.104013Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.540', 'name': [['en', 'Union Berlin v FC Koln']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Union Berlin', 'away': 'FC Koln'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:55.188676Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.539', 'name': [['en', 'Union Berlin v FC Koln']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Union Berlin', 'away': 'FC Koln'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:55.270535Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.537', 'name': [['en', 'Wolfsburg v Schalke 04']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.538', 'name': [['en', 'Wolfsburg v Schalke 04']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.541', 'name': [['en', 'Mainz v Freiburg']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Mainz', 'away': 'Freiburg'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:55.493435Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.542', 'name': [['en', 'Mainz v Freiburg']], 'season': [['en', '']], 'start_time': '2021-03-13T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-13T14:30:00Z', 'home': 'Mainz', 'away': 'Freiburg'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:55.575429Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.652', 'name': [['en', 'Real Madrid v Elche']], 'season': [['en', '']], 'start_time': '2021-03-13T15:15:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.606', 'name': [['en', 'Benevento v Fiorentina']], 'season': [['en', '']], 'start_time': '2021-03-13T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.605', 'name': [['en', 'Benevento v Fiorentina']], 'season': [['en', '']], 'start_time': '2021-03-13T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.535', 'name': [['en', 'Dortmund v Hertha']], 'season': [['en', '']], 'start_time': '2021-03-13T17:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'finished', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.536', 'name': [['en', 'Dortmund v Hertha']], 'season': [['en', '']], 'start_time': '2021-03-13T17:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.494', 'name': [['en', 'Osasuna v Valladolid']], 'season': [['en', '']], 'start_time': '2021-03-13T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.607', 'name': [['en', 'Genoa v Udinese']], 'season': [['en', '']], 'start_time': '2021-03-13T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'finished', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.608', 'name': [['en', 'Genoa v Udinese']], 'season': [['en', '']], 'start_time': '2021-03-13T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.493', 'name': [['en', 'Getafe v Ath Madrid']], 'season': [['en', '']], 'start_time': '2021-03-13T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.492', 'name': [['en', 'Getafe v Ath Madrid']], 'season': [['en', '']], 'start_time': '2021-03-13T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'finished', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.727', 'name': [['en', 'Bologna v Sampdoria']], 'season': [['en', '']], 'start_time': '2021-03-14T11:30:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T11:30:00Z', 'home': 'Bologna', 'away': 'Sampdoria'}, 'arguments': {'home_score': '3', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:56.397061Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.726', 'name': [['en', 'Bologna v Sampdoria']], 'season': [['en', '']], 'start_time': '2021-03-14T11:30:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T11:30:00Z', 'home': 'Bologna', 'away': 'Sampdoria'}, 'arguments': {'home_score': '3', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:56.460689Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.687', 'name': [['en', 'Southampton v Brighton']], 'season': [['en', '']], 'start_time': '2021-03-14T12:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'finished', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T12:00:00Z', 'home': 'Southampton', 'away': 'Brighton'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:56.464189Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.688', 'name': [['en', 'Southampton v Brighton']], 'season': [['en', '']], 'start_time': '2021-03-14T12:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T12:00:00Z', 'home': 'Southampton', 'away': 'Brighton'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:56.467013Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.673', 'name': [['en', 'Leverkusen v Bielefeld']], 'season': [['en', '']], 'start_time': '2021-03-14T12:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T12:30:00Z', 'home': 'Leverkusen', 'away': 'Bielefeld'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:56.540579Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.672', 'name': [['en', 'Leverkusen v Bielefeld']], 'season': [['en', '']], 'start_time': '2021-03-14T12:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T12:30:00Z', 'home': 'Leverkusen', 'away': 'Bielefeld'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:56.61041Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.660', 'name': [['en', 'Celta Vigo v Ath Bilbao']], 'season': [['en', '']], 'start_time': '2021-03-14T13:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.684', 'name': [['en', 'Leicester v Sheffield United']], 'season': [['en', '']], 'start_time': '2021-03-14T14:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T14:00:00Z', 'home': 'Leicester', 'away': 'Sheffield United'}, 'arguments': {'home_score': '5', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:56.692313Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.725', 'name': [['en', 'Parma Calcio 1913 v Roma']], 'season': [['en', '']], 'start_time': '2021-03-14T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T14:00:00Z', 'home': 'Parma Calcio 1913', 'away': 'Roma'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:56.757793Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.724', 'name': [['en', 'Torino v Inter']], 'season': [['en', '']], 'start_time': '2021-03-14T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.723', 'name': [['en', 'Torino v Inter']], 'season': [['en', '']], 'start_time': '2021-03-14T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.671', 'name': [['en', 'RasenBallsport Leipzig v Ein Frankfurt']], 'season': [['en', '']], 'start_time': '2021-03-14T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T14:30:00Z', 'home': 'RasenBallsport Leipzig', 'away': 'Ein Frankfurt'}, 'arguments': {'home_score': '1', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:56.97345Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.670', 'name': [['en', 'RasenBallsport Leipzig v Ein Frankfurt']], 'season': [['en', '']], 'start_time': '2021-03-14T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T14:30:00Z', 'home': 'RasenBallsport Leipzig', 'away': 'Ein Frankfurt'}, 'arguments': {'home_score': '1', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.060972Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.664', 'name': [['en', 'Granada v Sociedad']], 'season': [['en', '']], 'start_time': '2021-03-14T15:15:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T15:15:00Z', 'home': 'Granada', 'away': 'Sociedad'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.114467Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.663', 'name': [['en', 'Granada v Sociedad']], 'season': [['en', '']], 'start_time': '2021-03-14T15:15:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T15:15:00Z', 'home': 'Granada', 'away': 'Sociedad'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.164568Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.681', 'name': [['en', 'Arsenal v Tottenham']], 'season': [['en', '']], 'start_time': '2021-03-14T16:30:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T16:30:00Z', 'home': 'Arsenal', 'away': 'Tottenham'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.169648Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.682', 'name': [['en', 'Arsenal v Tottenham']], 'season': [['en', '']], 'start_time': '2021-03-14T16:30:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-14T16:30:00Z', 'home': 'Arsenal', 'away': 'Tottenham'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.17497Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.667', 'name': [['en', 'Cagliari v Juventus']], 'season': [['en', '']], 'start_time': '2021-03-14T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T17:00:00Z', 'home': 'Cagliari', 'away': 'Juventus'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:57.251487Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.668', 'name': [['en', 'Cagliari v Juventus']], 'season': [['en', '']], 'start_time': '2021-03-14T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T17:00:00Z', 'home': 'Cagliari', 'away': 'Juventus'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:57.32255Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.734', 'name': [['en', 'Stuttgart v Hoffenheim']], 'season': [['en', '']], 'start_time': '2021-03-14T17:00:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T17:00:00Z', 'home': 'Stuttgart', 'away': 'Hoffenheim'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.401101Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.735', 'name': [['en', 'Stuttgart v Hoffenheim']], 'season': [['en', '']], 'start_time': '2021-03-14T17:00:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-14T17:00:00Z', 'home': 'Stuttgart', 'away': 'Hoffenheim'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.474476Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.661', 'name': [['en', 'Eibar v Villarreal']], 'season': [['en', '']], 'start_time': '2021-03-14T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T17:30:00Z', 'home': 'Eibar', 'away': 'Villarreal'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:57.523987Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.662', 'name': [['en', 'Eibar v Villarreal']], 'season': [['en', '']], 'start_time': '2021-03-14T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T17:30:00Z', 'home': 'Eibar', 'away': 'Villarreal'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:57.583102Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.669', 'name': [['en', 'Milan v Napoli']], 'season': [['en', '']], 'start_time': '2021-03-14T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-14T19:45:00Z', 'home': 'Milan', 'away': 'Napoli'}, 'arguments': {'home_score': '0', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.653676Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.666', 'name': [['en', 'Sevilla v Betis']], 'season': [['en', '']], 'start_time': '2021-03-14T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T20:00:00Z', 'home': 'Sevilla', 'away': 'Betis'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.702612Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.665', 'name': [['en', 'Sevilla v Betis']], 'season': [['en', '']], 'start_time': '2021-03-14T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-14T20:00:00Z', 'home': 'Sevilla', 'away': 'Betis'}, 'arguments': {'home_score': '1', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.750823Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.715', 'name': [['en', 'Barcelona v Huesca']], 'season': [['en', '']], 'start_time': '2021-03-15T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-15T20:00:00Z', 'home': 'Barcelona', 'away': 'Huesca'}, 'arguments': {'home_score': '4', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:57.796495Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.728', 'name': [['en', 'Torino v Sassuolo']], 'season': [['en', '']], 'start_time': '2021-03-17T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-17T14:00:00Z', 'home': 'Torino', 'away': 'Sassuolo'}, 'arguments': {'home_score': '3', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:57.860354Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.729', 'name': [['en', 'Torino v Sassuolo']], 'season': [['en', '']], 'start_time': '2021-03-17T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-17T14:00:00Z', 'home': 'Torino', 'away': 'Sassuolo'}, 'arguments': {'home_score': '3', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:57.925802Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.716', 'name': [['en', 'Sevilla v Elche']], 'season': [['en', '']], 'start_time': '2021-03-17T18:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-17T18:00:00Z', 'home': 'Sevilla', 'away': 'Elche'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:57.970711Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.717', 'name': [['en', 'Sevilla v Elche']], 'season': [['en', '']], 'start_time': '2021-03-17T18:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-17T18:00:00Z', 'home': 'Sevilla', 'away': 'Elche'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.027846Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.674', 'name': [['en', 'Bielefeld v RasenBallsport Leipzig']], 'season': [['en', '']], 'start_time': '2021-03-19T19:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-19T19:30:00Z', 'home': 'Bielefeld', 'away': 'RasenBallsport Leipzig'}, 'arguments': {'home_score': '0', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:58.149687Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.675', 'name': [['en', 'Bielefeld v RasenBallsport Leipzig']], 'season': [['en', '']], 'start_time': '2021-03-19T19:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-19T19:30:00Z', 'home': 'Bielefeld', 'away': 'RasenBallsport Leipzig'}, 'arguments': {'home_score': '0', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:58.235135Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.730', 'name': [['en', 'Parma Calcio 1913 v Genoa']], 'season': [['en', '']], 'start_time': '2021-03-19T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-19T19:45:00Z', 'home': 'Parma Calcio 1913', 'away': 'Genoa'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.298623Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.718', 'name': [['en', 'Betis v Levante']], 'season': [['en', '']], 'start_time': '2021-03-19T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-19T20:00:00Z', 'home': 'Betis', 'away': 'Levante'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.344717Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.719', 'name': [['en', 'Betis v Levante']], 'season': [['en', '']], 'start_time': '2021-03-19T20:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-19T20:00:00Z', 'home': 'Betis', 'away': 'Levante'}, 'arguments': {'home_score': '2', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.403064Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.692', 'name': [['en', 'Fulham v Leeds']], 'season': [['en', '']], 'start_time': '2021-03-19T20:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-19T20:00:00Z', 'home': 'Fulham', 'away': 'Leeds'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.405637Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.691', 'name': [['en', 'Fulham v Leeds']], 'season': [['en', '']], 'start_time': '2021-03-19T20:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-19T20:00:00Z', 'home': 'Fulham', 'away': 'Leeds'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.409635Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.720', 'name': [['en', 'Ath Bilbao v Eibar']], 'season': [['en', '']], 'start_time': '2021-03-20T13:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T13:00:00Z', 'home': 'Ath Bilbao', 'away': 'Eibar'}, 'arguments': {'home_score': '1', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:58.460529Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.721', 'name': [['en', 'Ath Bilbao v Eibar']], 'season': [['en', '']], 'start_time': '2021-03-20T13:00:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T13:00:00Z', 'home': 'Ath Bilbao', 'away': 'Eibar'}, 'arguments': {'home_score': '1', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:58.507307Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.731', 'name': [['en', 'Crotone v Bologna']], 'season': [['en', '']], 'start_time': '2021-03-20T14:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-20T14:00:00Z', 'home': 'Crotone', 'away': 'Bologna'}, 'arguments': {'home_score': '2', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:58.566822Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.762', 'name': [['en', 'Werder Bremen v Wolfsburg']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'Werder Bremen', 'away': 'Wolfsburg'}, 'arguments': {'home_score': '1', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.630686Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.678', 'name': [['en', 'Ein Frankfurt v Union Berlin']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'Ein Frankfurt', 'away': 'Union Berlin'}, 'arguments': {'home_score': '5', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.768115Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.677', 'name': [['en', 'Bayern Munich v Stuttgart']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'Bayern Munich', 'away': 'Stuttgart'}, 'arguments': {'home_score': '4', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.84996Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.738', 'name': [['en', 'FC Koln v Dortmund']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'FC Koln', 'away': 'Dortmund'}, 'arguments': {'home_score': '2', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:58.917591Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.676', 'name': [['en', 'Bayern Munich v Stuttgart']], 'season': [['en', '']], 'start_time': '2021-03-20T14:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T14:30:00Z', 'home': 'Bayern Munich', 'away': 'Stuttgart'}, 'arguments': {'home_score': '4', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:58.986362Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.758', 'name': [['en', 'Celta Vigo v Real Madrid']], 'season': [['en', '']], 'start_time': '2021-03-20T15:15:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T15:15:00Z', 'home': 'Celta Vigo', 'away': 'Real Madrid'}, 'arguments': {'home_score': '1', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.029494Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.733', 'name': [['en', 'Spezia v Cagliari']], 'season': [['en', '']], 'start_time': '2021-03-20T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'upcoming', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-20T17:00:00Z', 'home': 'Spezia', 'away': 'Cagliari'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:59.088149Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.732', 'name': [['en', 'Spezia v Cagliari']], 'season': [['en', '']], 'start_time': '2021-03-20T17:00:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-20T17:00:00Z', 'home': 'Spezia', 'away': 'Cagliari'}, 'arguments': {'home_score': '2', 'away_score': '1'}, 'timestamp': '2021-03-29T06:47:59.143532Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.759', 'name': [['en', 'Huesca v Osasuna']], 'season': [['en', '']], 'start_time': '2021-03-20T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'in_progress', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T17:30:00Z', 'home': 'Huesca', 'away': 'Osasuna'}, 'arguments': {'home_score': '0', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:59.185056Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.760', 'name': [['en', 'Huesca v Osasuna']], 'season': [['en', '']], 'start_time': '2021-03-20T17:30:00', 'event_group_id': '1.21.9', 'scores': [], 'status': 'upcoming', 'event_group_name': 'LaLiga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'LaLiga', 'start_time': '2021-03-20T17:30:00Z', 'home': 'Huesca', 'away': 'Osasuna'}, 'arguments': {'home_score': '0', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:59.226237Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.736', 'name': [['en', 'Schalke 04 v Mönchengladbach']], 'season': [['en', '']], 'start_time': '2021-03-20T17:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'in_progress', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T17:30:00Z', 'home': 'Schalke 04', 'away': 'Mönchengladbach'}, 'arguments': {'home_score': '0', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.293945Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.737', 'name': [['en', 'Schalke 04 v Mönchengladbach']], 'season': [['en', '']], 'start_time': '2021-03-20T17:30:00', 'event_group_id': '1.21.23', 'scores': [], 'status': 'upcoming', 'event_group_name': 'Bundesliga', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'Bundesliga', 'start_time': '2021-03-20T17:30:00Z', 'home': 'Schalke 04', 'away': 'Mönchengladbach'}, 'arguments': {'home_score': '0', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.364111Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.761', 'name': [['en', 'Inter v Sassuolo']], 'season': [['en', '']], 'start_time': '2021-03-20T19:45:00', 'event_group_id': '1.21.14', 'scores': [], 'status': 'in_progress', 'event_group_name': 'SerieA', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'SerieA', 'start_time': '2021-03-20T19:45:00Z', 'home': 'Inter', 'away': 'Sassuolo'}, 'arguments': {'whistle_start_time': '2021-03-20T19:45:00Z', 'season': ''}, 'timestamp': '2021-03-29T06:47:59.419867Z', 'call': 'canceled'}}, {'eventFromChain': {'id': '1.22.693', 'name': [['en', 'Brighton v Newcastle']], 'season': [['en', '']], 'start_time': '2021-03-20T20:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-20T20:00:00Z', 'home': 'Brighton', 'away': 'Newcastle'}, 'arguments': {'home_score': '3', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:59.42212Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.694', 'name': [['en', 'Brighton v Newcastle']], 'season': [['en', '']], 'start_time': '2021-03-20T20:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-20T20:00:00Z', 'home': 'Brighton', 'away': 'Newcastle'}, 'arguments': {'home_score': '3', 'away_score': '0'}, 'timestamp': '2021-03-29T06:47:59.423875Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.747', 'name': [['en', 'West Ham v Arsenal']], 'season': [['en', '']], 'start_time': '2021-03-21T15:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'upcoming', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-21T15:00:00Z', 'home': 'West Ham', 'away': 'Arsenal'}, 'arguments': {'home_score': '3', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.4243Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.746', 'name': [['en', 'West Ham v Arsenal']], 'season': [['en', '']], 'start_time': '2021-03-21T15:00:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-21T15:00:00Z', 'home': 'West Ham', 'away': 'Arsenal'}, 'arguments': {'home_score': '3', 'away_score': '3'}, 'timestamp': '2021-03-29T06:47:59.424729Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.745', 'name': [['en', 'Aston Villa v Tottenham']], 'season': [['en', '']], 'start_time': '2021-03-21T19:30:00', 'event_group_id': '1.21.8', 'scores': [], 'status': 'in_progress', 'event_group_name': 'EPL', 'sport': 'Soccer'}, 'eventFromFeed': {'id': {'sport': 'Soccer', 'event_group_name': 'EPL', 'start_time': '2021-03-21T19:30:00Z', 'home': 'Aston Villa', 'away': 'Tottenham'}, 'arguments': {'home_score': '0', 'away_score': '2'}, 'timestamp': '2021-03-29T06:47:59.425529Z', 'call': 'result'}}, {'eventFromChain': {'id': '1.22.772', 'name': [['en', 'Utah Jazz @ Golden State Warriors']], 'season': [['en', '']], 'start_time': '2021-03-23T10:30:00', 'event_group_id': '1.21.5', 'scores': [], 'status': 'in_progress', 'event_group_name': 'NBA Regular Season', 'sport': 'Basketball'}, 'eventFromFeed': None}, {'eventFromChain': {'id': '1.22.773', 'name': [['en', 'Denver Broncos @ Cincinnati Bengals']], 'season': [['en', '']], 'start_time': '2021-03-23T16:30:00', 'event_group_id': '1.21.16', 'scores': [], 'status': 'in_progress', 'event_group_name': 'NFL Regular Season', 'sport': 'AmericanFootball'}, 'eventFromFeed': None}] return newDict - + + def UpdateListVersionOne(request): ''' param : request @@ -192,6 +193,66 @@ def CreateList(request,num=1): return render(request, 'login.html') + +def LoadSelectOptions(request): + ''' + param-1 : request + param-2 : The values needed are posted from create_cp html page + num - represents game , group , home , away and time in integer representation + ''' + + num = request.POST.get("num") + if num == None: + num = 1 # Fisrt page loading the num is set as 1 + else: + num = int(num) + + if index_page_permitted(request): + list_values = {} + start_val = 1 + heading = '' + is_last = False + if num == 1: + games = GetEvents() + list_values = dict(enumerate(games , start=start_val)) + heading = "Select Games" + return render(request, 'create_cp.html', {"list" : list_values , 'heading' : heading , "islast":is_last,'question_id':num}) + if num == 2: + request.session['sport'] = request.POST.get("sport").strip() + + params = {'sport':request.session['sport']} + sport = GetEvents(params) + heading = "Select Event Groups" + list_values = dict(enumerate(sport , start=start_val)) + return JsonResponse({"list" :list_values,"islast":is_last,'question_id':num }) + if num == 3: + request.session['sport'] = request.POST.get("sport").strip() + request.session['eventGroup'] = request.POST.get('eventGroup').strip() + + params = {"sport":request.POST.get("sport").strip(),"eventGroup":request.POST.get('eventGroup').strip()} + teams = GetEvents(params) + heading = "Home" + list_values = dict(enumerate(teams , start=start_val)) + return JsonResponse({"list" :list_values,"islast":is_last,'question_id':num }) + if num == 4: + request.session['sport'] = request.POST.get("sport").strip() + request.session['eventGroup'] = request.POST.get('eventGroup').strip() + request.session['home'] = request.POST.get('home').strip() + + params ={"sport":request.POST.get("sport").strip(),"eventGroup":request.POST.get('eventGroup').strip()} + teams = GetEvents(params) + heading = "Away" + list_values = dict(enumerate(teams , start=start_val)) + return JsonResponse({"list" :list_values,"islast":is_last,'question_id':num }) + if num == 5: + heading = "Time" + is_last = True + request.session['away'] = request.POST.get('away').strip() + return JsonResponse({"list" :list_values,"islast":is_last,'question_id':num }) + + elif register_login_page_permitted(): + return render(request, 'login.html') + def CreatePost(request): ''' param : request @@ -217,7 +278,7 @@ def CreatePost(request): "username":username} print("Data " , data) result = CreatePotato(data) - + result if(len(result) > 0 and 'error' not in result): return JsonResponse({'success':'Posted'}) else: From 94a50ccae049a2ade15cacf532bf38de2f2e66e8 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Thu, 8 Apr 2021 16:56:47 +0530 Subject: [PATCH 11/15] Removed json displaying columns --- couchpotato/home/templates/create_cp.html | 279 +++++++++++ couchpotato/home/templates/index.html | 2 +- couchpotato/home/templates/update_debug.html | 452 +++++++++++++++++ couchpotato/home/templates/update_simple.html | 461 ++++++++++++++++++ couchpotato/home/urls.py | 3 +- couchpotato/home/views.py | 29 +- 6 files changed, 1218 insertions(+), 8 deletions(-) create mode 100644 couchpotato/home/templates/create_cp.html create mode 100644 couchpotato/home/templates/update_debug.html create mode 100644 couchpotato/home/templates/update_simple.html diff --git a/couchpotato/home/templates/create_cp.html b/couchpotato/home/templates/create_cp.html new file mode 100644 index 0000000..c9c8130 --- /dev/null +++ b/couchpotato/home/templates/create_cp.html @@ -0,0 +1,279 @@ + + + + + + + + + + + + + + + + + Couch Potato + + + + + + {% include "navbar.html" %} + + + +
+ +

+ + +
+ +

+ +
+ +
+

Select games

+ +
+
+ + +
+

Select Group

+ +
+
+ +
+

Home

+ +
+
+ +
+

Away

+ +
+
+ + + +
+

Away

+ + + +
+ +
+ + + + +
+
+ +
+ + + + + +
+ + + + + + + + Return to Home + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/couchpotato/home/templates/index.html b/couchpotato/home/templates/index.html index 0935fb8..ebf0fe1 100644 --- a/couchpotato/home/templates/index.html +++ b/couchpotato/home/templates/index.html @@ -31,7 +31,7 @@

diff --git a/couchpotato/home/templates/update_debug.html b/couchpotato/home/templates/update_debug.html new file mode 100644 index 0000000..9fd8e86 --- /dev/null +++ b/couchpotato/home/templates/update_debug.html @@ -0,0 +1,452 @@ + + + + + Couch Potato + + + + + + + + + + + + + + {% include "navbar.html" %} + +
+
+ +

+ + + + +
+ + + + + + + + + + + + + + + + + + {% for a , b in data.items %} + + + + + + + + + + + + + + + + + + + + {% endfor %} + + + +
Event on ChainEventUpdate from FeedFeedScoresCallStart Time in Local Time
+ {{b.eventFromChain}} + +
    +
  • + {{b.eventFromChain.name.0.1}} +
  • +
  • + {{b.eventFromChain.start_time}} +
  • +
  • + {{b.eventFromChain.scores}} +
  • +
  • + {{b.eventFromChain.status}} +
  • +
  • + {{b.eventFromChain.sport}} +
  • +
+ + +
+ {{b.eventFromFeed}} + + {% if b.eventFromFeed is not none%} +
    +
  • + {{b.eventFromFeed.id.sport}} +
  • +
  • + {{b.eventFromFeed.id.start_time}} +
  • +
  • + {{b.eventFromFeed.id.home}} +
  • +
  • + {{b.eventFromFeed.id.away}} +
  • +
  • + {{b.eventFromFeed.arguments.home_score}} +
  • +
  • + {{b.eventFromFeed.arguments.away_score}} +
  • +
  • + {{b.eventFromFeed.call}} +
  • +
+ {% endif %} +
+ Home Score : +

+ Away Score : +
+

+ +

+ +

+ + +
+ + + + + Return to Home + +
+ + +
+
+ + + + + + + + + + + + + + + + + + diff --git a/couchpotato/home/templates/update_simple.html b/couchpotato/home/templates/update_simple.html new file mode 100644 index 0000000..3ae8236 --- /dev/null +++ b/couchpotato/home/templates/update_simple.html @@ -0,0 +1,461 @@ + + + + + Couch Potato + + + + + + + + + + + + + + {% include "navbar.html" %} + +
+
+ +

+ + + + +
+ + + + + + + + + + + + + + + + {% for a , b in data.items %} + + + + + + + + + + + + + + + + + + + + {% endfor %} + + + +
EventEvent on ChainFeedUpdate from FeedScoresCallStart Time in Local Time
+ {{b.eventFromChain}} + +
    +
  • + {{b.eventFromChain.name.0.1}} +
  • +
  • + {{b.eventFromChain.start_time}} +
  • +
  • + {{b.eventFromChain.scores}} +
  • +
  • + {{b.eventFromChain.status}} +
  • +
  • + {{b.eventFromChain.sport}} +
  • +
+ + +
+ {{b.eventFromFeed}} + + {% if b.eventFromFeed is not none%} +
    +
  • + {{b.eventFromFeed.id.sport}} +
  • +
  • + {{b.eventFromFeed.id.start_time}} +
  • +
  • + {{b.eventFromFeed.id.home}} +
  • +
  • + {{b.eventFromFeed.id.away}} +
  • +
  • + {{b.eventFromFeed.arguments.home_score}} +
  • +
  • + {{b.eventFromFeed.arguments.away_score}} +
  • +
  • + {{b.eventFromFeed.call}} +
  • +
+ {% endif %} +
+ Home Score : +

+ Away Score : +
+

+ +

+ +

+ + +
+ + + + + Return to Home + +
+ + +
+
+ + + + + + + + + + + + + + + + + + diff --git a/couchpotato/home/urls.py b/couchpotato/home/urls.py index e6fd8da..989743b 100644 --- a/couchpotato/home/urls.py +++ b/couchpotato/home/urls.py @@ -14,7 +14,8 @@ path('create/', views.CreateList, name='create'), path('select/', views.LoadSelectOptions, name='createselect'), path('u/', views.UpdateList, name='update_new'), - path('uv/', views.UpdateListVersionOne, name='updateversion1'), + path('udebug/', views.UpdateListForDebug, name='udebug'), + path('usimple/', views.UpdateListSimple, name='udebug'), path('settingspanel/', views.admin, name='admin'), path('save_features', views.SaveApplicationFeatures, name='savefeatures'), path('delete_user', views.DeleteUser, name='delete_user'), diff --git a/couchpotato/home/views.py b/couchpotato/home/views.py index d674794..e4a834c 100644 --- a/couchpotato/home/views.py +++ b/couchpotato/home/views.py @@ -115,7 +115,7 @@ def getstaticEvents(): return newDict -def UpdateListVersionOne(request): +def UpdateListForDebug(request): ''' param : request description : To load update page @@ -124,15 +124,32 @@ def UpdateListVersionOne(request): if index_page_permitted(request): params = {'filter':'events'} # events = getstaticEvents() - # print(events) events = GetMatchingEvents() - # print(events) - # events = [] - # events = None list_values = {} if events is not None: list_values = dict(enumerate(events , start=1)) - return render(request, 'update_match_events.html',{"data": list_values}) + return render(request, 'update_debug.html',{"data": list_values}) + else: + return render(request, 'login.html') + except: + return render(request, '404.html') + + + +def UpdateListSimple(request): + ''' + param : request + description : To load update page + ''' + try: + if index_page_permitted(request): + params = {'filter':'events'} + # events = getstaticEvents() + events = GetMatchingEvents() + list_values = {} + if events is not None: + list_values = dict(enumerate(events , start=1)) + return render(request, 'update_simple.html',{"data": list_values}) else: return render(request, 'login.html') except: From 1758889b33aeeaf3447e4ce12e97096fc922cf8c Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Fri, 9 Apr 2021 15:00:48 +0530 Subject: [PATCH 12/15] Name corrections --- couchpotato/home/templates/create_cp.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/couchpotato/home/templates/create_cp.html b/couchpotato/home/templates/create_cp.html index c9c8130..9e560b1 100644 --- a/couchpotato/home/templates/create_cp.html +++ b/couchpotato/home/templates/create_cp.html @@ -43,7 +43,7 @@

-

Select games

+

Select Sport

@@ -82,7 +82,7 @@

Away

-

Away

+

Start Time

From e41b8c818496a295be11cf0cb5582aa7e94949d7 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Fri, 9 Apr 2021 17:14:36 +0530 Subject: [PATCH 13/15] Event group name in event from chain --- couchpotato/home/templates/update_debug.html | 6 ++++++ couchpotato/home/templates/update_simple.html | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/couchpotato/home/templates/update_debug.html b/couchpotato/home/templates/update_debug.html index 9fd8e86..2ec9fd9 100644 --- a/couchpotato/home/templates/update_debug.html +++ b/couchpotato/home/templates/update_debug.html @@ -95,6 +95,9 @@

  • {{b.eventFromChain.status}}
  • +
  • + {{b.eventFromChain.event_group_name}} +
  • {{b.eventFromChain.sport}}
  • @@ -111,6 +114,9 @@

  • {{b.eventFromFeed.id.sport}}
  • +
  • + {{b.eventFromFeed.id.event_group_name}} +
  • {{b.eventFromFeed.id.start_time}}
  • diff --git a/couchpotato/home/templates/update_simple.html b/couchpotato/home/templates/update_simple.html index 3ae8236..878aea0 100644 --- a/couchpotato/home/templates/update_simple.html +++ b/couchpotato/home/templates/update_simple.html @@ -93,6 +93,9 @@

  • {{b.eventFromChain.status}}
  • +
  • + {{b.eventFromChain.event_group_name}} +
  • {{b.eventFromChain.sport}}
  • @@ -109,6 +112,9 @@

  • {{b.eventFromFeed.id.sport}}
  • +
  • + {{b.eventFromFeed.id.event_group_name}} +
  • {{b.eventFromFeed.id.start_time}}
  • From a3d90a6dcb4ce92d94d12d98732f065a59d86161 Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Mon, 12 Apr 2021 14:50:47 +0530 Subject: [PATCH 14/15] Handshake with chain for max open proposals and restrict open proposals --- couchpotato/cp_local.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/couchpotato/cp_local.py b/couchpotato/cp_local.py index d908110..9041204 100644 --- a/couchpotato/cp_local.py +++ b/couchpotato/cp_local.py @@ -68,6 +68,7 @@ class Teams: class Cp(): def __init__(self): + self.maxOpenProposals = 2 self.delayBetweenBosPushes = 1 # in seconds self.bookiesports = BookieSports(chainName) pass @@ -262,7 +263,7 @@ def EventsAllWithEventGroupName(self, eventsAll): eventGroup = rpc.get_object(event_group_id) event["event_group_name"] = dict(eventGroup["name"])["identifier"] - # event["event_group_name"] = eventGroup["name"][1][1] + # event["event_group_name"] = eventGroup["name"][1][1] sport = rpc.get_object(eventGroup["sport_id"]) sport = dict(sport["name"])["identifier"] event["sport"] = sport @@ -666,6 +667,14 @@ def Push2bosMethod(self, incident, providerName): self._incident = incident logger.info(str(incident)) + while True: + proposalsOpen = rpc.get_proposed_transactions("1.2.1") + print("Len proposalsOpen: ", len(proposalsOpen), " / ", "self.maxOpenProposals") + if len(proposalsOpen) <= self.maxOpenProposals: + break + else: + time.sleep(60) + # r = requests.post(url=bos["local"], json=incident) rng = np.random.default_rng() lBosApis = len(bosApis) From cce8880679c4f6999378f7e609c65e5423d43cbc Mon Sep 17 00:00:00 2001 From: Jemshid KK Date: Wed, 14 Apr 2021 15:00:34 +0530 Subject: [PATCH 15/15] minor --- couchpotato/cp_local.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/couchpotato/cp_local.py b/couchpotato/cp_local.py index 9041204..09cf5be 100644 --- a/couchpotato/cp_local.py +++ b/couchpotato/cp_local.py @@ -187,13 +187,13 @@ def CliManufactureCreateIncident(self): print("Select Event Group") self._eventGroup = self.GetKey(self._eventGroupsList) self._eventGroupIdentifier = self.bookiesports[self._sport][ - "eventgroups"][self._eventGroup]["identifier"] + "eventgroups"][self._eventGroup]["identifier"] # self._eventGroupIdentifier = self.bookiesports[self._sport][ # "eventgroups"][self._eventGroup]["aliases"][0] self._participantKey = self.bookiesports[self._sport]["eventgroups"][ self._eventGroup]["participants"] self._participants, participantDisplays = self.GetParticipants( - self._sport, self._participantKey) + self._sport, self._participantKey) print("") print("Select Home Team") self._home = self.GetKeyParticipant( @@ -259,7 +259,7 @@ def EventsAllWithEventGroupName(self, eventsAll): for event in eventsAll: event_group_id = event["event_group_id"] # event["event_group_name"] = rpc.get_object( - # event_group_id)["name"][1][1] + # event_group_id)["name"][1][1] eventGroup = rpc.get_object(event_group_id) event["event_group_name"] = dict(eventGroup["name"])["identifier"] @@ -669,7 +669,8 @@ def Push2bosMethod(self, incident, providerName): while True: proposalsOpen = rpc.get_proposed_transactions("1.2.1") - print("Len proposalsOpen: ", len(proposalsOpen), " / ", "self.maxOpenProposals") + print("Len proposalsOpen: ", + len(proposalsOpen), " / ", self.maxOpenProposals) if len(proposalsOpen) <= self.maxOpenProposals: break else: @@ -694,6 +695,11 @@ def Push2bosMethod(self, incident, providerName): print("thread finished") return + def OpenProposalsCount(self): + openProposalsCount = rpc.get_proposed_transactions("1.2.1") + return openProposalsCount, self.maxOpenProposals + + def Push2bosBetter(self, incident, providerNames): string = incident_to_string(incident) self._string = string