Browse Source

working on player update time

still has issue where python time.gmtime is getting different utc time
than php time()
master
poikilos 9 years ago
committed by Jacob Gustafson
parent
commit
390856c539
  1. 4
      generator.py
  2. 39
      web/chunkymap.php

4
generator.py

@ -1040,8 +1040,8 @@ class MTChunks:
#else: #else:
# if self.verbose_enable: # if self.verbose_enable:
# print("existing "+this_player["index"]+" is not needle "+str(index)) # print("existing "+this_player["index"]+" is not needle "+str(index))
else: #else:
print("WARNING: player "+this_key+":"+str(this_player)+" is missing index") #print("WARNING: player "+this_key+":"+str(this_player)+" is missing index")
return result return result
def get_new_player_index(self): def get_new_player_index(self):

39
web/chunkymap.php

@ -272,6 +272,9 @@ function get_markers_from_dir($chunkymap_markers_path) {
global $player_file_age_expired_max_seconds; global $player_file_age_expired_max_seconds;
global $player_file_age_idle_max_seconds; global $player_file_age_idle_max_seconds;
global $show_expired_players_enable; global $show_expired_players_enable;
if ($show_expired_players_enable===true) {
echo "show_expired_players_enable:true";
}
$markers=array(); $markers=array();
$markers_count=0; $markers_count=0;
if (is_dir($chunkymap_markers_path)) { if (is_dir($chunkymap_markers_path)) {
@ -289,9 +292,15 @@ function get_markers_from_dir($chunkymap_markers_path) {
$last_player_update_time = strtotime($marker_vars["utc_mtime"]); $last_player_update_time = strtotime($marker_vars["utc_mtime"]);
if (time()-$last_player_update_time > $player_file_age_expired_max_seconds) { if (time()-$last_player_update_time > $player_file_age_expired_max_seconds) {
$is_expired=true; $is_expired=true;
echo "expired<br/>"."\n";
} }
elseif (time()-$last_player_update_time > $player_file_age_idle_max_seconds) { elseif (time()-$last_player_update_time > $player_file_age_idle_max_seconds) {
$is_idle=true; $is_idle=true;
echo "idle<br/>"."\n";
}
else {
echo "not expired since ".$marker_vars["name"]."'s utc_mtime is ".DATE("Y-m-d H:i",$last_player_update_time)." <br/>"."\n";
echo " current date is ".DATE("Y-m-d H:i",time())." <br/>"."\n";
} }
if ($is_expired===false) { if ($is_expired===false) {
$markers[$markers_count]["utc_mtime"] = $marker_vars["utc_mtime"]; $markers[$markers_count]["utc_mtime"] = $marker_vars["utc_mtime"];
@ -1348,13 +1357,14 @@ function echo_chunkymap_canvas($show_player_names_enable, $decachunks_enable, $c
$text = $this_player["name"]; $text = $this_player["name"];
} }
} }
if ($this_player["is_expired"]===true) { //should only be used for debug //if ($this_player["is_expired"]===true) { //should only be used for debug
$img_border_style="border: 1px solid rgba(128,128,128,.5);"; // $img_border_style="border: 1px solid rgba(128,128,128,.5);";
$img_style.="opacity: 0.1; filter: alpha(opacity=10);"; //filter is for IE8 and below // $img_style.="opacity: 0.1; filter: alpha(opacity=10);"; //filter is for IE8 and below
$text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below // $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
$text.=" (expired)"; // $text.=" (expired)";
} //}
elseif ($this_player["is_idle"]===true) { //elseif
if ($this_player["is_idle"]===true) {
$img_border_style="border: 1px solid rgba(128,128,128,.5);"; $img_border_style="border: 1px solid rgba(128,128,128,.5);";
$img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below $img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
$text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
@ -1400,13 +1410,14 @@ function echo_chunkymap_canvas($show_player_names_enable, $decachunks_enable, $c
if (isset($this_marker["name"])) { if (isset($this_marker["name"])) {
$text = $this_marker["name"]; $text = $this_marker["name"];
} }
if ($this_marker["is_expired"]===true) { //should only be used for debug //if ($this_marker["is_expired"]===true) { //should only be used for debug
$img_border_style="border: 1px solid rgba(128,128,128,.5);"; // $img_border_style="border: 1px solid rgba(128,128,128,.5);";
$img_style.="opacity: 0.1; filter: alpha(opacity=10);"; //filter is for IE8 and below // $img_style.="opacity: 0.1; filter: alpha(opacity=10);"; //filter is for IE8 and below
$text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below // $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
$text.=" (expired)"; // $text.=" (expired)";
} //}
elseif ($this_marker["is_idle"]===true) { //else
if ($this_marker["is_idle"]===true) {
$img_border_style="border: 1px solid rgba(128,128,128,.5);"; $img_border_style="border: 1px solid rgba(128,128,128,.5);";
$img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below $img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below
$text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below

Loading…
Cancel
Save