Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add different tz support #95

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tgarchive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"rss_feed_entries": 100,

"publish_dir": "site",
"publish_timezone": "America/New_York",
"site_url": "https://mysite.com",
"static_dir": "static",
"telegram_url": "https://t.me/{id}",
Expand Down
5 changes: 4 additions & 1 deletion tgarchive/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from feedgen.feed import FeedGenerator
from jinja2 import Template
import pytz

from .db import User, Message

Expand Down Expand Up @@ -143,7 +144,9 @@ def _build_rss(self, messages, rss_file, atom_file):
e = f.add_entry()
e.id(url)
e.title("@{} on {} (#{})".format(m.user.username, m.date, m.id))
e.published(m.date.replace(tzinfo=timezone.utc))
# e.published(m.date.replace(tzinfo=timezone.utc))
# e.published(m.date.replace(tzinfo=self.config["publish_timezone"]))
e.published(m.date.replace(tzinfo=pytz.utc).astimezone(pytz.timezone(self.config["publish_timezone"])))
e.link({"href": url})

media_mime = ""
Expand Down
1 change: 1 addition & 0 deletions tgarchive/example/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fetch_wait: 5
fetch_limit: 0

publish_dir: "site"
publish_timezone: "America/New_York"
static_dir: "static"
per_page: 500
show_day_index: True
Expand Down