removed timezone support: it made no sense, as logs are generated from the server anyway
This commit is contained in:
parent
a7ba063ef8
commit
327e3496e3
@ -2,8 +2,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime
|
||||||
import pytz
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from mimetypes import guess_type
|
from mimetypes import guess_type
|
||||||
import jinja2
|
import jinja2
|
||||||
@ -103,8 +102,7 @@ class Logbot(Bot):
|
|||||||
if "@" in folder_name: # hacky
|
if "@" in folder_name: # hacky
|
||||||
folder_name = self._parse_room_name(folder_name)
|
folder_name = self._parse_room_name(folder_name)
|
||||||
feed_path = os.path.join(self.output, folder_name, "feed.rss.xml")
|
feed_path = os.path.join(self.output, folder_name, "feed.rss.xml")
|
||||||
local_timezone = str(datetime.now(timezone.utc).astimezone().tzinfo)
|
date = datetime.now().strftime("%a, %d %b %Y %H:%M:%S")
|
||||||
date = datetime.now(pytz.timezone(local_timezone)).strftime("%a, %d %b %Y %H:%M:%S %Z") # logs are saved with local timezone
|
|
||||||
print(date)
|
print(date)
|
||||||
template = jinja2.Template(open("template.rss").read()) # self.feedtemplate would be useful to have in the conf
|
template = jinja2.Template(open("template.rss").read()) # self.feedtemplate would be useful to have in the conf
|
||||||
with open(feed_path, "w") as out:
|
with open(feed_path, "w") as out:
|
||||||
@ -123,8 +121,7 @@ class Logbot(Bot):
|
|||||||
"""Save new entry to database."""
|
"""Save new entry to database."""
|
||||||
keys = [x for x in self.db[message.room]["messages"].keys()]
|
keys = [x for x in self.db[message.room]["messages"].keys()]
|
||||||
keys.sort(key=int)
|
keys.sort(key=int)
|
||||||
local_timezone = str(datetime.now(timezone.utc).astimezone().tzinfo)
|
date = datetime.now().strftime("%a, %d %b %Y %H:%M:%S")
|
||||||
date = datetime.now(pytz.timezone(local_timezone)).strftime("%a, %d %b %Y %H:%M:%S %Z") # logs are saved with local timezone
|
|
||||||
if not keys:
|
if not keys:
|
||||||
new_key = "0"
|
new_key = "0"
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user