diff --git a/Dockerfile b/Dockerfile index cae079c..5719a30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,10 @@ -# DiscoRSS Dockerfile -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - FROM python:3.13.2-alpine3.21 WORKDIR /usr/src/app COPY discorss.py ./ -RUN mkdir /root/.config -RUN mkdir /root/.config/discorss -COPY discorss.conf /root/.config/discorss +COPY discorss.conf /etc/ RUN pip install --no-cache-dir requests feedparser -CMD [ "python", "discorss.py" ] - -LABEL author="A.M. Rowsell " +CMD [ "python", "discorss.py" ] \ No newline at end of file diff --git a/discorss.py b/discorss.py index 5ad3ad0..2d3afd0 100755 --- a/discorss.py +++ b/discorss.py @@ -8,7 +8,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # DiscoRSS: A simple RSS feed reader for Discord. Takes RSS feeds and then sends them to -# webhooks. Intended to run using systemd timers, or as a Docker container. +# webhooks. Intended to run using systemd timers. import requests import feedparser @@ -53,6 +53,7 @@ def get_description(feed, length=250, min_length=150, addons=None): break else: length -= 1 + desc = temporary_string[:length] except KeyError: temporary_string = str(feed["description"]) temporary_string = html_filter.sub("", temporary_string) @@ -61,10 +62,7 @@ def get_description(feed, length=250, min_length=150, addons=None): break else: length -= 1 - - desc = temporary_string[:length] - if addons is not None: - desc = desc + str(addons) + desc = temporary_string[:length] return desc @@ -103,7 +101,7 @@ def setupPaths(): logging.basicConfig( filename=str(log_dir + log_file_path), encoding="utf-8", - level=logging.WARNING, + level=logging.INFO, datefmt="%m/%d/%Y %H:%M:%S", format="%(asctime)s: %(levelname)s: %(message)s", ) @@ -138,7 +136,7 @@ def main(): else: continue if bad_time is True: - logger.info( + logger.warning( "Feed %s doesn't supply a published time, using updated time instead", hook["name"], ) @@ -212,10 +210,9 @@ def main(): if __name__ == "__main__": - try: - if os.environ["INVOCATION_ID"]: - main() - except KeyError: + if os.environ["INVOCATION_ID"]: + main() + else: try: while True: main()