diff --git a/client/Nightr/App_Resources/Android/gradle/wrapper/gradle-wrapper.properties b/client/Nightr/App_Resources/Android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d2c45a4 --- /dev/null +++ b/client/Nightr/App_Resources/Android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/client/Nightr/App_Resources/Android/gradlew b/client/Nightr/App_Resources/Android/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/client/Nightr/App_Resources/Android/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/client/Nightr/App_Resources/Android/gradlew.bat b/client/Nightr/App_Resources/Android/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/client/Nightr/App_Resources/Android/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/client/Nightr/package-lock.json b/client/Nightr/package-lock.json index 447e2bf..04b5e41 100644 --- a/client/Nightr/package-lock.json +++ b/client/Nightr/package-lock.json @@ -3948,6 +3948,14 @@ } } }, + "nativescript-geolocation": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nativescript-geolocation/-/nativescript-geolocation-5.0.0.tgz", + "integrity": "sha512-olFTkG68Y0pkqtxyaPoHalZSHgXcg3iL9q+r9gcEY5c7QY8sCtfdO/T5FhHeQlDu0YrrZhx2Ke20dUczuePmUA==", + "requires": { + "nativescript-permissions": "~1.2.3" + } + }, "nativescript-hook": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/nativescript-hook/-/nativescript-hook-0.2.5.tgz", @@ -3978,6 +3986,11 @@ "resolved": "https://registry.npmjs.org/nativescript-intl/-/nativescript-intl-3.0.0.tgz", "integrity": "sha1-gu6b59N3Fys8QpVzRyMDdijhhqc=" }, + "nativescript-permissions": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/nativescript-permissions/-/nativescript-permissions-1.2.3.tgz", + "integrity": "sha1-4+ZVRfmP5IjdVXj3/5DrrjCI5wA=" + }, "nativescript-theme-core": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/nativescript-theme-core/-/nativescript-theme-core-1.0.4.tgz", diff --git a/client/Nightr/package.json b/client/Nightr/package.json index 0bd444a..ddcc97a 100644 --- a/client/Nightr/package.json +++ b/client/Nightr/package.json @@ -22,6 +22,7 @@ "@angular/platform-browser-dynamic": "~7.2.0", "@angular/router": "~7.2.0", "nativescript-angular": "~7.2.0", + "nativescript-geolocation": "^5.0.0", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.12", "rxjs": "~6.3.0", diff --git a/client/Nightr/src/app/app-routing.module.ts b/client/Nightr/src/app/app-routing.module.ts deleted file mode 100644 index d8012a0..0000000 --- a/client/Nightr/src/app/app-routing.module.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { NgModule } from "@angular/core"; -import { NativeScriptRouterModule } from "nativescript-angular/router"; -import { Routes } from "@angular/router"; - -import { ItemsComponent } from "./item/items.component"; -import { ItemDetailComponent } from "./item/item-detail.component"; - -const routes: Routes = [ - { path: "", redirectTo: "/items", pathMatch: "full" }, - { path: "items", component: ItemsComponent }, - { path: "item/:id", component: ItemDetailComponent } -]; - -@NgModule({ - imports: [NativeScriptRouterModule.forRoot(routes)], - exports: [NativeScriptRouterModule] -}) -export class AppRoutingModule { } diff --git a/client/Nightr/src/app/app.component.html b/client/Nightr/src/app/app.component.html index 8a2c1a7..6dea362 100644 --- a/client/Nightr/src/app/app.component.html +++ b/client/Nightr/src/app/app.component.html @@ -1,2 +1,3 @@ - - + + + diff --git a/client/Nightr/src/app/app.module.ts b/client/Nightr/src/app/app.module.ts index c8f47ea..d5d8d40 100644 --- a/client/Nightr/src/app/app.module.ts +++ b/client/Nightr/src/app/app.module.ts @@ -1,10 +1,8 @@ import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; import { NativeScriptModule } from "nativescript-angular/nativescript.module"; -import { AppRoutingModule } from "./app-routing.module"; import { AppComponent } from "./app.component"; -import { ItemsComponent } from "./item/items.component"; -import { ItemDetailComponent } from "./item/item-detail.component"; +import { MyButtonComponent } from './my-button/my-button.component'; // Uncomment and add to NgModule imports if you need to use two-way binding // import { NativeScriptFormsModule } from "nativescript-angular/forms"; @@ -18,12 +16,10 @@ import { ItemDetailComponent } from "./item/item-detail.component"; ], imports: [ NativeScriptModule, - AppRoutingModule ], declarations: [ AppComponent, - ItemsComponent, - ItemDetailComponent + MyButtonComponent, ], providers: [], schemas: [ diff --git a/client/Nightr/src/app/item/item-detail.component.html b/client/Nightr/src/app/item/item-detail.component.html deleted file mode 100644 index 3bbd174..0000000 --- a/client/Nightr/src/app/item/item-detail.component.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/client/Nightr/src/app/item/item-detail.component.ts b/client/Nightr/src/app/item/item-detail.component.ts deleted file mode 100644 index e48b03f..0000000 --- a/client/Nightr/src/app/item/item-detail.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Component, OnInit } from "@angular/core"; -import { ActivatedRoute } from "@angular/router"; - -import { Item } from "./item"; -import { ItemService } from "./item.service"; - -@Component({ - selector: "ns-details", - moduleId: module.id, - templateUrl: "./item-detail.component.html" -}) -export class ItemDetailComponent implements OnInit { - item: Item; - - constructor( - private itemService: ItemService, - private route: ActivatedRoute - ) { } - - ngOnInit(): void { - const id = +this.route.snapshot.params.id; - this.item = this.itemService.getItem(id); - } -} diff --git a/client/Nightr/src/app/item/item.service.ts b/client/Nightr/src/app/item/item.service.ts deleted file mode 100644 index 74d9140..0000000 --- a/client/Nightr/src/app/item/item.service.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Injectable } from "@angular/core"; - -import { Item } from "./item"; - -@Injectable({ - providedIn: "root" -}) -export class ItemService { - private items = new Array( - { id: 1, name: "Ter Stegen", role: "Goalkeeper" }, - { id: 3, name: "Piqué", role: "Defender" }, - { id: 4, name: "I. Rakitic", role: "Midfielder" }, - { id: 5, name: "Sergio", role: "Midfielder" }, - { id: 6, name: "Denis Suárez", role: "Midfielder" }, - { id: 7, name: "Arda", role: "Midfielder" }, - { id: 8, name: "A. Iniesta", role: "Midfielder" }, - { id: 9, name: "Suárez", role: "Forward" }, - { id: 10, name: "Messi", role: "Forward" }, - { id: 11, name: "Neymar", role: "Forward" }, - { id: 12, name: "Rafinha", role: "Midfielder" }, - { id: 13, name: "Cillessen", role: "Goalkeeper" }, - { id: 14, name: "Mascherano", role: "Defender" }, - { id: 17, name: "Paco Alcácer", role: "Forward" }, - { id: 18, name: "Jordi Alba", role: "Defender" }, - { id: 19, name: "Digne", role: "Defender" }, - { id: 20, name: "Sergi Roberto", role: "Midfielder" }, - { id: 21, name: "André Gomes", role: "Midfielder" }, - { id: 22, name: "Aleix Vidal", role: "Midfielder" }, - { id: 23, name: "Umtiti", role: "Defender" }, - { id: 24, name: "Mathieu", role: "Defender" }, - { id: 25, name: "Masip", role: "Goalkeeper" } - ); - - getItems(): Array { - return this.items; - } - - getItem(id: number): Item { - return this.items.filter((item) => item.id === id)[0]; - } -} diff --git a/client/Nightr/src/app/item/item.ts b/client/Nightr/src/app/item/item.ts deleted file mode 100644 index 950fba4..0000000 --- a/client/Nightr/src/app/item/item.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface Item { - id: number; - name: string; - role: string; -} diff --git a/client/Nightr/src/app/item/items.component.html b/client/Nightr/src/app/item/items.component.html deleted file mode 100644 index f679310..0000000 --- a/client/Nightr/src/app/item/items.component.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - diff --git a/client/Nightr/src/app/item/items.component.ts b/client/Nightr/src/app/item/items.component.ts deleted file mode 100644 index 4f88d08..0000000 --- a/client/Nightr/src/app/item/items.component.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Component, OnInit } from "@angular/core"; - -import { Item } from "./item"; -import { ItemService } from "./item.service"; - -@Component({ - selector: "ns-items", - moduleId: module.id, - templateUrl: "./items.component.html" -}) -export class ItemsComponent implements OnInit { - items: Array; - - // This pattern makes use of Angular’s dependency injection implementation to - // inject an instance of the ItemService service into this class. - // Angular knows about this service because it is included in your app’s main NgModule, - // defined in app.module.ts. - constructor(private itemService: ItemService) { } - - ngOnInit(): void { - this.items = this.itemService.getItems(); - } -} diff --git a/client/Nightr/src/app/my-button/my-button.component.css b/client/Nightr/src/app/my-button/my-button.component.css new file mode 100644 index 0000000..bcd4764 --- /dev/null +++ b/client/Nightr/src/app/my-button/my-button.component.css @@ -0,0 +1 @@ +/* Add mobile styles for the component here. */ diff --git a/client/Nightr/src/app/my-button/my-button.component.html b/client/Nightr/src/app/my-button/my-button.component.html new file mode 100644 index 0000000..59259f8 --- /dev/null +++ b/client/Nightr/src/app/my-button/my-button.component.html @@ -0,0 +1,3 @@ + + + diff --git a/client/Nightr/src/app/my-button/my-button.component.ts b/client/Nightr/src/app/my-button/my-button.component.ts new file mode 100644 index 0000000..d18c116 --- /dev/null +++ b/client/Nightr/src/app/my-button/my-button.component.ts @@ -0,0 +1,16 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'ns-my-button', + templateUrl: './my-button.component.html', + styleUrls: ['./my-button.component.css'], + moduleId: module.id, +}) +export class MyButtonComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/client/Nightr/src/main.js b/client/Nightr/src/main.js index d07591d..faf70ce 100644 --- a/client/Nightr/src/main.js +++ b/client/Nightr/src/main.js @@ -11,4 +11,4 @@ var app_module_1 = require("./app/app.module"); // so we provide a wrapper platform object, platformNativeScriptDynamic, // that sets up a NativeScript application and can bootstrap the Angular framework. platform_1.platformNativeScriptDynamic().bootstrapModule(app_module_1.AppModule); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIm1haW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwR0FBMEc7QUFDMUcsMERBQTRFO0FBRTVFLCtDQUE2QztBQUU3QyxnRkFBZ0Y7QUFDaEYsMEVBQTBFO0FBQzFFLHNFQUFzRTtBQUN0RSx5REFBeUQ7QUFDekQseUVBQXlFO0FBQ3pFLHdFQUF3RTtBQUN4RSxtRkFBbUY7QUFDbkYsc0NBQTJCLEVBQUUsQ0FBQyxlQUFlLENBQUMsc0JBQVMsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gdGhpcyBpbXBvcnQgc2hvdWxkIGJlIGZpcnN0IGluIG9yZGVyIHRvI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l6YXRpb246XHJcbi8vIG1vZHVsZXMsIGNvbXBvbmVudHMsIGRpcmVjdGl2ZXMsIHJvdXRlcywgREkgcHJvdmlkZXJzLlxyXG4vLyBBIE5hdGl2ZVNjcmlwdCBBbmd1bGFyIGFwcCBuZWVkcyB0byBtYWtlIGJvdGggcGFyYWRpZ21zIHdvcmsgdG9nZXRoZXIsXHJcbi8vIHNvIHdlIHByb3ZpZGUgYSB3cmFwcGVyIHBsYXRmb3JtIG9iamVjdCwgcGxhdGZvcm1OYXRpdmVTY3JpcHREeW5hbWljLFxyXG4vLyB0aGF0IHNldHMgdXAgYSBOYXRpdmVTY3JpcHQgYXBwbGljYXRpb24gYW5kIGNhbiBib290c3RyYXAgdGhlIEFuZ3VsYXIgZnJhbWV3b3JrLlxyXG5wbGF0Zm9ybU5hdGl2ZVNjcmlwdER5bmFtaWMoKS5ib290c3RyYXBNb2R1bGUoQXBwTW9kdWxlKTtcclxuIl19 \ No newline at end of file diff --git a/server/nightr/steamplayerhistory.py b/server/nightr/steamplayerhistory.py new file mode 100644 index 0000000..1fad799 --- /dev/null +++ b/server/nightr/steamplayerhistory.py @@ -0,0 +1,20 @@ +import requests +from datetime import datetime +import time + +def main(): + filename = "dotaplayers " + str(datetime.now()) + ".csv" + header = {"Client-ID": "F07D7ED5C43A695B3EBB01C28B6A18E5"} + appId = 570 + game_players_url = 'https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?format=json&appid=' + str(appId) + while True: + f = open(filename,"a+") + game_players = requests.get(game_players_url, headers=header) + players_str = str(game_players.json()['response']['player_count']) + f.write(players_str + ", " + str(datetime.now()) + "\r\n") + print("Game name: Dota 2" + ", Player count: " + str(game_players.json()['response']['player_count'])) + f.close() + time.sleep(100) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/server/nightr/strategies/miloStrats.py b/server/nightr/strategies/miloStrats.py index 93d84a6..b53aa9a 100644 --- a/server/nightr/strategies/miloStrats.py +++ b/server/nightr/strategies/miloStrats.py @@ -1,25 +1,31 @@ import cv2 from datetime import datetime, timedelta from pytz import timezone +from server.nightr.util import Context, Prediction -def camImgStrat(): + +def camImgStrat(context : Context) -> Prediction: img = cv2.imread('night.jpg',0) average = img.mean(axis=0).mean(axis=0) print(average) + p = Prediction() if average < 100: - return 1.0 + p.probability = 1.0 + p.reasons.append('Image was dark') else: - return 0.0 + p.reasons.append('Image was light') + p.probability = 0.0 + return p - -def australiaStrat(): +def australiaStrat(context : Context) -> Prediction: australia = timezone('Australia/Melbourne') t = datetime.now().astimezone(australia) hour = t.hour + p = Prediction() if hour > 22 or hour < 6: - return 1.0 + p.probability = 1.0 + p.reasons.append('It\'s day-time in Australia') else: - return 0.0 - - -print(australiaStrat()) + p.probability = 0.0 + p.reasons.append('It\'s night-time in Australia') + return p