Documents coub.com feature for SpiffyTitles and adds coubHandlerEnabled option

to be consistent with the other handlers.
This commit is contained in:
PrgmrBill 2015-06-07 09:40:24 -04:00
parent 1bfa1b3ed4
commit 580960c712
3 changed files with 18 additions and 2 deletions

View File

@ -123,6 +123,16 @@ Example output:
- If you see something from [the imgur api](https://api.imgur.com/models/image) that you want and is not available
in the above example, [please open an issue!](https://github.com/prgmrbill/limnoria-plugins/issues/new)
### coub handler
`coubTemplate` - Template for [coub](http://coub.com) links.
Default value: `^ {%if not_safe_for_work %}NSFW{% endif %} [{{channel.title}}] {{title}} :: {{views_count}} views :: {{likes_count}} likes :: {{recoubs_count}} recoubs`
`coubHandlerEnabled` - Whether to enable additional information about coub videos.
## Other options
`useBold` - Whether to bold the title. Default value: `False`
`linkCacheLifetimeInSeconds` - Caches the title of links. This is useful for reducing API usage and

View File

@ -45,6 +45,9 @@ conf.registerGlobalValue(SpiffyTitles, 'coubTemplate',
registry.String("^ {%if not_safe_for_work %}NSFW{% endif %} [{{channel.title}}] {{title}} :: {{views_count}} views :: {{likes_count}} likes :: {{recoubs_count}} recoubs", _("""Uses Coub API to get additional information about coub.com links""")))
# enable/disable toggles
conf.registerGlobalValue(SpiffyTitles, 'coubHandlerEnabled',
registry.Boolean(True, _("""Whether to add additional information about coub links""")))
conf.registerGlobalValue(SpiffyTitles, 'defaultHandlerEnabled',
registry.Boolean(True, _("""Whether to add additional information about regular links""")))

View File

@ -71,11 +71,12 @@ class SpiffyTitles(callbacks.Plugin):
"""
Handles coub.com links
"""
coub_handler_enabled = self.registryValue("coubHandlerEnabled")
self.log.info("SpiffyTitles: calling coub handler for %s" % url)
title = None
""" Get video ID """
if "/view/" in url:
if coub_handler_enabled and "/view/" in url:
video_id = url.split("/view/")[1]
""" Remove any query strings """
@ -108,7 +109,9 @@ class SpiffyTitles(callbacks.Plugin):
self.log.error("SpiffyTitles: coub handler returned %s: %s" % (request.status_code, request.text[:200]))
if title is None:
self.log.info("SpiffyTitles: %s does not appear to be a video link!" % url)
if coub_handler_enabled:
self.log.info("SpiffyTitles: %s does not appear to be a video link!" % url)
return self.handler_default(url)
else:
return title