Modification to have url into title_process_cb (instead of only title)

This commit is contained in:
Alarig Le Lay 2020-07-13 09:14:29 +02:00
parent 39d5f5762c
commit a6a08103bb
Signed by: alarig
GPG Key ID: 7AFE62C6DF8BCDEC
1 changed files with 8 additions and 3 deletions

View File

@ -257,19 +257,22 @@ def url_process_launcher():
if not url_d: # empty dict means not launched
url_d['launched'] = now()
title = get_title(url)
url_d['title'] = get_title(url)
url_d['stdout'] = ''
url_d['url_hook_process'] = w.hook_process(title, 30 * 1000, "title_process_cb", "")
url_d['url_hook_process'] = w.hook_process(url, 30 * 1000, "title_process_cb", "")
return w.WEECHAT_RC_OK
def title_process_cb(data, title, rc, stdout, stderr):
def title_process_cb(data, url, rc, stdout, stderr):
""" Callback parsing html for title """
global buffer_name, urls
url_d = urls[url]
title = url_d['title']
max_len = int(w.config_get_plugin('title_max_length'))
if len(title) > max_len:
title = "%s [...]" % title[0:max_len]
@ -294,6 +297,8 @@ def title_process_cb(data, title, rc, stdout, stderr):
else:
say(output,w.buffer_search('', buffer_name))
urls[url]['stdout'] = ''
return w.WEECHAT_RC_OK