Make the JSON output filename configurable.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 13 Nov 2014 21:56:06 +0000 (22:56 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 13 Nov 2014 21:56:06 +0000 (22:56 +0100)
config.pm
remoteglot.pl

index b9422e6..2c3bedf 100644 (file)
--- a/config.pm
+++ b/config.pm
@@ -7,6 +7,7 @@ package remoteglotconf;
 our $server = "freechess.org";
 our $nick = "SesseBOT";
 our $target = "GMCarlsen";
+our $json_output = "/srv/analysis.sesse.net/www/analysis.json";
 
 our $engine_cmdline = "./stockfish";
 our %engine_config = (
index dd913f6..10dead9 100755 (executable)
@@ -588,11 +588,11 @@ sub output_json {
        }
        $json->{'refutation_lines'} = \%refutation_lines;
 
-       open my $fh, ">/srv/analysis.sesse.net/www/analysis.json.tmp"
+       open my $fh, ">", $remoteglotconf::json_output . ".tmp"
                or return;
        print $fh JSON::XS::encode_json($json);
        close $fh;
-       rename("/srv/analysis.sesse.net/www/analysis.json.tmp", "/srv/analysis.sesse.net/www/analysis.json");
+       rename($remoteglotconf::json_output . ".tmp", $remoteglotconf::json_output);
 }
 
 sub uciprint {