From 87dc369b359523a3c9ecd4ab3a0dfe8cdf638a17 Mon Sep 17 00:00:00 2001 From: Schimon Jehudah Date: Sun, 14 Apr 2024 17:24:16 +0000 Subject: [PATCH] Fix update which halted upon attempt to insert data of feed due to attempt to insert a dict object instead of a string `feed.image.href`. --- slixfeed/action.py | 4 +--- slixfeed/config.py | 1 + slixfeed/sqlite.py | 2 ++ slixfeed/task.py | 8 ++++++-- slixfeed/version.py | 4 ++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/slixfeed/action.py b/slixfeed/action.py index cb9552e..4ba4e49 100644 --- a/slixfeed/action.py +++ b/slixfeed/action.py @@ -1541,7 +1541,7 @@ def get_properties_of_entries(self, jid_bare, db_file, feed_url, feed_id, feed): url : str, optional URL. """ - print('GET', feed_url, jid_bare) + print('MID', feed_url, jid_bare, 'get_properties_of_entries') function_name = sys._getframe().f_code.co_name logger.debug('{}: feed_id: {} url: {}' .format(function_name, feed_id, feed_url)) @@ -1758,8 +1758,6 @@ def get_properties_of_entries(self, jid_bare, db_file, feed_url, feed_id, feed): "updated": entry_updated, "read_status": read_status } - print('entry_properties') - print(entry_properties) new_entries.extend([{ "entry_properties" : entry_properties, diff --git a/slixfeed/config.py b/slixfeed/config.py index 1a58344..8f7d935 100644 --- a/slixfeed/config.py +++ b/slixfeed/config.py @@ -156,6 +156,7 @@ def update_proxies(file, proxy_name, proxy_type, proxy_url, action='remove'): """ data = open_config_file('proxies.toml') proxy_list = data['proxies'][proxy_name][proxy_type] + breakpoint() proxy_index = proxy_list.index(proxy_url) proxy_list.pop(proxy_index) with open(file, 'w') as new_file: diff --git a/slixfeed/sqlite.py b/slixfeed/sqlite.py index ab7ca5c..6699d7e 100644 --- a/slixfeed/sqlite.py +++ b/slixfeed/sqlite.py @@ -2378,6 +2378,7 @@ async def update_feed_status(db_file, feed_id, status_code): status : str Status ID or message. """ + print('MID', feed_id, 'update_feed_status') function_name = sys._getframe().f_code.co_name logger.debug('{}: db_file: {} feed_id: {} status_code: {}' .format(function_name, db_file, feed_id, status_code)) @@ -2448,6 +2449,7 @@ async def update_feed_properties(db_file, feed_id, feed_properties): feed_properties : dict Feed properties. """ + print('MID', feed_id, 'update_feed_properties') function_name = sys._getframe().f_code.co_name logger.debug('{}: db_file: {} feed_id: {} feed_properties: {}' .format(function_name, db_file, feed_id, feed_properties)) diff --git a/slixfeed/task.py b/slixfeed/task.py index 65f2e30..01cd1e3 100644 --- a/slixfeed/task.py +++ b/slixfeed/task.py @@ -363,6 +363,7 @@ async def check_updates(self, jid_bare): feed_id = sqlite.get_feed_id(db_file, url) feed_id = feed_id[0] if not result['error']: + print('MID', 'sqlite.update_feed_status') await sqlite.update_feed_status(db_file, feed_id, status_code) document = result['content'] feed = parse(document) @@ -399,7 +400,7 @@ async def check_updates(self, jid_bare): feed_encoding = feed.encoding if feed.has_key('encoding') else '' feed_language = feed.feed.language if feed.feed.has_key('language') else '' feed_icon = feed.feed.icon if feed.feed.has_key('icon') else '' - feed_image = feed.feed.image if feed.feed.has_key('image') else '' + feed_image = feed.feed.image.href if feed.feed.has_key('image') else '' feed_logo = feed.feed.logo if feed.feed.has_key('logo') else '' feed_ttl = feed.feed.ttl if feed.feed.has_key('ttl') else '' @@ -415,14 +416,17 @@ async def check_updates(self, jid_bare): "ttl" : feed_ttl, "updated" : feed_updated, } + print('MID', 'sqlite.update_feed_properties') + print(feed_properties) await sqlite.update_feed_properties(db_file, feed_id, feed_properties) + print('MID', 'action.get_properties_of_entries') new_entries = action.get_properties_of_entries( self, jid_bare, db_file, url, feed_id, feed) if new_entries: await sqlite.add_entries_and_update_feed_state( db_file, feed_id, new_entries) print('END', url) - await asyncio.sleep(5) + await asyncio.sleep(50) val = Config.get_setting_value(self.settings, jid_bare, 'check') await asyncio.sleep(60 * float(val)) # Schedule to call this function again in 90 minutes diff --git a/slixfeed/version.py b/slixfeed/version.py index e998a61..7eea5dd 100644 --- a/slixfeed/version.py +++ b/slixfeed/version.py @@ -1,2 +1,2 @@ -__version__ = '0.1.58' -__version_info__ = (0, 1, 58) +__version__ = '0.1.59' +__version_info__ = (0, 1, 59)