mirror of
https://github.com/markqvist/LXMF-Tools.git
synced 2024-10-01 03:15:38 -04:00
Improved isocalendar() function compatibility.
This commit is contained in:
parent
9c08b31603
commit
7f167666ed
@ -139,6 +139,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_distribution_group.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -109,6 +109,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_bridge_matrix.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -812,7 +812,12 @@ class lxmf_announce_callback:
|
||||
if len(app_data) == 0:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
|
||||
|
||||
|
@ -104,6 +104,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_bridge_mqtt.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -642,7 +642,19 @@ class lxmf_announce_callback:
|
||||
if len(app_data) == 0:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data_dict = umsgpack.unpackb(app_data)
|
||||
if isinstance(app_data_dict, dict) and "c" in app_data_dict:
|
||||
app_data = app_data_dict["c"]
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
if not CONFIG["main"].getboolean("power") or not CONFIG["router"].getboolean("lxmf_announce_to_mqtt"):
|
||||
log("LXMF - Routing disabled", LOG_DEBUG)
|
||||
@ -651,7 +663,7 @@ class lxmf_announce_callback:
|
||||
if CONFIG.has_option("allowed", "any") or CONFIG.has_option("allowed", "all") or CONFIG.has_option("allowed", "anybody") or CONFIG.has_option("allowed", RNS.hexrep(destination_hash, False)) or CONFIG.has_option("allowed", RNS.prettyhexrep(destination_hash)):
|
||||
message_out = json.dumps({
|
||||
"source": RNS.hexrep(destination_hash, False),
|
||||
"data": app_data.decode("utf-8")
|
||||
"data": app_data
|
||||
})
|
||||
|
||||
MQTT_CONNECTION.publish(CONFIG["mqtt"]["topic_announce"], message_out)
|
||||
|
@ -99,6 +99,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_chatbot.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -640,7 +640,12 @@ class lxmf_announce_callback:
|
||||
if len(app_data) == 0:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
|
||||
|
||||
|
@ -98,6 +98,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_cmd.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -638,7 +638,12 @@ class lxmf_announce_callback:
|
||||
if len(app_data) == 0:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
|
||||
|
||||
|
@ -227,6 +227,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_distribution_group.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -815,7 +815,12 @@ class lxmf_announce_callback:
|
||||
except:
|
||||
pass
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
global DATA
|
||||
|
||||
@ -832,7 +837,7 @@ class lxmf_announce_callback:
|
||||
for (key, val) in DATA.items(section):
|
||||
if key == source_hash:
|
||||
if (val == "" and CONFIG["main"].getboolean("auto_name_def")) or (val != "" and CONFIG["main"].getboolean("auto_name_change")):
|
||||
value = app_data.decode("utf-8").strip()
|
||||
value = app_data
|
||||
if value != DATA[section][key]:
|
||||
if DATA[section][key] == "":
|
||||
content_type = "name_def"
|
||||
@ -3348,7 +3353,7 @@ def statistic_add(section="global", value=1):
|
||||
day = date.timetuple().tm_yday
|
||||
month = date.timetuple().tm_mon
|
||||
year = date.timetuple().tm_year
|
||||
week = date.isocalendar().week
|
||||
week = date.isocalendar()[1]
|
||||
|
||||
#day
|
||||
if STATISTIC[section]["day_index"] == str(day):
|
||||
@ -3389,7 +3394,7 @@ def statistic_recalculate(section="global"):
|
||||
day = date.timetuple().tm_yday
|
||||
month = date.timetuple().tm_mon
|
||||
year = date.timetuple().tm_year
|
||||
week = date.isocalendar().week
|
||||
week = date.isocalendar()[1]
|
||||
|
||||
#day
|
||||
if STATISTIC[section]["day_index"] != str(day):
|
||||
@ -3568,7 +3573,7 @@ def statistic_default(section="global"):
|
||||
day = date.timetuple().tm_yday
|
||||
month = date.timetuple().tm_mon
|
||||
year = date.timetuple().tm_year
|
||||
week = date.isocalendar().week
|
||||
week = date.isocalendar()[1]
|
||||
|
||||
STATISTIC.add_section(section)
|
||||
STATISTIC[section]["day_value"] = "0"
|
||||
|
@ -128,6 +128,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_distribution_group_minimal.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -643,7 +643,12 @@ class lxmf_announce_callback:
|
||||
except:
|
||||
pass
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
|
||||
|
||||
|
@ -99,6 +99,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_echo.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -634,7 +634,12 @@ class lxmf_announce_callback:
|
||||
if len(app_data) == 0:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
|
||||
|
||||
|
@ -121,6 +121,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_provisioning.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -652,7 +652,12 @@ class lxmf_announce_callback:
|
||||
if len(app_data) == 0:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
|
||||
|
||||
|
@ -99,6 +99,7 @@ The full documentation is not yet available. Due to lack of time I can also not
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/root/lxmf_terminal.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@ -735,7 +735,12 @@ class lxmf_announce_callback:
|
||||
if len(app_data) == 0:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data.decode("utf-8"), LOG_INFO)
|
||||
try:
|
||||
app_data = app_data.decode("utf-8").strip()
|
||||
except:
|
||||
return
|
||||
|
||||
log("LXMF - Received an announce from " + RNS.prettyhexrep(destination_hash) + ": " + app_data, LOG_INFO)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user