From d2cd60cc6dbaa7aceb1d1cd3019aa7089ddfdcd9 Mon Sep 17 00:00:00 2001 From: Stefano Date: Sat, 6 Apr 2013 21:50:25 +0200 Subject: Using SimpleCrypter to avoid repeating getPackageNameAndFolder. + licenses + cosmetics --- module/plugins/crypter/UploadedToFolder.py | 35 +++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'module/plugins/crypter/UploadedToFolder.py') diff --git a/module/plugins/crypter/UploadedToFolder.py b/module/plugins/crypter/UploadedToFolder.py index d4534297e..7fe4de688 100644 --- a/module/plugins/crypter/UploadedToFolder.py +++ b/module/plugins/crypter/UploadedToFolder.py @@ -1,13 +1,30 @@ # -*- coding: utf-8 -*- -from module.plugins.Crypter import Crypter +############################################################################ +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU Affero General Public License as # +# published by the Free Software Foundation, either version 3 of the # +# License, or (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU Affero General Public License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with this program. If not, see . # +############################################################################ + import re -class UploadedToFolder(Crypter): +from module.plugins.internal.SimpleCrypter import SimpleCrypter + + +class UploadedToFolder(SimpleCrypter): __name__ = "UploadedToFolder" __type__ = "crypter" __pattern__ = r"http://(?:www\.)?(uploaded|ul)\.(to|net)/(f|list)/(?P\w+)" - __version__ = "0.1" + __version__ = "0.2" __description__ = """UploadedTo Crypter Plugin""" __author_name__ = ("stickell") __author_mail__ = ("l.stickell@yahoo.it") @@ -31,15 +48,3 @@ class UploadedToFolder(Crypter): self.logDebug('Package has %d links' % len(package_links)) self.packages = [(package_name, package_links, folder_name)] - - def getPackageNameAndFolder(self): - m = re.search(self.TITLE_PATTERN, self.html) - if m: - name = folder = m.group('title') - self.logDebug("Found name [%s] and folder [%s] in package info" % (name, folder)) - return name, folder - else: - name = self.pyfile.package().name - folder = self.pyfile.package().folder - self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) - return name, folder -- cgit v1.2.3