Remove unused files. Remove Freeciv-earth and meta-stats.

This commit is contained in:
Andreas Røsdal
2021-03-18 14:23:21 +01:00
parent a6ce9e2aeb
commit 45c7bd4990
15 changed files with 0 additions and 374 deletions

View File

@@ -47,8 +47,6 @@ Freeciv-Web consists of these components:
* [pbem](pbem) is play-by-email support.
* [freeciv-earth](freeciv-earth) is code to generate Freeciv savegames from a map captured from mapbox.
Freeciv WebGL
-------------
Freeciv WebGL is the 3D version, which uses the Three.js 3D engine. More info about the WebGL 3D version can be found for [developers](https://github.com/freeciv/freeciv-web/tree/develop/freeciv-web/src/main/webapp/javascript/webgl) and [3D artists](https://github.com/freeciv/freeciv-web/wiki/Contributing-Blender-models-for-Freeciv-WebGL).

View File

@@ -1,128 +0,0 @@
#!/usr/bin/env python3
'''**********************************************************************
Copyright (C) 2009-2015 The Freeciv-web project
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************'''
from tornado import web, ioloop, httpserver
import io
import time
STATUS_PORT = 3999
savedir = "/var/lib/tomcat9/webapps/data/savegames/";
savegame_filename = "freeciv-earth-savegame-";
savecounter = 10000;
savetemplate = "";
with open('template_map.sav', 'r') as myfile:
savetemplate=myfile.read();
myfile.close();
""" /freeciv-earth-mapgen """
class MapGen():
def start(self):
application = web.Application([
(r"/freeciv-earth-mapgen", MapHandler),
])
http_server = httpserver.HTTPServer(application)
http_server.listen(STATUS_PORT)
ioloop.IOLoop.current().start()
class MapHandler(web.RequestHandler):
def get(self):
global savecounter;
self.write("Freeciv-Earth map generator! (" + str(savecounter) + ")");
def post(self):
global savecounter;
time.sleep(1);
print("handling request " + str(savecounter) + " to generate savegame for Freeciv-Earth.");
self.set_header("Content-Type", "text/plain")
client_request = self.request.body.decode("utf-8");
msg_part = client_request.split(";");
if len(msg_part) != 3:
self.set_status(400, "Wrong number of parameters: " + str(len(msg_part)))
return
users_map_string = msg_part[0];
try:
map_xsize = int(msg_part[1]);
map_ysize = int(msg_part[2]);
except ValueError:
self.set_status(400, "Incorrect map size ["
+ msg_part[1][:10] + ", "
+ msg_part[2][:10] + "]")
return
# validate users_map_string.
if (len(users_map_string) > 1000000 or (map_xsize * map_ysize > 18000)
or map_xsize < 10 or map_ysize < 10):
self.set_status(400, "Incorrect map size ["
+ msg_part[1][:10] + ", "
+ msg_part[2][:10] + ", "
+ str(len(users_map_string)) + "]")
return
line_n = 0
for line in io.StringIO(users_map_string):
if len(line) != map_xsize + 9:
self.set_status(400, "Incorrect row length: "
+ str(line_n) + ", "
+ str(len(line)) + ", "
+ str(map_xsize))
return
if ((not line.startswith('t' + ('0000'+str(line_n))[-4:] + '="'))
or (not line.endswith('"\n'))):
self.set_status(400, "Incorrect row format: "
+ str(line_n) + ", "
+ line)
return
for c in line[7:-2]:
if c not in "i+ :adfghjmpst":
self.set_status(400, "Incorrect terrain: "
+ str(line_n) + ", "
+ bytes(c, "utf-8").hex())
return
line_n += 1
if line_n != map_ysize:
self.set_status(400, "Incorrect number of rows: "
+ str(line_n) + ", "
+ str(map_ysize))
return
user_new_savegame = savetemplate.replace("{xsize}", str(map_xsize)).replace("{ysize}", str(map_ysize)) + users_map_string;
# save result to data webapp.
savecounter += 1;
new_filename = savegame_filename + str(savecounter);
save_file = open(savedir + new_filename + ".sav", "w");
try:
save_file.write(user_new_savegame);
finally:
save_file.close()
#return new savegame filename to user.
self.write(new_filename);
if __name__ == '__main__':
print("Freeciv-Earth processing maps");
mg = MapGen();
mg.start();

View File

@@ -1 +0,0 @@
tornado ~= 5.0, >= 5.1

View File

@@ -1,139 +0,0 @@
[scenario]
game_version=2939900
is_scenario=TRUE
name=_("Freeciv-Earth")
description=_("Freeciv-web map on real earth map.")
authors=_("The Freeciv-web project")
save_random=FALSE
players=FALSE
startpos_nations=FALSE
lake_flooding=TRUE
handmade=TRUE
[savefile]
options=" +version3"
version=40
reason="Scenario"
revision="2.93.99-alpha"
rulesetdir="classic"
improvement_size=68
improvement_vector="Airport","Aqueduct","Bank","Barracks","Barracks II","Barracks III","Cathedral","City Walls","Coastal Defense","Colosseum","Courthouse","Factory","Granary","Harbour","Hydro Plant","Library","Marketplace","Mass Transit","Mfg. Plant","Nuclear Plant","Offshore Platform","Palace","Police Station","Port Facility","Power Plant","Recycling Center","Research Lab","SAM Battery","SDI Defense","Sewer System","Solar Plant","Space Component","Space Module","Space Structural","Stock Exchange","Super Highways","Supermarket","Temple","University","Apollo Program","A.Smith's Trading Co.","Colossus","Copernicus' Observatory","Cure For Cancer","Darwin's Voyage","Eiffel Tower","Great Library","Great Wall","Hanging Gardens","Hoover Dam","Isaac Newton's College","J.S. Bach's Cathedral","King Richard's Crusade","Leonardo's Workshop","Lighthouse","Magellan's Expedition","Manhattan Project","Marco Polo's Embassy","Michelangelo's Chapel","Oracle","Pyramids","SETI Program","Shakespeare's Theatre","Statue of Liberty","Sun Tzu's War Academy","United Nations","Women's Suffrage","Coinage"
technology_size=88
technology_vector="A_NONE","Advanced Flight","Alphabet","Amphibious Warfare","Astronomy","Atomic Theory","Automobile","Banking","Bridge Building","Bronze Working","Ceremonial Burial","Chemistry","Chivalry","Code of Laws","Combined Arms","Combustion","Communism","Computers","Conscription","Construction","Currency","Democracy","Economics","Electricity","Electronics","Engineering","Environmentalism","Espionage","Explosives","Feudalism","Flight","Fusion Power","Genetic Engineering","Guerilla Warfare","Gunpowder","Horseback Riding","Industrialization","Invention","Iron Working","Labor Union","Laser","Leadership","Literacy","Machine Tools","Magnetism","Map Making","Masonry","Mass Production","Mathematics","Medicine","Metallurgy","Miniaturization","Mobile Warfare","Monarchy","Monotheism","Mysticism","Navigation","Nuclear Fission","Nuclear Power","Philosophy","Physics","Plastics","Polytheism","Pottery","Radio","Railroad","Recycling","Refining","Refrigeration","Robotics","Rocketry","Sanitation","Seafaring","Space Flight","Stealth","Steam Engine","Steel","Superconductors","Tactics","The Corporation","The Republic","The Wheel","Theology","Theory of Gravity","Trade","University","Warrior Code","Writing"
activities_size=21
activities_vector="Idle","Pollution","Unused Road","Mine","Irrigate","Fortified","Fortress","Sentry","Unused Railroad","Pillage","Goto","Explore","Transform","Unused","Unused Airbase","Fortifying","Fallout","Unused Patrol","Base","Road","Convert"
specialists_size=3
specialists_vector="elvis","scientist","taxman"
trait_size=3
trait_vector="Expansionist","Trader","Aggressive"
extras_size=34
extras_vector="Irrigation","Mine","Oil Well","Pollution","Hut","Farmland","Fallout","Fortress","Airbase","Buoy","Ruins","Road","Railroad","River","Gold","Iron","Game","Furs","Coal","Fish","Fruit","Gems","Buffalo","Wheat","Oasis","Peat","Pheasant","Resources","Ivory","Silk","Spice","Whales","Wine","Oil"
multipliers_size=0
diplstate_type_size=7
diplstate_type_vector="Armistice","War","Cease-fire","Peace","Alliance","Never met","Team"
city_options_size=3
city_options_vector="Disband","Sci_Specialists","Tax_Specialists"
action_size=38
action_vector="Establish Embassy","Establish Embassy Stay","Investigate City","Investigate City Spend Unit","Poison City","Steal Gold","Steal Gold Escape","Sabotage City","Targeted Sabotage City","Steal Tech","Targeted Steal Tech","Incite City","Incite City Escape","Establish Trade Route","Enter Marketplace","Help Wonder","Bribe Unit","Sabotage Unit","Capture Units","Found City","Join City","Steal Maps","Steal Maps Escape","Bombard","Suitcase Nuke","Suitcase Nuke Escape","Explode Nuclear","Destroy City","Expel Unit","Recycle Unit","Disband Unit","Home City","Upgrade Unit","Paradrop Unit","Airlift Unit","Attack","Conquer City","Heal Unit"
action_decision_size=3
action_decision_vector="nothing","passive","active"
terrident={"name","identifier"
"Inaccessible","i"
"Lake","+"
"Ocean"," "
"Deep Ocean",":"
"Glacier","a"
"Desert","d"
"Forest","f"
"Grassland","g"
"Hills","h"
"Jungle","j"
"Mountains","m"
"Plains","p"
"Swamp","s"
"Tundra","t"
}
[game]
server_state="S_S_INITIAL"
meta_patches="none"
meta_server="http://meta.freeciv.org/metaserver.php"
id=""
serverid=""
level="Normal"
phase_mode="Concurrent"
phase_mode_stored="Concurrent"
phase=0
scoreturn=20
timeoutint=0
timeoutintinc=0
timeoutinc=0
timeoutincmult=1
timeoutcounter=1
turn=0
year=-4000
year_0_hack=FALSE
globalwarming=0
heating=0
warminglevel=8
nuclearwinter=0
cooling=0
coolinglevel=8
random_seed=1499032437
global_advances="1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
save_players=FALSE
save_known=FALSE
[random]
saved=FALSE
[script]
code=$$
vars=$$
[settings]
set={"name","value","gamestart"
"aifill",8,8
"alltemperate",FALSE,FALSE
"flatpoles",100,100
"generator","SCENARIO","SCENARIO"
"landmass",30,30
"mapseed",0,0
"mapsize","XYSIZE","XYSIZE"
"maxplayers",32,32
"metamessage","Scenario: Earth(Large)",""
"naturalcitynames",FALSE,FALSE
"revolentype","RANDOM","RANDOM"
"separatepoles",TRUE,TRUE
"singlepole",FALSE,FALSE
"size",4,4
"startcity",TRUE,TRUE
"startpos","DEFAULT","DEFAULT"
"steepness",30,30
"teamplacement","CLOSEST","CLOSEST"
"temperature",50,50
"tilesperplayer",100,100
"tinyisles",FALSE,FALSE
"topology","WRAPX","WRAPX"
"victories","",""
"wetness",50,50
"xsize",{xsize},{xsize}
"ysize",{ysize},{ysize}
}
set_count=26
gamestart_valid=TRUE
[ruledata]
government={"name","changes"
"Anarchy",0
"Despotism",0
"Monarchy",0
"Communism",0
"Republic",0
"Democracy",0
}
[map]
have_huts=TRUE
have_resources=FALSE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -1,7 +1,5 @@
-r publite2/requirements.txt
-r freeciv-proxy/requirements.txt
-r pbem/requirements.txt
-r freeciv-earth/requirements.txt
-r scripts/meta-stats/requirements.txt
-r scripts/freeciv-img-extract/requirements.txt
-r scripts/requirements.txt

View File

@@ -1,89 +0,0 @@
#!/usr/bin/env python3
'''**********************************************************************
Copyright (C) 2009-2016 The Freeciv-web project
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***********************************************************************'''
# meta-stats.py is a Python script to poll meta.freeciv.org
# and update the games_played_stats mysql database table.
import time
import mysql.connector
import configparser
import http.client
settings = configparser.ConfigParser()
settings.read("../../pbem/settings.ini")
mysql_user=settings.get("Config", "mysql_user")
mysql_database=settings.get("Config", "mysql_database");
mysql_password=settings.get("Config", "mysql_password");
server_map = {};
is_first_check = True;
def increment_metaserver_stats():
cursor = None;
cnx = None;
try:
cnx = mysql.connector.connect(user=mysql_user, database=mysql_database, password=mysql_password)
cursor = cnx.cursor()
query = ("INSERT INTO games_played_stats (statsDate, gameType, gameCount) VALUES (CURDATE(), 3, 1) ON DUPLICATE KEY UPDATE gameCount = gameCount + 1;")
cursor.execute(query);
cnx.commit();
finally:
cursor.close()
cnx.close()
def poll_metaserver():
global is_first_check;
global server_map;
conn = http.client.HTTPConnection("meta.freeciv.org")
conn.request("GET", "/");
r1 = conn.getresponse();
html_doc = r1.read();
all_rows = html_doc.decode('utf-8').split("<tr>");
rows = all_rows[2:len(all_rows)-1];
for row in rows:
cells = row.split("<");
hostname_port = cells[2];
state = cells[11];
if (hostname_port in server_map):
old_state = server_map[hostname_port];
if ("Pregame" in old_state and "Running" in state):
# new game: existing server transitions from pregame to running state.
print("new game started for: " + hostname_port);
increment_metaserver_stats();
elif "Running" in state and not is_first_check and not hostname_port in server_map:
# new game: new server starts directly in running state.
print("new game started for: " + hostname_port);
increment_metaserver_stats();
server_map[hostname_port] = state;
is_first_check = False;
if __name__ == '__main__':
print("Freeciv-web meta.freeciv.org stats");
while (1):
try:
time.sleep(1);
poll_metaserver();
time.sleep(60*10); #poll every 10 minutes.
except Exception as e:
print(e);

View File

@@ -1 +0,0 @@
mysql-connector-python ~= 8.0, >= 8.0.12

View File

@@ -45,12 +45,6 @@ echo "Publite2 started" && \
echo "Starting Freeciv-PBEM" && \
(cd ${FREECIV_WEB_DIR}/pbem/ && nohup python3 -u pbem.py > ../logs/pbem.log 2>&1) || echo "unable to start pbem" &
echo "starting meta-stats.py" && \
(cd ${FREECIV_WEB_DIR}/scripts/meta-stats && nohup python3 -u meta-stats.py > ../../logs/meta-stats.log 2>&1) || echo "unable to start meta-stats" &
echo "Starting Freeciv-Earth-mapgen." && \
cd ${FREECIV_WEB_DIR}/freeciv-earth/ && nohup python3 -u freeciv-earth-mapgen.py > ../logs/freeciv-earth.log 2>&1 || echo "unable to start freeciv-earth-mapgen" &
echo "Will sleep for 8 seconds, then do a status test..." && \
sleep 8 && \
bash ${FREECIV_WEB_DIR}/scripts/status-freeciv-web.sh

View File

@@ -43,11 +43,5 @@ ps aux | grep -ie freeciv-proxy | awk '{print $2}' | xargs kill -9
#5.1 Freeciv-PBEM
ps aux | grep -ie pbem | awk '{print $2}' | xargs kill -9
#5.2 meta-stats
ps aux | grep -ie meta-stats | awk '{print $2}' | xargs kill -9
#5.3 Freeciv-Earth
ps aux | grep -ie freeciv-earth | awk '{print $2}' | xargs kill -9
# Clean up server list in metaserver database.
echo "delete from servers" | mysql -u "${DB_USER}" -p"${DB_PASSWORD}" "${DB_NAME}"