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.

This commit is contained in:
Schimon Jehudah 2024-04-14 17:24:16 +00:00
parent bcbbf1ab04
commit 87dc369b35
5 changed files with 12 additions and 7 deletions

View file

@ -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,

View file

@ -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:

View file

@ -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))

View file

@ -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

View file

@ -1,2 +1,2 @@
__version__ = '0.1.58'
__version_info__ = (0, 1, 58)
__version__ = '0.1.59'
__version_info__ = (0, 1, 59)