From 304e10c8d01973913b62f762bc35f31cdf04a6ff Mon Sep 17 00:00:00 2001 From: oddluck <39967334+oddluck@users.noreply.github.com> Date: Tue, 4 Feb 2020 04:30:05 +0000 Subject: [PATCH] Remove ShrinkUrl --- ShrinkUrl/README.md | 1 - ShrinkUrl/__init__.py | 64 ---------- ShrinkUrl/config.py | 103 --------------- ShrinkUrl/locales/fi.po | 205 ------------------------------ ShrinkUrl/locales/fr.po | 183 -------------------------- ShrinkUrl/locales/it.po | 194 ---------------------------- ShrinkUrl/messages.pot | 144 --------------------- ShrinkUrl/plugin.py | 275 ---------------------------------------- ShrinkUrl/test.py | 116 ----------------- SpiffyTitles/plugin.py | 2 - 10 files changed, 1287 deletions(-) delete mode 100644 ShrinkUrl/README.md delete mode 100644 ShrinkUrl/__init__.py delete mode 100644 ShrinkUrl/config.py delete mode 100644 ShrinkUrl/locales/fi.po delete mode 100644 ShrinkUrl/locales/fr.po delete mode 100644 ShrinkUrl/locales/it.po delete mode 100644 ShrinkUrl/messages.pot delete mode 100644 ShrinkUrl/plugin.py delete mode 100644 ShrinkUrl/test.py diff --git a/ShrinkUrl/README.md b/ShrinkUrl/README.md deleted file mode 100644 index ed375c1..0000000 --- a/ShrinkUrl/README.md +++ /dev/null @@ -1 +0,0 @@ -This plugin features commands to shorten URLs through different services, like tinyurl. \ No newline at end of file diff --git a/ShrinkUrl/__init__.py b/ShrinkUrl/__init__.py deleted file mode 100644 index c3e5132..0000000 --- a/ShrinkUrl/__init__.py +++ /dev/null @@ -1,64 +0,0 @@ -### -# Copyright (c) 2005, Jeremiah Fincher -# Copyright (c) 2009, James McCoy -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions, and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions, and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the author of this software nor the name of -# contributors to this software may be used to endorse or promote products -# derived from this software without specific prior written consent. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -### - -""" -Shrinks URLs using various URL shrinking services. -""" - -import supybot -import supybot.world as world - -__version__ = "%%VERSION%%" - -__author__ = getattr(supybot.authors, 'jemfinch', - supybot.Author('jemfinch', '', '')) -__maintainer__ = getattr(supybot.authors, 'oddluck', - supybot.Author('oddluck', 'oddluck', 'oddluck@riseup.net')) - -# This is a dictionary mapping supybot.Author instances to lists of -# contributions. -__contributors__ = {supybot.authors.jamessan: ['xrl.us support', - 'x0.no support']} - -from . import config -from . import plugin -from importlib import reload -reload(plugin) # In case we're being reloaded. -# Add more reloads here if you add third-party modules and want them to be -# reloaded when this plugin is reloaded. Don't forget to import them as well! - -if world.testing: - from . import test - -Class = plugin.Class -configure = config.configure - - -# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/ShrinkUrl/config.py b/ShrinkUrl/config.py deleted file mode 100644 index 0233900..0000000 --- a/ShrinkUrl/config.py +++ /dev/null @@ -1,103 +0,0 @@ -### -# Copyright (c) 2005, Jeremiah Fincher -# Copyright (c) 2009-2010, James McCoy -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions, and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions, and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the author of this software nor the name of -# contributors to this software may be used to endorse or promote products -# derived from this software without specific prior written consent. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -### - -import supybot.conf as conf -import supybot.registry as registry -from supybot.i18n import PluginInternationalization, internationalizeDocstring -_ = PluginInternationalization('ShrinkUrl') - -def configure(advanced): - from supybot.questions import output, expect, anything, something, yn - conf.registerPlugin('ShrinkUrl', True) - if yn(_("""This plugin offers a snarfer that will go retrieve a shorter - version of long URLs that are sent to the channel. Would you - like this snarfer to be enabled?"""), default=False): - conf.supybot.plugins.ShrinkUrl.shrinkSnarfer.setValue(True) - -class ShrinkService(registry.OnlySomeStrings): - """Valid values include 'tiny', 'ur1', and 'x0'.""" - validStrings = ('tiny', 'ur1', 'x0') - -class ShrinkCycle(registry.SpaceSeparatedListOfStrings): - """Valid values include 'ln', 'tiny', 'ur1', and 'x0'.""" - Value = ShrinkService - - def __init__(self, *args, **kwargs): - super(ShrinkCycle, self).__init__(*args, **kwargs) - self.lastIndex = -1 - - def setValue(self, v): - super(self.__class__, self).setValue(v) - self.lastIndex = -1 - - def getService(self): - L = self() - if L: - self.lastIndex = (self.lastIndex + 1) % len(L) - return L[self.lastIndex] - raise ValueError('No services have been configured for rotation. ' \ - 'See conf.supybot.plugins.ShrinkUrl.serviceRotation.') - -ShrinkUrl = conf.registerPlugin('ShrinkUrl') -conf.registerChannelValue(ShrinkUrl, 'shrinkSnarfer', - registry.Boolean(False, _("""Determines whether the - shrink snarfer is enabled. This snarfer will watch for URLs in the - channel, and if they're sufficiently long (as determined by - supybot.plugins.ShrinkUrl.minimumLength) it will post a - smaller URL from the service as denoted in - supybot.plugins.ShrinkUrl.default."""))) -conf.registerChannelValue(ShrinkUrl.shrinkSnarfer, 'showDomain', - registry.Boolean(True, _("""Determines whether the snarfer will show the - domain of the URL being snarfed along with the shrunken URL."""))) -conf.registerChannelValue(ShrinkUrl, 'minimumLength', - registry.PositiveInteger(48, _("""The minimum length a URL must be before - the bot will shrink it."""))) -conf.registerChannelValue(ShrinkUrl, 'nonSnarfingRegexp', - registry.Regexp(None, _("""Determines what URLs are to be snarfed; URLs - matching the regexp given will not be snarfed. Give the empty string if - you have no URLs that you'd like to exclude from being snarfed."""))) -conf.registerChannelValue(ShrinkUrl, 'outFilter', - registry.Boolean(False, _("""Determines whether the bot will shrink the - URLs of outgoing messages if those URLs are longer than - supybot.plugins.ShrinkUrl.minimumLength."""))) -conf.registerChannelValue(ShrinkUrl, 'default', - ShrinkService('x0', _("""Determines what website the bot will use when - shrinking a URL."""))) -conf.registerGlobalValue(ShrinkUrl, 'bold', - registry.Boolean(True, _("""Determines whether this plugin will bold - certain portions of its replies."""))) -conf.registerChannelValue(ShrinkUrl, 'serviceRotation', - ShrinkCycle([], _("""If set to a non-empty value, specifies the list of - services to rotate through for the shrinkSnarfer and outFilter."""))) -conf.registerChannelValue(ShrinkUrl, 'fetchSpiffyTitle', - registry.Boolean(False, _("""Determines whether the bot will fetch URL - titles with the SpiffyTitles plugin."""))) - -# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/ShrinkUrl/locales/fi.po b/ShrinkUrl/locales/fi.po deleted file mode 100644 index 289e1c8..0000000 --- a/ShrinkUrl/locales/fi.po +++ /dev/null @@ -1,205 +0,0 @@ -# ShrinkUrl plugin in Limnoria. -# Copyright (C) 2011, 2012 Limnoria -# Mikaela Suomalainen , 2011, 2012. -# -msgid "" -msgstr "" -"Project-Id-Version: Limnoria\n" -"POT-Creation-Date: 2015-01-24 19:31+CET\n" -"PO-Revision-Date: 2015-01-24 19:31+0100\n" -"Last-Translator: Mikaela Suomalainen \n" -"Language-Team: suomi <>\n" -"Language: fi\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: pygettext.py 1.5\n" -"Plural-Forms: \n" -"X-Generator: Poedit 1.6.10\n" - -#: config.py:39 -msgid "" -"This plugin offers a snarfer that will go retrieve a shorter\n" -" version of long URLs that are sent to the channel. Would you\n" -" like this snarfer to be enabled?" -msgstr "" -"Tämä lisäosa tarjoaa kaappaajan,joka palauttaa lyhyemmän\n" -" version pitkistä URL-osoitteista, jotka lähetetään kanavalle. Haluaisitko\n" -" tämän kaappaajan olevan käytössä?" - -#: config.py:45 config.py:49 -msgid "Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'." -msgstr "Kelvolliset arvot ovat 'ln', 'tiny', 'goo', 'ur1' ja 'x0' ." - -#: config.py:70 -msgid "" -"Determines whether the\n" -" shrink snarfer is enabled. This snarfer will watch for URLs in the\n" -" channel, and if they're sufficiently long (as determined by\n" -" supybot.plugins.ShrinkUrl.minimumLength) it will post a\n" -" smaller URL from either ln-s.net or tinyurl.com, as denoted in\n" -" supybot.plugins.ShrinkUrl.default." -msgstr "" -"Määrittää onko kutistuskaappain käytössä.\n" -" Tämä kaappaaja vahtii URL-osoitteita kanavalla\n" -" ja jos ne ovat tarpeeksi pitkiä (määritetty asetusarvolla\n" -" supybot.plugins.ShrinkUrl.minimumLength), se lähettää lyhyemmän URL-" -"osoitteen\n" -" joko sivustolta ln-s.net tai tinyurl.com, riippuen, minkä asetuksen\n" -" supybot.plugins.ShrinkUrl.default määrittää." - -#: config.py:77 -msgid "" -"Determines whether the snarfer will show the\n" -" domain of the URL being snarfed along with the shrunken URL." -msgstr "" -"Määrittää näyttääkö kaappaaja kaapatun URL-osoitteen domainin lyhennetyn\n" -" URL-osoitteen kanssa." - -#: config.py:80 -msgid "" -"The minimum length a URL must be before\n" -" the bot will shrink it." -msgstr "" -"Vähimmäispituus joka URL-osoitteen täytyy olla, ennen kuin\n" -" botti kutistaa sen." - -#: config.py:83 -msgid "" -"Determines what URLs are to be snarfed; URLs\n" -" matching the regexp given will not be snarfed. Give the empty string " -"if\n" -" you have no URLs that you'd like to exclude from being snarfed." -msgstr "" -"Määrittää mitä URL-osoitteita ei kaapata; URL-osoitteet, jotka\n" -" täsmäävät annettuun säännölliseen lausekkeeseen jätetään kaappaamatta. " -"Anna tyhjä merkkiketju, jos\n" -" et halua estää mitään URL-osoitetta tulemasta kaapatuksi." - -#: config.py:87 -msgid "" -"Determines whether the bot will shrink the\n" -" URLs of outgoing messages if those URLs are longer than\n" -" supybot.plugins.ShrinkUrl.minimumLength." -msgstr "" -"Määrittää lyhentääkö botti ulosmenevien viestien\n" -" URL-osoitteet, jos ne ovat pidempiä kuin\n" -" supybot.plugins.ShrinkUrl.minimumLength." - -#: config.py:91 -msgid "" -"Determines what website the bot will use when\n" -" shrinking a URL." -msgstr "" -"Määrittää mitä verkkosivua botti käyttää lyhentäessään\n" -" URL-osoitetta." - -#: config.py:94 -msgid "" -"Determines whether this plugin will bold\n" -" certain portions of its replies." -msgstr "" -"Määrittää korostaako botti tietyt osat\n" -" vastauksissaan." - -#: config.py:97 -msgid "" -"If set to a non-empty value, specifies the list of\n" -" services to rotate through for the shrinkSnarfer and outFilter." -msgstr "" -"Jos tämä on asetettu muuksi, kuin tyhjäksi arvoksi, määrittää listan\n" -" palveluista, joita käytetään kutistuskaappaajalle ja ulostulon " -"suodattimelle." - -#: plugin.py:90 -msgid "" -"This plugin features commands to shorten URLs through different services,\n" -" like tinyurl." -msgstr "" -"Tämä plugin sisältää komennot URL-osoitteiden lyhentämiseen eri palveluilla, " -"kuten esimerkiksi\n" -" tinyurl:illa." - -#: plugin.py:192 -msgid "" -"\n" -"\n" -" Returns an ln-s.net version of .\n" -" " -msgstr "" -"\n" -"\n" -" Palauttaa ln-s.net version .\n" -" " - -#: plugin.py:219 -msgid "" -"\n" -"\n" -" Returns a TinyURL.com version of \n" -" " -msgstr "" -"\n" -"\n" -" Palauttaa TinyURL.com palvelun lyhentämän version .\n" -" " - -#: plugin.py:252 -msgid "" -"\n" -"\n" -" Returns an goo.gl version of .\n" -" " -msgstr "" -"\n" -"\n" -" Palauttaa goo.gl-palvelun lyhentämän version ." - -#: plugin.py:282 -msgid "" -"\n" -"\n" -" Returns an ur1 version of .\n" -" " -msgstr "" -"\n" -" Palauttaa ur1-version .\n" -" " - -#: plugin.py:309 -msgid "" -"\n" -"\n" -" Returns an x0.no version of .\n" -" " -msgstr "" -"\n" -"\n" -" Palauttaa x0.no palvelun lyhentämän version .\n" -" " - -#: plugin.py:336 -msgid "" -"\n" -"\n" -" Returns an expanded version of .\n" -" " -msgstr "" -"\n" -" Palauttaa laajennetun version .\n" -" " - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " Returns an xrl.us version of .\n" -#~ " " -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " Palauttaa xrl.us palvelun lyhentämän version .\n" -#~ " " - -#~ msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', and 'x0'." -#~ msgstr "Kelvolliset arvot ovat 'ln', 'tiny', 'xrl', 'goo' ja 'x0' ." diff --git a/ShrinkUrl/locales/fr.po b/ShrinkUrl/locales/fr.po deleted file mode 100644 index f4531da..0000000 --- a/ShrinkUrl/locales/fr.po +++ /dev/null @@ -1,183 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: Limnoria\n" -"POT-Creation-Date: 2015-01-24 19:31+CET\n" -"PO-Revision-Date: 2015-01-24 19:32+0100\n" -"Last-Translator: Valentin Lorentz \n" -"Language-Team: Limnoria \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Poedit-SourceCharset: ASCII\n" -"X-Generator: Poedit 1.5.4\n" - -#: config.py:39 -msgid "" -"This plugin offers a snarfer that will go retrieve a shorter\n" -" version of long URLs that are sent to the channel. Would you\n" -" like this snarfer to be enabled?" -msgstr "" -"Ce plugin offre un snarfer qui récupère de longues URLs envoyées sur un " -"canal pour en envoyer une version plus courte. Voulez-vous activer ce " -"snarfer ?" - -#: config.py:45 config.py:49 -msgid "Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'." -msgstr "" -"Les valeurs valides incluent 'ln', 'tiny', 'goo', 'ur1', et 'x0'." - -#: config.py:70 -msgid "" -"Determines whether the\n" -" shrink snarfer is enabled. This snarfer will watch for URLs in the\n" -" channel, and if they're sufficiently long (as determined by\n" -" supybot.plugins.ShrinkUrl.minimumLength) it will post a\n" -" smaller URL from either ln-s.net or tinyurl.com, as denoted in\n" -" supybot.plugins.ShrinkUrl.default." -msgstr "" -"Détermine si le snarfer d'URL est activé. Ce remplaceur sera à l'écoute de " -"toutes les URLs sur lle canal, et, si elle sont suffisamment longues " -"(déterminé par supybot.plugins.ShrinkUrl.minimumLength) le bot postera une " -"URL raccourcie avec ln-s.net ou tinyurl.com, comme défini par supybot." -"plugins.ShrinkUrl.default." - -#: config.py:77 -msgid "" -"Determines whether the snarfer will show the\n" -" domain of the URL being snarfed along with the shrunken URL." -msgstr "" -"Détermine si le snarfer affichera le domaine de l'URL snarfée avec l'URL " -"raccourcie." - -#: config.py:80 -msgid "" -"The minimum length a URL must be before\n" -" the bot will shrink it." -msgstr "La taille minimum d'une URL pour que le bot la raccourcice." - -#: config.py:83 -msgid "" -"Determines what URLs are to be snarfed; URLs\n" -" matching the regexp given will not be snarfed. Give the empty string " -"if\n" -" you have no URLs that you'd like to exclude from being snarfed." -msgstr "" -"Détermine quelles URLs seront snarfées ; les URLs correspondant à " -"l'expression régulière ne seront par snarfées. Donnez une chaîne vide si il " -"n'y a pas d'URL que vous voulez exclure." - -#: config.py:87 -msgid "" -"Determines whether the bot will shrink the\n" -" URLs of outgoing messages if those URLs are longer than\n" -" supybot.plugins.ShrinkUrl.minimumLength." -msgstr "" -"Détermine si le bot raccourcira les URLs des messages sortant si ces URLs " -"sont plus longues que supybot.plugins.ShrinkUrl.minimumLength." - -#: config.py:91 -msgid "" -"Determines what website the bot will use when\n" -" shrinking a URL." -msgstr "Détermine quel site web le bot utilisera pour raccourcir une URL" - -#: config.py:94 -msgid "" -"Determines whether this plugin will bold\n" -" certain portions of its replies." -msgstr "" -"Détermine si ce plugin mettra en gras certaines portions de ses réponses." - -#: config.py:97 -msgid "" -"If set to a non-empty value, specifies the list of\n" -" services to rotate through for the shrinkSnarfer and outFilter." -msgstr "" -"Si définit à une valeur non vide, définit la liste des services à faire " -"tourner pour shrinkSnarfer et outFilter." - -#: plugin.py:90 -msgid "" -"This plugin features commands to shorten URLs through different services,\n" -" like tinyurl." -msgstr "" - -#: plugin.py:192 -msgid "" -"\n" -"\n" -" Returns an ln-s.net version of .\n" -" " -msgstr "" -"\n" -"\n" -"Retourne une version de ln-s.net de l'." - -#: plugin.py:219 -msgid "" -"\n" -"\n" -" Returns a TinyURL.com version of \n" -" " -msgstr "" -"\n" -"\n" -"Retourne une version de TinyURL.com de l'." - -#: plugin.py:252 -msgid "" -"\n" -"\n" -" Returns an goo.gl version of .\n" -" " -msgstr "" -"\n" -"\n" -"Retourne une version de goo.gl de l'." - -#: plugin.py:282 -msgid "" -"\n" -"\n" -" Returns an ur1 version of .\n" -" " -msgstr "" -"\n" -"\n" -"Retourne une version de ur1 de l'." - -#: plugin.py:309 -msgid "" -"\n" -"\n" -" Returns an x0.no version of .\n" -" " -msgstr "" -"\n" -"\n" -"Retourne une version de x0.no de l'." - -#: plugin.py:336 -msgid "" -"\n" -"\n" -" Returns an expanded version of .\n" -" " -msgstr "" -"\n" -"\n" -"Retourne la version large de l'." - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " Returns an xrl.us version of .\n" -#~ " " -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ "Retourne une version de xrl.us de l'." - -#~ msgid "Valid values include 'ln', 'tiny', 'xrl', 'goo', and 'x0'." -#~ msgstr "Les valeurs valides incluent 'ln', 'tiny', 'xrl', 'goo', et 'x0'." diff --git a/ShrinkUrl/locales/it.po b/ShrinkUrl/locales/it.po deleted file mode 100644 index 622c31e..0000000 --- a/ShrinkUrl/locales/it.po +++ /dev/null @@ -1,194 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: Limnoria\n" -"POT-Creation-Date: 2015-01-24 19:31+CET\n" -"PO-Revision-Date: 2015-01-24 11:45+0100\n" -"Last-Translator: skizzhg \n" -"Language-Team: Italian \n" -"Language: it\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: config.py:39 -msgid "" -"This plugin offers a snarfer that will go retrieve a shorter\n" -" version of long URLs that are sent to the channel. Would you\n" -" like this snarfer to be enabled?" -msgstr "" -"Questo plugin offre un cattura URL che riporterà una versione accorciata\n" -" di quelli lunghi inviati al canale. Lo si vuole abilitare?\n" - -#: config.py:45 config.py:49 -#, fuzzy -msgid "Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'." -msgstr "" -"I valori validi comprendono \"ln\", \"tiny\", \"goo\" e \"x0\"." - -#: config.py:70 -msgid "" -"Determines whether the\n" -" shrink snarfer is enabled. This snarfer will watch for URLs in the\n" -" channel, and if they're sufficiently long (as determined by\n" -" supybot.plugins.ShrinkUrl.minimumLength) it will post a\n" -" smaller URL from either ln-s.net or tinyurl.com, as denoted in\n" -" supybot.plugins.ShrinkUrl.default." -msgstr "" -"Determina se l'accorcia URL è abilitato. Questo controllerà gli URL che " -"passano\n" -" in canale e se sono sufficientemente lunghi (determinato da\n" -" supybot.plugins.ShrinkUrl.minimumLength) il bot ne invierà uno più " -"corto\n" -" tramite ln-s.net o tinyurl.com, come definito in supybot.plugins." -"ShrinkUrl.default." - -#: config.py:77 -msgid "" -"Determines whether the snarfer will show the\n" -" domain of the URL being snarfed along with the shrunken URL." -msgstr "" -"Determina se l'accorcia URL mostrerà il dominio dell'URL originale assieme a " -"quello accorciato." - -#: config.py:80 -msgid "" -"The minimum length a URL must be before\n" -" the bot will shrink it." -msgstr "" -"La lunghezza minima che un URL deve avere affinché il bot decida di " -"accorciarlo." - -#: config.py:83 -msgid "" -"Determines what URLs are to be snarfed; URLs\n" -" matching the regexp given will not be snarfed. Give the empty string " -"if\n" -" you have no URLs that you'd like to exclude from being snarfed." -msgstr "" -"Determina quali URL debbano essere intercettati; quelli che corrispondono " -"alla\n" -" regexp fornita non verranno coinvolti. Se non si vuole escludere alcun " -"URL,\n" -" aggiungere una stringa vuota." - -#: config.py:87 -msgid "" -"Determines whether the bot will shrink the\n" -" URLs of outgoing messages if those URLs are longer than\n" -" supybot.plugins.ShrinkUrl.minimumLength." -msgstr "" -"Determina se il bot accorcerà gli URL dei messaggi in uscita se questi sono " -"più\n" -" lunghi del valore di supybot.plugins.ShrinkUrl.minimumLength." - -#: config.py:91 -msgid "" -"Determines what website the bot will use when\n" -" shrinking a URL." -msgstr "Determina quale sito web il bot userà per accorciare un URL." - -#: config.py:94 -msgid "" -"Determines whether this plugin will bold\n" -" certain portions of its replies." -msgstr "" -"Determina se il plugin riporterà in grassetto alcune porzioni delle risposte." - -#: config.py:97 -msgid "" -"If set to a non-empty value, specifies the list of\n" -" services to rotate through for the shrinkSnarfer and outFilter." -msgstr "" -"Se impostato ad un valore non vuoto, specifica l'elenco dei servizi a cui\n" -" rivolgersi per le variabili shrinkSnarfer e outFilter." - -#: plugin.py:90 -msgid "" -"This plugin features commands to shorten URLs through different services,\n" -" like tinyurl." -msgstr "" - -#: plugin.py:192 -msgid "" -"\n" -"\n" -" Returns an ln-s.net version of .\n" -" " -msgstr "" -"\n" -"\n" -" Restituisce una versione di ln-s.net di .\n" -" " - -#: plugin.py:219 -msgid "" -"\n" -"\n" -" Returns a TinyURL.com version of \n" -" " -msgstr "" -"\n" -"\n" -" Restituisce una versione di TinyURL.com di \n" -" " - -#: plugin.py:252 -msgid "" -"\n" -"\n" -" Returns an goo.gl version of .\n" -" " -msgstr "" -"\n" -"\n" -" Restituisce una versione di goo.gl di .\n" -" " - -#: plugin.py:282 -#, fuzzy -msgid "" -"\n" -"\n" -" Returns an ur1 version of .\n" -" " -msgstr "" -"\n" -"\n" -" Restituisce una versione di xrl.us di .\n" -" " - -#: plugin.py:309 -msgid "" -"\n" -"\n" -" Returns an x0.no version of .\n" -" " -msgstr "" -"\n" -"\n" -" Restituisce una versione di x0.no di .\n" -" " - -#: plugin.py:336 -#, fuzzy -msgid "" -"\n" -"\n" -" Returns an expanded version of .\n" -" " -msgstr "" -"\n" -"\n" -" Restituisce una versione di x0.no di .\n" -" " - -#~ msgid "" -#~ "\n" -#~ "\n" -#~ " Returns an xrl.us version of .\n" -#~ " " -#~ msgstr "" -#~ "\n" -#~ "\n" -#~ " Restituisce una versione di xrl.us di .\n" -#~ " " diff --git a/ShrinkUrl/messages.pot b/ShrinkUrl/messages.pot deleted file mode 100644 index 256a4f3..0000000 --- a/ShrinkUrl/messages.pot +++ /dev/null @@ -1,144 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR ORGANIZATION -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2015-01-24 19:31+CET\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: ENCODING\n" -"Generated-By: pygettext.py 1.5\n" - - -#: config.py:39 -msgid "" -"This plugin offers a snarfer that will go retrieve a shorter\n" -" version of long URLs that are sent to the channel. Would you\n" -" like this snarfer to be enabled?" -msgstr "" - -#: config.py:45 config.py:49 -#, docstring -msgid "Valid values include 'ln', 'tiny', 'goo', 'ur1', and 'x0'." -msgstr "" - -#: config.py:70 -msgid "" -"Determines whether the\n" -" shrink snarfer is enabled. This snarfer will watch for URLs in the\n" -" channel, and if they're sufficiently long (as determined by\n" -" supybot.plugins.ShrinkUrl.minimumLength) it will post a\n" -" smaller URL from either ln-s.net or tinyurl.com, as denoted in\n" -" supybot.plugins.ShrinkUrl.default." -msgstr "" - -#: config.py:77 -msgid "" -"Determines whether the snarfer will show the\n" -" domain of the URL being snarfed along with the shrunken URL." -msgstr "" - -#: config.py:80 -msgid "" -"The minimum length a URL must be before\n" -" the bot will shrink it." -msgstr "" - -#: config.py:83 -msgid "" -"Determines what URLs are to be snarfed; URLs\n" -" matching the regexp given will not be snarfed. Give the empty string if\n" -" you have no URLs that you'd like to exclude from being snarfed." -msgstr "" - -#: config.py:87 -msgid "" -"Determines whether the bot will shrink the\n" -" URLs of outgoing messages if those URLs are longer than\n" -" supybot.plugins.ShrinkUrl.minimumLength." -msgstr "" - -#: config.py:91 -msgid "" -"Determines what website the bot will use when\n" -" shrinking a URL." -msgstr "" - -#: config.py:94 -msgid "" -"Determines whether this plugin will bold\n" -" certain portions of its replies." -msgstr "" - -#: config.py:97 -msgid "" -"If set to a non-empty value, specifies the list of\n" -" services to rotate through for the shrinkSnarfer and outFilter." -msgstr "" - -#: plugin.py:90 -#, docstring -msgid "" -"This plugin features commands to shorten URLs through different services,\n" -" like tinyurl." -msgstr "" - -#: plugin.py:192 -#, docstring -msgid "" -"\n" -"\n" -" Returns an ln-s.net version of .\n" -" " -msgstr "" - -#: plugin.py:219 -#, docstring -msgid "" -"\n" -"\n" -" Returns a TinyURL.com version of \n" -" " -msgstr "" - -#: plugin.py:252 -#, docstring -msgid "" -"\n" -"\n" -" Returns an goo.gl version of .\n" -" " -msgstr "" - -#: plugin.py:282 -#, docstring -msgid "" -"\n" -"\n" -" Returns an ur1 version of .\n" -" " -msgstr "" - -#: plugin.py:309 -#, docstring -msgid "" -"\n" -"\n" -" Returns an x0.no version of .\n" -" " -msgstr "" - -#: plugin.py:336 -#, docstring -msgid "" -"\n" -"\n" -" Returns an expanded version of .\n" -" " -msgstr "" - diff --git a/ShrinkUrl/plugin.py b/ShrinkUrl/plugin.py deleted file mode 100644 index bd81e66..0000000 --- a/ShrinkUrl/plugin.py +++ /dev/null @@ -1,275 +0,0 @@ -### -# Copyright (c) 2002-2004, Jeremiah Fincher -# Copyright (c) 2009-2010, James McCoy -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions, and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions, and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the author of this software nor the name of -# contributors to this software may be used to endorse or promote products -# derived from this software without specific prior written consent. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -### - -import re -import sys -import time -import json - -import supybot.log as log -import supybot.conf as conf -import supybot.utils as utils -from supybot.commands import * -import supybot.ircmsgs as ircmsgs -import supybot.plugins as plugins -import supybot.ircutils as ircutils -import supybot.callbacks as callbacks -from supybot.i18n import PluginInternationalization, internationalizeDocstring -_ = PluginInternationalization('ShrinkUrl') - -class CdbShrunkenUrlDB(object): - def __init__(self, filename): - self.dbs = {} - cdb = conf.supybot.databases.types.cdb - def register_service(service): - dbname = filename.replace('.db', service.capitalize() + '.db') - self.dbs[service] = cdb.connect(dbname) - for service in conf.supybot.plugins.ShrinkUrl.default.validStrings: - register_service(service) - register_service('Expand') - - def get(self, service, url): - return self.dbs[service][url] - - def set(self, service, url, shrunkurl): - self.dbs[service][url] = shrunkurl - - def close(self): - for service in self.dbs: - self.dbs[service].close() - - def flush(self): - for service in self.dbs: - self.dbs[service].flush() - -ShrunkenUrlDB = plugins.DB('ShrinkUrl', {'cdb': CdbShrunkenUrlDB}) - -class ShrinkError(Exception): - pass - -def retry(f): - def newf(*args, **kwargs): - for x in range(0, 3): - try: - return f(*args, **kwargs) - except Exception: - log.exception('Shrinking URL failed. Trying again.') - time.sleep(1) - return f(*args, **kwargs) - return newf - -class ShrinkUrl(callbacks.PluginRegexp): - """This plugin features commands to shorten URLs through different services, - like tinyurl.""" - regexps = ['shrinkSnarfer'] - def __init__(self, irc): - self.__parent = super(ShrinkUrl, self) - self.__parent.__init__(irc) - self.db = ShrunkenUrlDB() - - def die(self): - self.db.close() - - def callCommand(self, command, irc, msg, *args, **kwargs): - try: - self.__parent.callCommand(command, irc, msg, *args, **kwargs) - except utils.web.Error as e: - irc.error(str(e)) - - def _outFilterThread(self, irc, msg): - (channel, text) = msg.args - network = irc.network - for m in utils.web.httpUrlRe.finditer(text): - url = m.group(1) - if len(url) > self.registryValue('minimumLength', channel, network): - try: - cmd = self.registryValue('serviceRotation', - channel, network, value=False) - cmd = cmd.getService().capitalize() - except ValueError: - cmd = self.registryValue('default', channel, network) \ - .capitalize() - try: - shortUrl = getattr(self, '_get%sUrl' % cmd)(url) - text = text.replace(url, shortUrl) - except (utils.web.Error, AttributeError, ShrinkError): - pass - newMsg = ircmsgs.privmsg(channel, text, msg=msg) - newMsg.tag('shrunken') - irc.queueMsg(newMsg) - - def outFilter(self, irc, msg): - if msg.command != 'PRIVMSG': - return msg - if msg.channel: - if not msg.shrunken: - if self.registryValue('outFilter', msg.channel, irc.network): - if utils.web.httpUrlRe.search(msg.args[1]): - self._outFilterThread(irc, msg) - return None - return msg - - def shrinkSnarfer(self, irc, msg, match): - channel = msg.channel - network = irc.network - if not channel: - return - if self.registryValue('shrinkSnarfer', channel, network): - url = match.group(0) - r = self.registryValue('nonSnarfingRegexp', channel, network) - if r and r.search(url) is not None: - self.log.debug('Matched nonSnarfingRegexp: %u', url) - return - minlen = self.registryValue('minimumLength', channel, network) - try: - cmd = self.registryValue('serviceRotation', - channel, network, value=False) - cmd = cmd.getService().capitalize() - except ValueError: - cmd = self.registryValue('default', channel, network) \ - .capitalize() - if len(url) >= minlen: - try: - shorturl = getattr(self, '_get%sUrl' % cmd)(url) - except (utils.web.Error, AttributeError, ShrinkError): - self.log.info('Couldn\'t get shorturl for %u', url) - return - if self.registryValue('shrinkSnarfer.showDomain', - channel, network): - domain = ' (at %s)' % utils.web.getDomain(url) - else: - domain = '' - if self.registryValue('bold'): - s = format('%u%s', ircutils.bold(shorturl), domain) - else: - s = format('%u%s', shorturl, domain) - m = irc.reply(s, prefixNick=False) - if m is not None: - m.tag('shrunken') - if self.registryValue("fetchSpiffyTitle", channel): - spiffy = irc.getCallback("SpiffyTitles") - if spiffy: - try: - result = spiffy.get_title_by_url(url, channel, msg.nick) - if result: - irc.reply(result, prefixNick=False) - except: - log.exception("ShrinkUrl/SpiffyTitles: failed to get title for url %s", url) - shrinkSnarfer = urlSnarfer(shrinkSnarfer) - shrinkSnarfer.__doc__ = utils.web._httpUrlRe - - @retry - def _getTinyUrl(self, url): - try: - return self.db.get('tiny', url) - except KeyError: - text = utils.web.getUrl('http://tinyurl.com/api-create.php?url=' + url) - text = text.decode() - if text.startswith('Error'): - raise ShrinkError(text[5:]) - self.db.set('tiny', url, text) - return text - - @internationalizeDocstring - def tiny(self, irc, msg, args, url): - """ - - Returns a TinyURL.com version of - """ - try: - tinyurl = self._getTinyUrl(url) - m = irc.reply(tinyurl) - if m is not None: - m.tag('shrunken') - except ShrinkError as e: - irc.errorPossibleBug(str(e)) - tiny = thread(wrap(tiny, ['httpUrl'])) - - _ur1Api = 'http://ur1.ca/' - _ur1Regexp = re.compile(r'') - @retry - def _getUr1Url(self, url): - try: - return self.db.get('ur1ca', utils.web.urlquote(url)) - except KeyError: - parameters = utils.web.urlencode({'longurl': url}) - response = utils.web.getUrl(self._ur1Api, data=parameters) - ur1ca = self._ur1Regexp.search(response.decode()).group('url') - if ur1ca: - self.db.set('ur1', url, ur1ca) - return ur1ca - else: - raise ShrinkError(response) - - def ur1(self, irc, msg, args, url): - """ - - Returns an ur1 version of . - """ - try: - ur1url = self._getUr1Url(url) - m = irc.reply(ur1url) - if m is not None: - m.tag('shrunken') - except ShrinkError as e: - irc.error(str(e)) - ur1 = thread(wrap(ur1, ['httpUrl'])) - - _x0Api = 'https://x0.no/api/?%s' - @retry - def _getX0Url(self, url): - try: - return self.db.get('x0', url) - except KeyError: - text = utils.web.getUrl(self._x0Api % url).decode() - if text.startswith('ERROR:'): - raise ShrinkError(text[6:]) - self.db.set('x0', url, text) - return text - - @internationalizeDocstring - def x0(self, irc, msg, args, url): - """ - - Returns an x0.no version of . - """ - try: - x0url = self._getX0Url(url) - m = irc.reply(x0url) - if m is not None: - m.tag('shrunken') - except ShrinkError as e: - irc.error(str(e)) - x0 = thread(wrap(x0, ['httpUrl'])) - -Class = ShrinkUrl - -# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: - diff --git a/ShrinkUrl/test.py b/ShrinkUrl/test.py deleted file mode 100644 index 35c9169..0000000 --- a/ShrinkUrl/test.py +++ /dev/null @@ -1,116 +0,0 @@ -### -# Copyright (c) 2002-2004, Jeremiah Fincher -# Copyright (c) 2009-2010, James McCoy -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions, and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions, and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the author of this software nor the name of -# contributors to this software may be used to endorse or promote products -# derived from this software without specific prior written consent. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -### - -from supybot.test import * - -class ShrinkUrlTestCase(ChannelPluginTestCase): - plugins = ('ShrinkUrl',) - config = {'supybot.snarfThrottle': 0} - - sfUrl ='http://sourceforge.net/p/supybot/bugs/?source=navbar' - udUrl = 'http://www.urbandictionary.com/define.php?' \ - 'term=all+your+base+are+belong+to+us' - tests = {'tiny': [(sfUrl, r'http://tinyurl.com/b7wyvfz'), - (udUrl, r'http://tinyurl.com/u479')], - 'ur1': [(sfUrl, r'http://ur1.ca/ceqh8'), - (udUrl, r'http://ur1.ca/9xl9k')], - 'x0': [(sfUrl, r'https://x0.no/a53s'), - (udUrl, r'https://x0.no/0l2k')] - } - if network: - def testShrink(self): - for (service, testdata) in self.tests.items(): - for (url, shrunkurl) in testdata: - self.assertRegexp('shrinkurl %s %s' % (service, url), - shrunkurl) - - def testShrinkCycle(self): - cycle = conf.supybot.plugins.ShrinkUrl.serviceRotation - snarfer = conf.supybot.plugins.ShrinkUrl.shrinkSnarfer - origcycle = cycle() - origsnarfer = snarfer() - try: - self.assertNotError( - 'config plugins.ShrinkUrl.serviceRotation tiny x0') - self.assertError( - 'config plugins.ShrinkUrl.serviceRotation tiny x1') - snarfer.setValue(True) - self.assertSnarfRegexp(self.udUrl, r'.*%s.* \(at' % - self.tests['tiny'][1][1]) - self.assertSnarfRegexp(self.udUrl, r'.*%s.* \(at' % - self.tests['x0'][1][1]) - finally: - cycle.setValue(origcycle) - snarfer.setValue(origsnarfer) - - def _snarf(self, service): - shrink = conf.supybot.plugins.ShrinkUrl - origService = shrink.default() - origSnarf = shrink.shrinkSnarfer() - shrink.default.setValue(service) - shrink.shrinkSnarfer.setValue(True) - try: - for (url, shrunkurl) in self.tests[service]: - teststr = r'.*%s.* \(at' % shrunkurl - self.assertSnarfRegexp(url, teststr) - finally: - shrink.default.setValue(origService) - shrink.shrinkSnarfer.setValue(origSnarf) - - def testTinysnarf(self): - self._snarf('tiny') - - def testUr1snarf(self): - self._snarf('ur1') - - def testX0snarf(self): - self._snarf('x0') - - def testNonSnarfing(self): - shrink = conf.supybot.plugins.ShrinkUrl - origService = shrink.default() - origSnarf = shrink.shrinkSnarfer() - origLen = shrink.minimumLength() - origRegexp = shrink.nonSnarfingRegexp() - shrink.default.setValue('tiny') - shrink.shrinkSnarfer.setValue(True) - shrink.minimumLength.setValue(10) - shrink.nonSnarfingRegexp.set('m/sf/') - try: - self.assertSnarfNoResponse('http://sf.net/', 5) - self.assertSnarfRegexp('http://sourceforge.net/', - r'http://tinyurl.com/7vm7.*\(at ') - finally: - shrink.default.setValue(origService) - shrink.shrinkSnarfer.setValue(origSnarf) - shrink.minimumLength.setValue(origLen) - shrink.nonSnarfingRegexp.setValue(origRegexp) - -# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/SpiffyTitles/plugin.py b/SpiffyTitles/plugin.py index f02bceb..5482e58 100644 --- a/SpiffyTitles/plugin.py +++ b/SpiffyTitles/plugin.py @@ -1602,8 +1602,6 @@ class SpiffyTitles(callbacks.Plugin): self.get_source_by_url(url, retries + 1) except requests.exceptions.MissingSchema as e: - if dynamic.irc.nick.lower() == dynamic.msg.nick.lower(): - return url_wschema = "http://%s" % (url) log.error("SpiffyTitles missing schema. Retrying with %s" % (url_wschema)) info = urlparse(url_wschema)