Fix export (Thank you roughnecks).
Load commands first at session start (New PubSub related code might block or postpone commands from being loaded).
This commit is contained in:
parent
5507b16161
commit
df7cc6ed2b
5 changed files with 12 additions and 12 deletions
|
@ -92,7 +92,7 @@ except ImportError:
|
||||||
'Arc90 Lab algorithm is disabled.')
|
'Arc90 Lab algorithm is disabled.')
|
||||||
|
|
||||||
|
|
||||||
async def export_feeds(self, jid, jid_file, ext):
|
def export_feeds(self, jid, jid_file, ext):
|
||||||
function_name = sys._getframe().f_code.co_name
|
function_name = sys._getframe().f_code.co_name
|
||||||
logger.debug('{}: jid: {}: jid_file: {}: ext: {}'.format(function_name, jid, jid_file, ext))
|
logger.debug('{}: jid: {}: jid_file: {}: ext: {}'.format(function_name, jid, jid_file, ext))
|
||||||
cache_dir = config.get_default_cache_directory()
|
cache_dir = config.get_default_cache_directory()
|
||||||
|
@ -757,7 +757,7 @@ def export_to_markdown(jid, filename, results):
|
||||||
file.write('# Subscriptions for {}\n'.format(jid))
|
file.write('# Subscriptions for {}\n'.format(jid))
|
||||||
file.write('## Set of feeds exported with Slixfeed\n')
|
file.write('## Set of feeds exported with Slixfeed\n')
|
||||||
for result in results:
|
for result in results:
|
||||||
file.write('- [{}]({})\n'.format(result[0], result[1]))
|
file.write('- [{}]({})\n'.format(result[1], result[2]))
|
||||||
file.write('\n\n* * *\n\nThis list was saved on {} from xmpp:{} using '
|
file.write('\n\n* * *\n\nThis list was saved on {} from xmpp:{} using '
|
||||||
'[Slixfeed](https://gitgud.io/sjehuda/slixfeed)\n'
|
'[Slixfeed](https://gitgud.io/sjehuda/slixfeed)\n'
|
||||||
.format(dt.current_date(), jid))
|
.format(dt.current_date(), jid))
|
||||||
|
@ -765,6 +765,7 @@ def export_to_markdown(jid, filename, results):
|
||||||
|
|
||||||
# TODO Consider adding element jid as a pointer of import
|
# TODO Consider adding element jid as a pointer of import
|
||||||
def export_to_opml(jid, filename, results):
|
def export_to_opml(jid, filename, results):
|
||||||
|
print(jid, filename, results)
|
||||||
function_name = sys._getframe().f_code.co_name
|
function_name = sys._getframe().f_code.co_name
|
||||||
logger.debug('{} jid: {} filename: {}'
|
logger.debug('{} jid: {} filename: {}'
|
||||||
.format(function_name, jid, filename))
|
.format(function_name, jid, filename))
|
||||||
|
@ -783,8 +784,8 @@ def export_to_opml(jid, filename, results):
|
||||||
body = ET.SubElement(root, "body")
|
body = ET.SubElement(root, "body")
|
||||||
for result in results:
|
for result in results:
|
||||||
outline = ET.SubElement(body, "outline")
|
outline = ET.SubElement(body, "outline")
|
||||||
outline.set("text", result[0])
|
outline.set("text", result[1])
|
||||||
outline.set("xmlUrl", result[1])
|
outline.set("xmlUrl", result[2])
|
||||||
# outline.set("type", result[2])
|
# outline.set("type", result[2])
|
||||||
tree = ET.ElementTree(root)
|
tree = ET.ElementTree(root)
|
||||||
tree.write(filename)
|
tree.write(filename)
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
__version__ = '0.1.48'
|
__version__ = '0.1.49'
|
||||||
__version_info__ = (0, 1, 48)
|
__version_info__ = (0, 1, 49)
|
||||||
|
|
|
@ -277,6 +277,7 @@ class Slixfeed(slixmpp.ClientXMPP):
|
||||||
message_log = '{}'
|
message_log = '{}'
|
||||||
logger.debug(message_log.format(function_name))
|
logger.debug(message_log.format(function_name))
|
||||||
status_message = 'Slixfeed version {}'.format(__version__)
|
status_message = 'Slixfeed version {}'.format(__version__)
|
||||||
|
self.adhoc_commands()
|
||||||
for operator in self.operators:
|
for operator in self.operators:
|
||||||
XmppPresence.send(self, operator['jid'], status_message)
|
XmppPresence.send(self, operator['jid'], status_message)
|
||||||
await profile.update(self)
|
await profile.update(self)
|
||||||
|
@ -294,7 +295,6 @@ class Slixfeed(slixmpp.ClientXMPP):
|
||||||
Config.add_settings_jid(self.settings, jid_bare, db_file)
|
Config.add_settings_jid(self.settings, jid_bare, db_file)
|
||||||
await task.start_tasks_xmpp_pubsub(self, jid_bare)
|
await task.start_tasks_xmpp_pubsub(self, jid_bare)
|
||||||
# XmppCommand.adhoc_commands(self)
|
# XmppCommand.adhoc_commands(self)
|
||||||
self.adhoc_commands()
|
|
||||||
# self.service_reactions()
|
# self.service_reactions()
|
||||||
task.task_ping(self)
|
task.task_ping(self)
|
||||||
time_end = time.time()
|
time_end = time.time()
|
||||||
|
@ -2589,7 +2589,7 @@ class Slixfeed(slixmpp.ClientXMPP):
|
||||||
# form['instructions'] = ('✅️ Feeds have been exported')
|
# form['instructions'] = ('✅️ Feeds have been exported')
|
||||||
exts = payload['values']['filetype']
|
exts = payload['values']['filetype']
|
||||||
for ext in exts:
|
for ext in exts:
|
||||||
filename = await action.export_feeds(self, jid_bare, jid_file, ext)
|
filename = action.export_feeds(self, jid_bare, jid_file, ext)
|
||||||
url = await XmppUpload.start(self, jid_bare, filename)
|
url = await XmppUpload.start(self, jid_bare, filename)
|
||||||
chat_type = await get_chat_type(self, jid_bare)
|
chat_type = await get_chat_type(self, jid_bare)
|
||||||
XmppMessage.send_oob(self, jid_bare, url, chat_type)
|
XmppMessage.send_oob(self, jid_bare, url, chat_type)
|
||||||
|
|
|
@ -239,6 +239,7 @@ class SlixfeedComponent(slixmpp.ComponentXMPP):
|
||||||
message_log = '{}'
|
message_log = '{}'
|
||||||
logger.debug(message_log.format(function_name))
|
logger.debug(message_log.format(function_name))
|
||||||
status_message = 'Slixfeed version {}'.format(__version__)
|
status_message = 'Slixfeed version {}'.format(__version__)
|
||||||
|
self.adhoc_commands()
|
||||||
for operator in self.operators:
|
for operator in self.operators:
|
||||||
XmppPresence.send(self, operator['jid'], status_message)
|
XmppPresence.send(self, operator['jid'], status_message)
|
||||||
await profile.update(self)
|
await profile.update(self)
|
||||||
|
@ -256,7 +257,6 @@ class SlixfeedComponent(slixmpp.ComponentXMPP):
|
||||||
Config.add_settings_jid(self.settings, jid_bare, db_file)
|
Config.add_settings_jid(self.settings, jid_bare, db_file)
|
||||||
await task.start_tasks_xmpp_pubsub(self, jid_bare)
|
await task.start_tasks_xmpp_pubsub(self, jid_bare)
|
||||||
# XmppCommand.adhoc_commands(self)
|
# XmppCommand.adhoc_commands(self)
|
||||||
self.adhoc_commands()
|
|
||||||
# self.service_reactions()
|
# self.service_reactions()
|
||||||
task.task_ping(self)
|
task.task_ping(self)
|
||||||
time_end = time.time()
|
time_end = time.time()
|
||||||
|
@ -2550,7 +2550,7 @@ class SlixfeedComponent(slixmpp.ComponentXMPP):
|
||||||
# form['instructions'] = ('✅️ Feeds have been exported')
|
# form['instructions'] = ('✅️ Feeds have been exported')
|
||||||
exts = payload['values']['filetype']
|
exts = payload['values']['filetype']
|
||||||
for ext in exts:
|
for ext in exts:
|
||||||
filename = await action.export_feeds(self, jid_bare, jid_file, ext)
|
filename = action.export_feeds(self, jid_bare, jid_file, ext)
|
||||||
url = await XmppUpload.start(self, jid_bare, filename)
|
url = await XmppUpload.start(self, jid_bare, filename)
|
||||||
chat_type = await get_chat_type(self, jid_bare)
|
chat_type = await get_chat_type(self, jid_bare)
|
||||||
XmppMessage.send_oob(self, jid_bare, url, chat_type)
|
XmppMessage.send_oob(self, jid_bare, url, chat_type)
|
||||||
|
|
|
@ -538,8 +538,7 @@ async def message(self, message):
|
||||||
# self.pending_tasks[jid_bare][self.pending_tasks_counter] = status_message
|
# self.pending_tasks[jid_bare][self.pending_tasks_counter] = status_message
|
||||||
XmppPresence.send(self, jid_bare, status_message,
|
XmppPresence.send(self, jid_bare, status_message,
|
||||||
status_type=status_type)
|
status_type=status_type)
|
||||||
filename = await action.export_feeds(self, jid_bare,
|
filename = action.export_feeds(self, jid_bare, jid_file, ext)
|
||||||
jid_file, ext)
|
|
||||||
url = await XmppUpload.start(self, jid_bare, filename)
|
url = await XmppUpload.start(self, jid_bare, filename)
|
||||||
# response = (
|
# response = (
|
||||||
# 'Feeds exported successfully to {}.\n{}'
|
# 'Feeds exported successfully to {}.\n{}'
|
||||||
|
|
Loading…
Reference in a new issue