Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
1c9cdf497b
|
@ -34,6 +34,7 @@ def australiaStrat(context : Context) -> Prediction:
|
||||||
t = datetime.now().astimezone(australia)
|
t = datetime.now().astimezone(australia)
|
||||||
hour = t.hour
|
hour = t.hour
|
||||||
p = Prediction()
|
p = Prediction()
|
||||||
|
p.weight = 1.0
|
||||||
|
|
||||||
if hour > 22 or hour < 6:
|
if hour > 22 or hour < 6:
|
||||||
p.probability = 0.0
|
p.probability = 0.0
|
||||||
|
@ -51,7 +52,7 @@ def tv2newsStrat(context : Context) -> Prediction:
|
||||||
r = requests.get('http://mpx.services.tv2.dk/api/latest')
|
r = requests.get('http://mpx.services.tv2.dk/api/latest')
|
||||||
|
|
||||||
data = r.json()
|
data = r.json()
|
||||||
publish_dates = [(x['pubDate'])//1000 for x in data][:10]
|
publish_dates = [(x['pubDate'])//1000 for x in data[:5]]
|
||||||
delta_times = []
|
delta_times = []
|
||||||
for i in range(len(publish_dates)):
|
for i in range(len(publish_dates)):
|
||||||
if i == 0 : continue
|
if i == 0 : continue
|
||||||
|
@ -66,6 +67,7 @@ def tv2newsStrat(context : Context) -> Prediction:
|
||||||
p.weight = 0.0
|
p.weight = 0.0
|
||||||
else:
|
else:
|
||||||
p.weight = 0.7
|
p.weight = 0.7
|
||||||
p.probability = 1.0 if avg_timestamp > 50 else 0.0
|
print(avg_timestamp)
|
||||||
p.reasons.append('There were ' + ('few' if avg_timestamp > 50 else 'many') + ' recent articles on TV2 News')
|
p.probability = 0.75 if avg_timestamp > 40 else 0.25
|
||||||
|
p.reasons.append('There were ' + ('few' if avg_timestamp > 40 else 'many') + ' recent articles on TV2 News')
|
||||||
return p
|
return p
|
||||||
|
|
Loading…
Reference in a new issue