mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-05-02 00:11:08 -05:00
Lyrics/IMDb: fix for google plugin in testing
This commit is contained in:
parent
f351af5a47
commit
42fb7e1039
@ -37,7 +37,7 @@ import supybot.world as world
|
|||||||
|
|
||||||
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
||||||
# in here if you're keeping the plugin in CVS or some similar system.
|
# in here if you're keeping the plugin in CVS or some similar system.
|
||||||
__version__ = "2020.05.19+git"
|
__version__ = "2020.06.01+git"
|
||||||
|
|
||||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||||
__author__ = supybot.Author("butterscotchstallion", "butterscotchstallion", "")
|
__author__ = supybot.Author("butterscotchstallion", "butterscotchstallion", "")
|
||||||
|
@ -89,7 +89,10 @@ class IMDb(callbacks.Plugin):
|
|||||||
if google and self.registryValue("google", channel) == i:
|
if google and self.registryValue("google", channel) == i:
|
||||||
results = google.decode(google.search(query, irc.network, channel))
|
results = google.decode(google.search(query, irc.network, channel))
|
||||||
for r in results:
|
for r in results:
|
||||||
match = re.search(pattern, r["url"])
|
try:
|
||||||
|
match = re.search(pattern, r["url"])
|
||||||
|
except TypeError:
|
||||||
|
match = re.search(pattern, r.link)
|
||||||
if match:
|
if match:
|
||||||
log.debug("IMDb: found link using Google search")
|
log.debug("IMDb: found link using Google search")
|
||||||
break
|
break
|
||||||
@ -156,9 +159,7 @@ class IMDb(callbacks.Plugin):
|
|||||||
if rating["Source"] == "Rotten Tomatoes":
|
if rating["Source"] == "Rotten Tomatoes":
|
||||||
response["tomatometer"] = rating["Value"]
|
response["tomatometer"] = rating["Value"]
|
||||||
if rating["Source"] == "Metacritic":
|
if rating["Source"] == "Metacritic":
|
||||||
response["metascore"] = "{0}%".format(
|
response["metascore"] = "{0}%".format(rating["Value"].split("/")[0])
|
||||||
rating["Value"].split("/")[0]
|
|
||||||
)
|
|
||||||
result = imdb_template.safe_substitute(response)
|
result = imdb_template.safe_substitute(response)
|
||||||
elif response.get("Error"):
|
elif response.get("Error"):
|
||||||
log.debug("IMDb: OMDB API: %s" % response["Error"])
|
log.debug("IMDb: OMDB API: %s" % response["Error"])
|
||||||
|
@ -36,7 +36,7 @@ import supybot.world as world
|
|||||||
|
|
||||||
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
# Use this for the version of this plugin. You may wish to put a CVS keyword
|
||||||
# in here if you're keeping the plugin in CVS or some similar system.
|
# in here if you're keeping the plugin in CVS or some similar system.
|
||||||
__version__ = "2020.05.19+git"
|
__version__ = "2020.06.01+git"
|
||||||
|
|
||||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||||
__author__ = supybot.Author("oddluck", "oddluck", "oddluck@riseup.net")
|
__author__ = supybot.Author("oddluck", "oddluck", "oddluck@riseup.net")
|
||||||
|
@ -72,9 +72,15 @@ class Lyrics(callbacks.Plugin):
|
|||||||
if google and self.registryValue("google", channel) == i:
|
if google and self.registryValue("google", channel) == i:
|
||||||
results = google.decode(google.search(query, irc.network, channel))
|
results = google.decode(google.search(query, irc.network, channel))
|
||||||
for r in results:
|
for r in results:
|
||||||
match = re.search(pattern, r["url"])
|
try:
|
||||||
|
match = re.search(pattern, r["url"])
|
||||||
|
except TypeError:
|
||||||
|
match = re.search(pattern, r.link)
|
||||||
if match:
|
if match:
|
||||||
title = r["title"].replace(":", " - ").split("|")[0]
|
try:
|
||||||
|
title = r["title"].replace(":", " - ").split("|")[0]
|
||||||
|
except TypeError:
|
||||||
|
title = r.title.replace(":", " - ").split("|")[0]
|
||||||
log.debug("Lyrics: found link using Google search")
|
log.debug("Lyrics: found link using Google search")
|
||||||
break
|
break
|
||||||
elif self.registryValue("ddg", channel) == i:
|
elif self.registryValue("ddg", channel) == i:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user