diff --git a/sausage_bot/cogs/rss.py b/sausage_bot/cogs/rss.py index daed24d..e2c263e 100755 --- a/sausage_bot/cogs/rss.py +++ b/sausage_bot/cogs/rss.py @@ -99,6 +99,7 @@ async def control_posting(feed_type, action): feed_type_in = [] failed_list = [] feed_type_list = [] + feed_types = '' actions = { 'start': {'status_update': 'started'}, 'stop': {'status_update': 'stopped'}, @@ -112,7 +113,8 @@ async def control_posting(feed_type, action): feed_type_in.append(feed_type) for feed_type in feed_type_in: try: - eval(f'RSSfeed.post_{feed_type}.{action}()') + log.verbose(f'RSSfeed.{feed_type}_posting.{action}()') + eval(f'RSSfeed.{feed_type}_posting.{action}()') feed_type_list.append(feed_type) except RuntimeError: failed_list.append(feed_type) @@ -133,8 +135,9 @@ async def control_posting(feed_type, action): feed_types = ', '.join(feed_type_list) if len(failed_list) > 0: failed_list_text = ', '.join(failed_list) + _msg = '' if len(feed_types) > 0: - _msg = I18N.t( + _msg += I18N.t( f'rss.commands.{action}.msg_confirm_ok', feed_type=feed_types ) @@ -179,7 +182,7 @@ def __init__(self, bot): @rss_posting_group.command( name='start', description=locale_str(I18N.t('rss.commands.start.cmd')) ) - async def rss_posting_start( + async def feeds_posting_start( self, interaction: discord.Interaction, feed_type: typing.Literal[ 'feeds', 'podcasts', 'ALL' ] @@ -191,7 +194,7 @@ async def rss_posting_start( @rss_posting_group.command( name='stop', description=locale_str(I18N.t('rss.commands.stop.cmd')) ) - async def rss_posting_stop( + async def feeds_posting_stop( self, interaction: discord.Interaction, feed_type: typing.Literal[ 'feeds', 'podcasts', 'ALL' ] @@ -205,7 +208,7 @@ async def rss_posting_stop( 'rss.commands.restart.cmd' )) ) - async def rss_posting_restart( + async def feeds_posting_restart( self, interaction: discord.Interaction, feed_type: typing.Literal[ 'feeds', 'podcasts', 'ALL' ] @@ -355,21 +358,21 @@ async def rss_edit( updates_in.append(('feed_name', new_feed_name)) changes_out += '\n- {}: `{}` -> `{}`'.format( I18N.t('rss.commands.edit.changes_out.feed_name'), - feed_info[0][0], + feed_info[0]['feed_name'], new_feed_name ) if channel: updates_in.append(('channel', channel)) changes_out += '\n- {}: `{}` -> `{}`'.format( I18N.t('rss.commands.edit.changes_out.channel'), - feed_info[0][1], + feed_info[0]['channel'], channel ) if url: updates_in.append(('url', url)) changes_out += '\n- {}: `{}` -> `{}`'.format( I18N.t('rss.commands.edit.changes_out.url'), - feed_info[0][2], + feed_info[0]['url'], url ) await db_helper.update_fields( diff --git a/sausage_bot/util/db_helper.py b/sausage_bot/util/db_helper.py index d03c4cc..bd1d552 100755 --- a/sausage_bot/util/db_helper.py +++ b/sausage_bot/util/db_helper.py @@ -151,13 +151,13 @@ async def add_missing_db_setup( template_info=template_info, select=('setting', 'value') ) + db_out_cols = [col['setting'] for col in db_out] + log.verbose(f'Got `inserts`: {inserts}') log.verbose(f'Got `db_out`: {db_out}') - db_out = dict(db_out) - log.verbose(f'Got `dict(db_out)`: {db_out}') for insert in inserts: - if insert[0] not in db_out: + if insert[0] not in db_out_cols: temp_inserts.append(insert) - elif insert[0] in db_out and db_out[insert[0]] is None: + elif insert[0] in db_out and db_out[db_out_cols.index(insert[0])] is None: temp_inserts.append(insert) log.debug(f'temp_inserts: {temp_inserts}') if len(temp_inserts) > 0: diff --git a/sausage_bot/util/feeds_core.py b/sausage_bot/util/feeds_core.py index ca5e207..f338d28 100755 --- a/sausage_bot/util/feeds_core.py +++ b/sausage_bot/util/feeds_core.py @@ -212,7 +212,7 @@ async def add_to_feed_db( async def remove_feed_from_db(feed_type, feed_name): 'Remove a feed from `feed file` based on `feed_name`' removal_ok = True - if feed_type == 'rss': + if feed_type in ['rss', 'spotify']: feed_db = envs.rss_db_schema feed_db_filter = envs.rss_db_filter_schema elif feed_type == 'youtube': @@ -224,6 +224,7 @@ async def remove_feed_from_db(feed_type, feed_name): where=[('feed_name', feed_name)], single=True ) + uuid_from_db = uuid_from_db['uuid'] log.debug(f'`uuid_from_db` is {uuid_from_db}') removal = await db_helper.del_row_by_AND_filter( feed_db,