From a6a08103bbd95dcb1a1d69b1de04415a2a708044 Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Mon, 13 Jul 2020 09:14:29 +0200 Subject: [PATCH] Modification to have url into title_process_cb (instead of only title) --- announce_url_title.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/announce_url_title.py b/announce_url_title.py index acca4aa..019f8af 100644 --- a/announce_url_title.py +++ b/announce_url_title.py @@ -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