From 22a39219156dad77bd27e22c6e1c2fb5876cf7ae Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Mon, 17 Jun 2024 20:10:50 +0300 Subject: [PATCH] Remove a reference to module slixfed.dt which does not exist (Thank you lorenzo). --- slixfeed/log.py | 11 ++++++++++- slixfeed/syndication.py | 6 ++---- slixfeed/utilities.py | 3 +-- slixfeed/xmpp/groupchat.py | 5 +++-- slixfeed/xmpp/muc.py | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/slixfeed/log.py b/slixfeed/log.py index 3696b6f..f673642 100644 --- a/slixfeed/log.py +++ b/slixfeed/log.py @@ -3,6 +3,8 @@ """ +TODO Rename module to console or print + To use this class, first, instantiate Logger with the name of your module or class, then call the appropriate logging methods on that instance. @@ -46,4 +48,11 @@ class Logger: # def check_difference(function_name, difference): # if difference > 1: - # Logger.warning(message) \ No newline at end of file + # Logger.warning(message) + + +class Message: + + + def printer(text): + print(text, end='\r') diff --git a/slixfeed/syndication.py b/slixfeed/syndication.py index 71001f8..9104685 100644 --- a/slixfeed/syndication.py +++ b/slixfeed/syndication.py @@ -32,8 +32,7 @@ from slixfeed.config import Config import slixfeed.fetch as fetch from slixfeed.log import Logger import slixfeed.sqlite as sqlite -from slixfeed.utilities import DateAndTime, String, Url -from slixfeed.utilities import Html, MD, String, Utilities +from slixfeed.utilities import DateAndTime, Html, MD, String, Url, Utilities from slixmpp.xmlstream import ET import sys from urllib.parse import urlsplit @@ -1333,7 +1332,7 @@ class FeedTask: url, entry_identifier, entry) # new_entries.append(new_entry) new_entries.extend([new_entry]) - print(url) + print(url, end='\r') if new_entries: await sqlite.add_entries_and_update_feed_state(db_file, feed_id, new_entries) limit = Config.get_setting_value(self.settings, jid_bare, 'archive') @@ -1357,7 +1356,6 @@ class FeedTask: continue if not valid: ixs_invalid[ix] = read_status if len(ixs_invalid): - print('erasing {}/{}'.format(len(ixs_invalid), len(feed.entries))) await sqlite.process_invalid_entries(db_file, ixs_invalid) # TODO return number of archived entries and add if statement to run archive maintainence function await sqlite.maintain_archive(db_file, limit) diff --git a/slixfeed/utilities.py b/slixfeed/utilities.py index a1ddf47..7655386 100644 --- a/slixfeed/utilities.py +++ b/slixfeed/utilities.py @@ -47,7 +47,6 @@ from lxml import etree, html import os import random import slixfeed.config as config -import slixfeed.dt as dt import slixfeed.fetch as fetch from slixfeed.log import Logger import sys @@ -282,7 +281,7 @@ class MD: file.write('- [{}]({})\n'.format(result[1], result[2])) file.write('\n\n* * *\n\nThis list was saved on {} from xmpp:{} using ' '[Slixfeed](https://slixfeed.woodpeckersnest.space/)\n' - .format(dt.current_date(), jid)) + .format(DateAndTime.current_date(), jid)) def log_to_markdown(timestamp, filename, jid, message): diff --git a/slixfeed/xmpp/groupchat.py b/slixfeed/xmpp/groupchat.py index 61d3e44..ea54622 100644 --- a/slixfeed/xmpp/groupchat.py +++ b/slixfeed/xmpp/groupchat.py @@ -18,7 +18,7 @@ FIXME """ from slixfeed.xmpp.bookmark import XmppBookmark from slixfeed.xmpp.muc import XmppMuc -from slixfeed.log import Logger +from slixfeed.log import Logger, Message logger = Logger(__name__) @@ -34,8 +34,9 @@ class XmppGroupchat: 'bookmark {}'.format(bookmark['name'])) alias = bookmark["nick"] muc_jid = bookmark["jid"] + + Message.printer('Joining MUC {} ...'.format(muc_jid)) result = await XmppMuc.join(self, muc_jid, alias) - print(result) if result == 'ban': await XmppBookmark.remove(self, muc_jid) logger.warning('{} is banned from {}'.format(self.alias, muc_jid)) diff --git a/slixfeed/xmpp/muc.py b/slixfeed/xmpp/muc.py index 679af1f..55ed444 100644 --- a/slixfeed/xmpp/muc.py +++ b/slixfeed/xmpp/muc.py @@ -57,7 +57,7 @@ class XmppMuc: seconds=0, since=0, timeout=30) - result = 'joined ' + jid + result = 'success' except IqError as e: logger.error('Error XmppIQ') logger.error(str(e))