Improve PEP and PubSub publishing mechanism;
Change label to value for fixed fields of data forms.
This commit is contained in:
parent
70a62d3e33
commit
735ce58178
4 changed files with 32 additions and 21 deletions
|
@ -1370,10 +1370,16 @@ class FeedTask:
|
|||
# self.check_updates(jid)
|
||||
# )
|
||||
|
||||
|
||||
# Consider an endless loop. See XmppPubsubTask.loop_task
|
||||
# def restart_task(self, jid_bare):
|
||||
|
||||
async def loop_task(self, jid_bare):
|
||||
await asyncio.sleep(60)
|
||||
while True:
|
||||
logger.info('Looping task "check" for JID {}'.format(jid_bare))
|
||||
print('Looping task "check" for JID {}'.format(jid_bare))
|
||||
await FeedTask.check_updates(self, jid_bare)
|
||||
await asyncio.sleep(60 * 60)
|
||||
|
||||
def restart_task(self, jid_bare):
|
||||
if jid_bare not in self.task_manager:
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
__version__ = '0.1.96'
|
||||
__version_info__ = (0, 1, 96)
|
||||
__version__ = '0.1.97'
|
||||
__version_info__ = (0, 1, 97)
|
||||
|
|
|
@ -383,20 +383,25 @@ class XmppClient(slixmpp.ClientXMPP):
|
|||
print('POSIX sockets: Initiating IPC server...')
|
||||
self.ipc = asyncio.create_task(XmppIpcServer.ipc(self))
|
||||
|
||||
while True:
|
||||
results = await XmppPubsub.get_pubsub_services(self)
|
||||
for result in results + [{'jid' : self.boundjid.bare,
|
||||
'name' : self.alias}]:
|
||||
jid_bare = result['jid']
|
||||
if jid_bare not in self.settings:
|
||||
db_file = config.get_pathname_to_database(jid_bare)
|
||||
Config.add_settings_jid(self, jid_bare, db_file)
|
||||
#await FeedTask.check_updates(self, jid_bare)
|
||||
#await XmppPubsubTask.task_publish(self, jid_bare)
|
||||
FeedTask.restart_task(self, jid_bare)
|
||||
#XmppPubsubTask.loop_task(self, jid_bare)
|
||||
XmppPubsubTask.restart_task(self, jid_bare)
|
||||
await asyncio.sleep(60 * 180)
|
||||
results = await XmppPubsub.get_pubsub_services(self)
|
||||
for result in results + [{'jid' : self.boundjid.bare,
|
||||
'name' : self.alias}]:
|
||||
jid_bare = result['jid']
|
||||
if jid_bare not in self.settings:
|
||||
db_file = config.get_pathname_to_database(jid_bare)
|
||||
Config.add_settings_jid(self, jid_bare, db_file)
|
||||
#await XmppPubsubTask.task_publish(self, jid_bare)
|
||||
#await FeedTask.check_updates(self, jid_bare)
|
||||
#XmppPubsubTask.restart_task(self, jid_bare)
|
||||
#FeedTask.restart_task(self, jid_bare)
|
||||
#tasks = [
|
||||
# asyncio.create_task(XmppPubsubTask.loop_task(self, jid_bare)),
|
||||
# asyncio.create_task(FeedTask.loop_task(self, jid_bare))
|
||||
#]
|
||||
#await asyncio.gather(*tasks)
|
||||
asyncio.create_task(FeedTask.loop_task(self, jid_bare))
|
||||
asyncio.create_task(XmppPubsubTask.loop_task(self, jid_bare)),
|
||||
print('End')
|
||||
|
||||
time_end = time.time()
|
||||
difference = time_end - time_begin
|
||||
|
@ -2795,7 +2800,7 @@ class XmppClient(slixmpp.ClientXMPP):
|
|||
if e_key == 'Name':
|
||||
desc = entry['desc'] if 'desc' in entry and entry['desc'] else None
|
||||
form.add_field(ftype='fixed',
|
||||
label=e_val,
|
||||
value=e_val,
|
||||
desc=desc)
|
||||
continue
|
||||
if e_key == 'Desc':
|
||||
|
|
|
@ -19,7 +19,6 @@ from slixfeed.syndication import Feed
|
|||
from slixfeed.utilities import String, Url, Utilities
|
||||
from slixfeed.xmpp.iq import XmppIQ
|
||||
import sys
|
||||
import time
|
||||
|
||||
logger = Logger(__name__)
|
||||
|
||||
|
@ -378,11 +377,12 @@ class XmppPubsubAction:
|
|||
class XmppPubsubTask:
|
||||
|
||||
|
||||
def loop_task(self, jid_bare):
|
||||
async def loop_task(self, jid_bare):
|
||||
db_file = config.get_pathname_to_database(jid_bare)
|
||||
if jid_bare not in self.settings:
|
||||
Config.add_settings_jid(self, jid_bare, db_file)
|
||||
while True:
|
||||
print('Looping task "publish" for JID {}'.format(jid_bare))
|
||||
if jid_bare not in self.task_manager:
|
||||
self.task_manager[jid_bare] = {}
|
||||
logger.info('Creating new task manager for JID {}'.format(jid_bare))
|
||||
|
@ -395,7 +395,7 @@ class XmppPubsubTask:
|
|||
logger.info('Starting tasks "publish" for JID {}'.format(jid_bare))
|
||||
self.task_manager[jid_bare]['publish'] = asyncio.create_task(
|
||||
XmppPubsubAction.send_unread_items(self, jid_bare))
|
||||
time.sleep(60 * 180)
|
||||
await asyncio.sleep(60 * 180)
|
||||
|
||||
|
||||
def restart_task(self, jid_bare):
|
||||
|
|
Loading…
Reference in a new issue