diff --git a/dota2players.png b/dota2players.png new file mode 100644 index 0000000..0574926 Binary files /dev/null and b/dota2players.png differ diff --git a/server/nightr/app.py b/server/nightr/app.py index 23bd1ae..5518050 100644 --- a/server/nightr/app.py +++ b/server/nightr/app.py @@ -10,7 +10,7 @@ from typing import List import requests_cache from flask import Flask, jsonify, logging, request -from .strategies import miloStrats, iss, cars_in_traffic, tide_strat, upstairs_neighbour, bing, svm_strat, battery, just_eat +from .strategies import miloStrats, iss, cars_in_traffic, tide_strat, upstairs_neighbour, bing, svm_strat, battery, just_eat, steam from .util import Context app = Flask(__name__) @@ -33,6 +33,7 @@ strategies = { "ML Parking": svm_strat.perform_svm_pred, "Phone Battery Level": battery.battery_level, "Pizza Availability": just_eat.do_just_eat_strat, + "Steam Players Online": steam.dota2_players, } diff --git a/server/nightr/strategies/dotaplayers 2019-04-06 13:43:33.074496.csv b/server/nightr/strategies/dotaplayers 2019-04-06 13:43:33.074496.csv new file mode 100644 index 0000000..ab3ce70 --- /dev/null +++ b/server/nightr/strategies/dotaplayers 2019-04-06 13:43:33.074496.csv @@ -0,0 +1,503 @@ +802699, 2019-04-06 13:43:33.332169 +802699, 2019-04-06 13:45:13.758896 +802699, 2019-04-06 13:46:54.123806 +806961, 2019-04-06 13:48:34.392685 +806961, 2019-04-06 13:50:14.756771 +806961, 2019-04-06 13:51:55.284575 +817829, 2019-04-06 13:53:35.601536 +817829, 2019-04-06 13:55:15.853206 +817829, 2019-04-06 13:56:56.110445 +826993, 2019-04-06 13:58:36.388915 +826993, 2019-04-06 14:00:16.712447 +826993, 2019-04-06 14:01:56.991208 +835412, 2019-04-06 14:03:37.267658 +835412, 2019-04-06 14:05:17.582790 +835412, 2019-04-06 14:06:57.894870 +843579, 2019-04-06 14:08:38.217438 +843579, 2019-04-06 14:10:18.478943 +843579, 2019-04-06 14:11:58.823380 +851099, 2019-04-06 14:13:39.107719 +851099, 2019-04-06 14:15:19.407271 +851099, 2019-04-06 14:16:59.768922 +858280, 2019-04-06 14:18:40.028920 +858280, 2019-04-06 14:20:20.376620 +858280, 2019-04-06 14:22:00.717846 +860683, 2019-04-06 14:23:41.078958 +860683, 2019-04-06 14:25:21.306586 +860683, 2019-04-06 14:27:01.901174 +862913, 2019-04-06 14:28:42.179871 +862913, 2019-04-06 14:30:22.525303 +862913, 2019-04-06 14:32:02.837681 +868951, 2019-04-06 14:33:43.161152 +868951, 2019-04-06 14:35:24.081461 +868951, 2019-04-06 14:37:04.443059 +876382, 2019-04-06 14:38:44.830021 +876382, 2019-04-06 14:40:25.148194 +876382, 2019-04-06 14:42:05.443729 +883678, 2019-04-06 14:43:45.779944 +883678, 2019-04-06 14:45:27.268935 +883678, 2019-04-06 14:47:07.617904 +891939, 2019-04-06 14:48:47.880107 +891939, 2019-04-06 14:50:28.154432 +891939, 2019-04-06 14:52:08.653249 +899694, 2019-04-06 14:53:49.028948 +899694, 2019-04-06 14:55:29.339603 +899694, 2019-04-06 14:57:09.666755 +907092, 2019-04-06 14:58:50.172190 +907092, 2019-04-06 15:00:30.623624 +907092, 2019-04-06 15:02:11.024506 +915057, 2019-04-06 15:03:51.299773 +915057, 2019-04-06 15:05:31.662454 +915057, 2019-04-06 15:07:12.014278 +922052, 2019-04-06 15:08:52.595478 +922052, 2019-04-06 15:10:32.941813 +922052, 2019-04-06 15:12:13.209247 +699489, 2019-04-06 15:13:53.507769 +699489, 2019-04-06 15:15:33.767500 +699489, 2019-04-06 15:17:14.122305 +514301, 2019-04-06 15:18:54.408753 +514301, 2019-04-06 15:20:34.748198 +514301, 2019-04-06 15:22:15.038429 +606707, 2019-04-06 15:23:55.369471 +606707, 2019-04-06 15:25:35.732148 +606707, 2019-04-06 15:27:16.973323 +620931, 2019-04-06 15:28:57.282228 +620931, 2019-04-06 15:30:37.610226 +620931, 2019-04-06 15:32:17.910534 +605731, 2019-04-06 15:33:58.284234 +605731, 2019-04-06 15:35:38.827963 +605731, 2019-04-06 15:37:19.227167 +652559, 2019-04-06 15:38:59.582760 +652559, 2019-04-06 15:40:39.870273 +652559, 2019-04-06 15:42:20.203135 +719116, 2019-04-06 15:44:00.539446 +719116, 2019-04-06 15:45:40.874284 +719116, 2019-04-06 15:47:21.218625 +750968, 2019-04-06 15:49:01.510671 +750968, 2019-04-06 15:50:41.768632 +750968, 2019-04-06 15:52:22.067010 +777380, 2019-04-06 15:54:02.374230 +777380, 2019-04-06 15:55:42.844328 +777380, 2019-04-06 15:57:23.547646 +802885, 2019-04-06 15:59:03.915407 +802885, 2019-04-06 16:00:44.241442 +802885, 2019-04-06 16:02:24.635517 +828004, 2019-04-06 16:04:05.023963 +828004, 2019-04-06 16:05:45.372794 +828004, 2019-04-06 16:07:26.203482 +853739, 2019-04-06 16:09:06.531090 +853739, 2019-04-06 16:10:46.972256 +853739, 2019-04-06 16:12:27.307781 +877420, 2019-04-06 16:14:07.640466 +877420, 2019-04-06 16:15:47.994871 +877420, 2019-04-06 16:17:28.325234 +898242, 2019-04-06 16:19:08.661926 +898242, 2019-04-06 16:20:48.917945 +898242, 2019-04-06 16:22:29.182327 +913637, 2019-04-06 16:24:09.525105 +913637, 2019-04-06 16:25:49.836497 +913637, 2019-04-06 16:27:30.099844 +922197, 2019-04-06 16:29:10.389838 +922197, 2019-04-06 16:30:50.718004 +922197, 2019-04-06 16:32:31.051622 +924022, 2019-04-06 16:34:11.412363 +924022, 2019-04-06 16:35:51.747326 +924022, 2019-04-06 16:37:32.061187 +926340, 2019-04-06 16:39:12.348965 +926340, 2019-04-06 16:40:52.647026 +926340, 2019-04-06 16:42:32.879656 +929752, 2019-04-06 16:44:13.411435 +929752, 2019-04-06 16:45:53.687292 +929752, 2019-04-06 16:47:34.280324 +932083, 2019-04-06 16:49:14.621290 +932083, 2019-04-06 16:50:54.966434 +932083, 2019-04-06 16:52:35.248581 +934458, 2019-04-06 16:54:15.540391 +934458, 2019-04-06 16:55:55.815100 +934458, 2019-04-06 16:57:36.132284 +933348, 2019-04-06 16:59:16.447400 +933348, 2019-04-06 17:00:56.769136 +933348, 2019-04-06 17:02:37.331318 +939918, 2019-04-06 17:04:17.574129 +939918, 2019-04-06 17:05:57.888246 +939918, 2019-04-06 17:07:38.125416 +938653, 2019-04-06 17:09:18.499184 +938653, 2019-04-06 17:10:58.810176 +938653, 2019-04-06 17:12:39.189605 +933199, 2019-04-06 17:14:19.526273 +933199, 2019-04-06 17:15:59.878906 +933199, 2019-04-06 17:17:40.175536 +927323, 2019-04-06 17:19:20.483630 +927323, 2019-04-06 17:21:00.796619 +927323, 2019-04-06 17:22:41.099582 +919408, 2019-04-06 17:24:21.380890 +919408, 2019-04-06 17:26:01.756501 +919408, 2019-04-06 17:27:42.149449 +907119, 2019-04-06 17:29:22.494907 +907119, 2019-04-06 17:31:02.819752 +907119, 2019-04-06 17:32:43.139901 +884967, 2019-04-06 17:34:23.466777 +884967, 2019-04-06 17:36:03.982359 +884967, 2019-04-06 17:37:44.355905 +885270, 2019-04-06 17:39:24.699801 +885270, 2019-04-06 17:41:05.137427 +885270, 2019-04-06 17:42:45.501512 +882575, 2019-04-06 17:44:25.892088 +882575, 2019-04-06 17:46:06.158309 +882575, 2019-04-06 17:47:46.490474 +879112, 2019-04-06 17:49:26.889569 +879112, 2019-04-06 17:51:07.206166 +879112, 2019-04-06 17:52:47.509160 +875135, 2019-04-06 17:54:27.976421 +875135, 2019-04-06 17:56:08.298799 +875135, 2019-04-06 17:57:48.618134 +870733, 2019-04-06 17:59:28.974139 +870733, 2019-04-06 18:01:09.334564 +870733, 2019-04-06 18:02:49.713344 +863212, 2019-04-06 18:04:29.988879 +863212, 2019-04-06 18:06:10.269848 +863212, 2019-04-06 18:07:50.601019 +855066, 2019-04-06 18:09:30.977247 +855066, 2019-04-06 18:11:11.253610 +855066, 2019-04-06 18:12:51.680809 +835475, 2019-04-06 18:14:31.960045 +835475, 2019-04-06 18:16:12.348233 +835475, 2019-04-06 18:17:52.614026 +556795, 2019-04-06 18:19:32.933302 +556795, 2019-04-06 18:21:13.251305 +556795, 2019-04-06 18:22:53.564941 +609003, 2019-04-06 18:24:33.869347 +609003, 2019-04-06 18:26:14.166354 +609003, 2019-04-06 18:27:54.395113 +585072, 2019-04-06 18:29:34.701975 +585072, 2019-04-06 18:31:15.109758 +585072, 2019-04-06 18:32:55.396105 +554796, 2019-04-06 18:34:35.689463 +554796, 2019-04-06 18:36:15.939518 +554796, 2019-04-06 18:37:56.493138 +521831, 2019-04-06 18:39:36.777269 +521831, 2019-04-06 18:41:17.062348 +521831, 2019-04-06 18:42:57.417617 +491189, 2019-04-06 18:44:37.688640 +491189, 2019-04-06 18:46:18.061217 +491189, 2019-04-06 18:47:58.362396 +463493, 2019-04-06 18:49:38.668128 +463493, 2019-04-06 18:51:18.996385 +463493, 2019-04-06 18:52:59.270369 +441630, 2019-04-06 18:54:39.581236 +441630, 2019-04-06 18:56:19.898320 +441630, 2019-04-06 18:58:00.158237 +425491, 2019-04-06 18:59:40.475140 +425491, 2019-04-06 19:01:20.793092 +425491, 2019-04-06 19:03:01.157877 +416226, 2019-04-06 19:04:41.427031 +416226, 2019-04-06 19:06:21.791312 +416226, 2019-04-06 19:08:02.177094 +410502, 2019-04-06 19:09:42.534601 +410502, 2019-04-06 19:11:22.842812 +410502, 2019-04-06 19:13:03.272357 +416027, 2019-04-06 19:14:43.539420 +416027, 2019-04-06 19:16:23.872437 +416027, 2019-04-06 19:18:04.186408 +472546, 2019-04-06 19:19:44.498614 +472546, 2019-04-06 19:21:24.779738 +472546, 2019-04-06 19:23:05.161128 +508738, 2019-04-06 19:24:45.442220 +508738, 2019-04-06 19:26:25.827770 +508738, 2019-04-06 19:28:06.183324 +532803, 2019-04-06 19:29:47.118153 +532803, 2019-04-06 19:31:27.448565 +532803, 2019-04-06 19:33:07.763453 +543866, 2019-04-06 19:34:48.062031 +543866, 2019-04-06 19:36:28.353341 +554692, 2019-04-06 19:38:08.646609 +554692, 2019-04-06 19:39:48.968800 +554692, 2019-04-06 19:41:29.301886 +554692, 2019-04-06 19:43:10.376473 +568382, 2019-04-06 19:44:50.942213 +568382, 2019-04-06 19:46:31.247436 +568382, 2019-04-06 19:48:11.595915 +582210, 2019-04-06 19:49:51.969426 +582210, 2019-04-06 19:51:32.243656 +597090, 2019-04-06 19:53:12.541395 +597090, 2019-04-06 19:54:52.844378 +597090, 2019-04-06 19:56:33.127900 +611489, 2019-04-06 19:58:13.529511 +611489, 2019-04-06 19:59:53.885530 +611489, 2019-04-06 20:01:34.161961 +622050, 2019-04-06 20:03:14.542687 +622050, 2019-04-06 20:04:54.820390 +622050, 2019-04-06 20:06:35.192982 +623425, 2019-04-06 20:08:15.536106 +623425, 2019-04-06 20:09:55.847601 +623425, 2019-04-06 20:11:36.139389 +623425, 2019-04-06 20:13:16.436965 +618773, 2019-04-06 20:14:56.803295 +618773, 2019-04-06 20:16:37.086085 +618773, 2019-04-06 20:18:17.414073 +616688, 2019-04-06 20:19:57.721937 +616688, 2019-04-06 20:21:38.116725 +606741, 2019-04-06 20:23:18.495936 +606741, 2019-04-06 20:24:58.848854 +606741, 2019-04-06 20:26:39.200899 +605829, 2019-04-06 20:28:19.450059 +605829, 2019-04-06 20:29:59.801893 +605829, 2019-04-06 20:31:40.108172 +598957, 2019-04-06 20:33:20.404443 +598957, 2019-04-06 20:35:00.708210 +598957, 2019-04-06 20:36:41.041460 +592212, 2019-04-06 20:38:21.269351 +592212, 2019-04-06 20:40:01.650137 +592212, 2019-04-06 20:41:42.005940 +586017, 2019-04-06 20:43:22.323705 +586017, 2019-04-06 20:45:02.550281 +586017, 2019-04-06 20:46:42.881770 +586017, 2019-04-06 20:48:23.208289 +576129, 2019-04-06 20:50:03.469135 +576129, 2019-04-06 20:51:43.751630 +572177, 2019-04-06 20:53:24.005298 +572177, 2019-04-06 20:55:04.251943 +572177, 2019-04-06 20:56:44.603773 +569069, 2019-04-06 20:58:24.923691 +569069, 2019-04-06 21:00:05.298414 +569069, 2019-04-06 21:01:45.699713 +567069, 2019-04-06 21:03:25.955983 +567069, 2019-04-06 21:05:06.224439 +567069, 2019-04-06 21:06:46.575557 +565458, 2019-04-06 21:08:26.868012 +565458, 2019-04-06 21:10:07.181780 +565458, 2019-04-06 21:11:47.526692 +564604, 2019-04-06 21:13:27.859099 +564604, 2019-04-06 21:15:08.170304 +564604, 2019-04-06 21:16:48.456460 +563913, 2019-04-06 21:18:28.835441 +563913, 2019-04-06 21:20:09.086882 +563913, 2019-04-06 21:21:49.466329 +563194, 2019-04-06 21:23:29.913826 +563194, 2019-04-06 21:25:10.259109 +563194, 2019-04-06 21:26:50.566631 +562821, 2019-04-06 21:28:31.404164 +562821, 2019-04-06 21:30:11.783681 +562821, 2019-04-06 21:31:52.137611 +561828, 2019-04-06 21:33:32.497649 +561828, 2019-04-06 21:35:12.777766 +561828, 2019-04-06 21:36:53.173127 +559902, 2019-04-06 21:38:33.481381 +559902, 2019-04-06 21:40:13.812996 +559902, 2019-04-06 21:41:54.182185 +555889, 2019-04-06 21:43:34.509930 +555889, 2019-04-06 21:45:14.816560 +555889, 2019-04-06 21:46:55.166379 +550616, 2019-04-06 21:48:35.415198 +550616, 2019-04-06 21:50:15.745086 +550616, 2019-04-06 21:51:56.017574 +545771, 2019-04-06 21:53:36.287284 +545771, 2019-04-06 21:55:16.581278 +545771, 2019-04-06 21:56:56.927074 +536380, 2019-04-06 21:58:37.184817 +536380, 2019-04-06 22:00:17.506034 +536380, 2019-04-06 22:01:57.816931 +526151, 2019-04-06 22:03:38.112851 +526151, 2019-04-06 22:05:18.446768 +526151, 2019-04-06 22:06:58.750961 +516839, 2019-04-06 22:08:39.085154 +516839, 2019-04-06 22:10:19.353621 +516839, 2019-04-06 22:11:59.611680 +505329, 2019-04-06 22:13:39.916699 +505329, 2019-04-06 22:15:20.311418 +505329, 2019-04-06 22:17:00.635633 +495851, 2019-04-06 22:18:40.977976 +495851, 2019-04-06 22:20:21.296353 +495851, 2019-04-06 22:22:01.653671 +489629, 2019-04-06 22:23:41.972655 +489629, 2019-04-06 22:25:22.278647 +489629, 2019-04-06 22:27:02.530505 +486296, 2019-04-06 22:28:42.865858 +486296, 2019-04-06 22:30:23.175996 +486296, 2019-04-06 22:32:03.481638 +484217, 2019-04-06 22:33:43.827660 +484217, 2019-04-06 22:35:24.153608 +484217, 2019-04-06 22:37:04.477692 +483498, 2019-04-06 22:38:44.774360 +483498, 2019-04-06 22:40:25.105863 +483498, 2019-04-06 22:42:05.424004 +483066, 2019-04-06 22:43:45.731582 +483066, 2019-04-06 22:45:26.085845 +483066, 2019-04-06 22:47:06.351344 +482232, 2019-04-06 22:48:46.585624 +482232, 2019-04-06 22:50:26.897734 +482232, 2019-04-06 22:52:07.189903 +481793, 2019-04-06 22:53:47.550924 +481793, 2019-04-06 22:55:27.898212 +481793, 2019-04-06 22:57:08.157946 +481003, 2019-04-06 22:58:48.452456 +481003, 2019-04-06 23:00:28.789872 +481003, 2019-04-06 23:02:09.100499 +479234, 2019-04-06 23:03:49.430244 +479234, 2019-04-06 23:05:29.765607 +479234, 2019-04-06 23:07:10.069371 +476052, 2019-04-06 23:08:50.357660 +476052, 2019-04-06 23:10:30.610948 +476052, 2019-04-06 23:12:10.872786 +472136, 2019-04-06 23:13:51.175597 +472136, 2019-04-06 23:15:31.512104 +472136, 2019-04-06 23:17:11.863298 +467800, 2019-04-06 23:18:52.192779 +467800, 2019-04-06 23:20:32.525520 +467800, 2019-04-06 23:22:13.387868 +463531, 2019-04-06 23:23:53.714178 +463531, 2019-04-06 23:25:34.012163 +463531, 2019-04-06 23:27:14.373963 +458805, 2019-04-06 23:28:54.747531 +458805, 2019-04-06 23:30:35.103040 +458805, 2019-04-06 23:32:15.434856 +454175, 2019-04-06 23:33:55.772872 +454175, 2019-04-06 23:35:36.031305 +454175, 2019-04-06 23:37:16.385961 +449132, 2019-04-06 23:38:56.714167 +449132, 2019-04-06 23:40:37.030090 +449132, 2019-04-06 23:42:17.297900 +444908, 2019-04-06 23:43:57.631982 +444908, 2019-04-06 23:45:38.024039 +444908, 2019-04-06 23:47:19.391924 +440082, 2019-04-06 23:48:59.727493 +440082, 2019-04-06 23:50:39.987779 +440082, 2019-04-06 23:52:20.312060 +435124, 2019-04-06 23:54:00.597553 +435124, 2019-04-06 23:55:40.889661 +435124, 2019-04-06 23:57:21.637912 +429296, 2019-04-06 23:59:01.981942 +429296, 2019-04-07 00:00:42.250980 +429296, 2019-04-07 00:02:22.552810 +423741, 2019-04-07 00:04:02.830551 +423741, 2019-04-07 00:05:43.173536 +423741, 2019-04-07 00:07:23.507072 +418250, 2019-04-07 00:09:03.854474 +418250, 2019-04-07 00:10:44.177312 +418250, 2019-04-07 00:12:24.461888 +412530, 2019-04-07 00:14:04.708110 +412530, 2019-04-07 00:15:44.949963 +412530, 2019-04-07 00:17:25.244961 +406677, 2019-04-07 00:19:05.536539 +406677, 2019-04-07 00:20:45.905825 +406677, 2019-04-07 00:22:26.304392 +401461, 2019-04-07 00:24:06.664528 +401461, 2019-04-07 00:25:46.899164 +401461, 2019-04-07 00:27:27.195690 +396138, 2019-04-07 00:29:07.475359 +396138, 2019-04-07 00:30:47.817654 +396138, 2019-04-07 00:32:28.062603 +390901, 2019-04-07 00:34:08.435171 +390901, 2019-04-07 00:35:48.723917 +390901, 2019-04-07 00:37:28.971784 +385741, 2019-04-07 00:39:09.250415 +385741, 2019-04-07 00:40:49.539746 +385741, 2019-04-07 00:42:29.900901 +380728, 2019-04-07 00:44:10.193810 +380728, 2019-04-07 00:45:50.470659 +380728, 2019-04-07 00:47:30.798584 +375792, 2019-04-07 00:49:11.075963 +375792, 2019-04-07 00:50:51.406284 +375792, 2019-04-07 00:52:31.749755 +370983, 2019-04-07 00:54:12.081563 +370983, 2019-04-07 00:55:52.351936 +370983, 2019-04-07 00:57:32.708994 +366210, 2019-04-07 00:59:13.908483 +366210, 2019-04-07 01:00:54.171536 +366210, 2019-04-07 01:02:34.450672 +360869, 2019-04-07 01:04:14.779485 +360869, 2019-04-07 01:05:55.061447 +360869, 2019-04-07 01:07:35.379539 +355968, 2019-04-07 01:09:15.772083 +355968, 2019-04-07 01:10:56.097223 +355968, 2019-04-07 01:12:36.369902 +351719, 2019-04-07 01:14:16.725569 +351719, 2019-04-07 01:15:57.018464 +351719, 2019-04-07 01:17:37.341446 +348194, 2019-04-07 01:19:17.667835 +348194, 2019-04-07 01:20:58.035269 +348194, 2019-04-07 01:22:38.305144 +344506, 2019-04-07 01:24:18.564649 +344506, 2019-04-07 01:25:58.849824 +344506, 2019-04-07 01:27:39.199444 +340842, 2019-04-07 01:29:19.481934 +340842, 2019-04-07 01:31:00.017510 +340842, 2019-04-07 01:32:40.263163 +337731, 2019-04-07 01:34:20.554886 +337731, 2019-04-07 01:36:00.839972 +337731, 2019-04-07 01:37:41.170351 +274753, 2019-04-07 01:39:21.518946 +274753, 2019-04-07 01:41:01.887082 +274753, 2019-04-07 01:42:42.216799 +292750, 2019-04-07 01:44:22.496555 +292750, 2019-04-07 01:46:02.851643 +292750, 2019-04-07 01:47:43.166697 +307968, 2019-04-07 01:49:23.460185 +307968, 2019-04-07 01:51:03.735553 +307968, 2019-04-07 01:52:44.070218 +308963, 2019-04-07 01:54:24.370864 +308963, 2019-04-07 01:56:04.713840 +308963, 2019-04-07 01:57:44.991340 +309364, 2019-04-07 01:59:25.270543 +309364, 2019-04-07 02:01:05.527877 +309364, 2019-04-07 02:02:45.814002 +309598, 2019-04-07 02:04:26.096268 +309598, 2019-04-07 02:06:06.456483 +309598, 2019-04-07 02:07:46.772375 +310363, 2019-04-07 02:09:27.074460 +310363, 2019-04-07 02:11:07.513723 +310363, 2019-04-07 02:12:47.856174 +311736, 2019-04-07 02:14:28.267217 +311736, 2019-04-07 02:16:08.607763 +311736, 2019-04-07 02:17:48.960092 +313745, 2019-04-07 02:19:29.263924 +313745, 2019-04-07 02:21:09.578425 +313745, 2019-04-07 02:22:49.928105 +315836, 2019-04-07 02:24:30.156123 +315836, 2019-04-07 02:26:10.464596 +315836, 2019-04-07 02:27:50.755420 +317976, 2019-04-07 02:29:31.122653 +317976, 2019-04-07 02:31:11.456722 +317976, 2019-04-07 02:32:51.787978 +319848, 2019-04-07 02:34:32.094861 +319848, 2019-04-07 02:36:12.376583 +319848, 2019-04-07 02:37:52.750237 +321930, 2019-04-07 02:39:33.012977 +321930, 2019-04-07 02:41:13.311085 +321930, 2019-04-07 02:42:53.633369 +324517, 2019-04-07 02:44:34.102793 +324517, 2019-04-07 02:46:14.504857 +324517, 2019-04-07 02:47:54.876204 +327542, 2019-04-07 02:49:35.114788 +327542, 2019-04-07 02:51:15.480654 +327542, 2019-04-07 02:52:55.815413 +331291, 2019-04-07 02:54:36.119613 +331291, 2019-04-07 02:56:16.440095 +331291, 2019-04-07 02:57:56.750398 +334975, 2019-04-07 02:59:37.058195 +334975, 2019-04-07 03:01:17.375209 +334975, 2019-04-07 03:02:58.055863 +339244, 2019-04-07 03:04:38.388329 +339244, 2019-04-07 03:06:18.685225 +339244, 2019-04-07 03:07:58.971974 +343571, 2019-04-07 03:09:39.234200 +343571, 2019-04-07 03:11:19.519782 +343571, 2019-04-07 03:12:59.942001 +348271, 2019-04-07 03:14:40.224029 +348271, 2019-04-07 03:16:20.552560 +348271, 2019-04-07 03:18:00.844391 +353552, 2019-04-07 03:19:41.096695 +353552, 2019-04-07 03:21:21.373152 +353552, 2019-04-07 03:23:01.736340 +358519, 2019-04-07 03:24:42.101176 +358519, 2019-04-07 03:26:22.360171 +358519, 2019-04-07 03:28:02.644312 +363878, 2019-04-07 03:29:42.964032 +363878, 2019-04-07 03:31:23.281019 +363878, 2019-04-07 03:33:03.566389 +369566, 2019-04-07 03:34:43.907835 +369566, 2019-04-07 03:36:24.240381 +369566, 2019-04-07 03:38:04.534922 +375601, 2019-04-07 03:39:44.827723 +375601, 2019-04-07 03:41:25.388592 +375601, 2019-04-07 03:43:05.691215 diff --git a/server/nightr/strategies/just_eat.py b/server/nightr/strategies/just_eat.py index aa074e9..1f550e2 100644 --- a/server/nightr/strategies/just_eat.py +++ b/server/nightr/strategies/just_eat.py @@ -33,7 +33,7 @@ def is_restaurant_open(name, open, close) -> Prediction: p.probability = 1 / 11 else: p.reasons.append(f"Our favorite pizza place, {name}, is closed.") - p.reasons.append(f"We can conclude from this, that there is {1 - (1/11)}% chance of it currently being night outside!") + p.reasons.append(f"We can conclude from this, that there is {1 - (1/11):.1f}% chance of it currently being night outside!") p.probability = round(1 - (1 / 11), 2) return p diff --git a/server/nightr/strategies/steam.py b/server/nightr/strategies/steam.py new file mode 100644 index 0000000..266b7c2 --- /dev/null +++ b/server/nightr/strategies/steam.py @@ -0,0 +1,40 @@ +from datetime import datetime +from pathlib import Path + +import requests + +from ..util import Context, Prediction + + +def dota2_players(context: Context) -> Prediction: + """ + How many players are playing Dota 2? + """ + p = Prediction() + + # Find the historic data closest matching the current number of players. Lol yolo + current_players = get_dota2_players() + with Path(__file__).parent.joinpath("dotaplayers 2019-04-06 13:43:33.074496.csv").open() as csv: + best_players, best_dt = min(csv, key=lambda l: abs(int(l.rstrip().split(", ")[0]) - current_players)).rstrip().split(", ") + best_match_players = int(best_players) + best_match_datetime = datetime.strptime(best_dt, "%Y-%m-%d %H:%M:%S.%f") + + night = best_match_datetime.hour < 6 or best_match_datetime.hour >= 22 + night_description = "night" if night else "day" + + p.reasons.append(f"{current_players} people are currently playing Dota 2.") + p.reasons.append(f"On the {night_description} of {best_match_datetime.strftime('%B %d')}, {best_match_players} were playing Dota 2.") + p.reasons.append(f"Therefore, it must currently be {night_description}time.") + + p.probability = float(night) # TODO: actual float lol gg + + return p + + +def get_dota2_players(): + header = {"Client-ID": "F07D7ED5C43A695B3EBB01C28B6A18E5"} + appId = 570 + game_players_url = 'https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?format=json&appid=' + str(appId) + game_players = requests.get(game_players_url, headers=header) + players_str = str(game_players.json()['response']['player_count']) + return int(players_str)