diff options
Diffstat (limited to 'module/plugins/hoster/GamefrontCom.py')
| -rw-r--r-- | module/plugins/hoster/GamefrontCom.py | 34 | 
1 files changed, 22 insertions, 12 deletions
| diff --git a/module/plugins/hoster/GamefrontCom.py b/module/plugins/hoster/GamefrontCom.py index 8e0f8565f..c68866f87 100644 --- a/module/plugins/hoster/GamefrontCom.py +++ b/module/plugins/hoster/GamefrontCom.py @@ -1,27 +1,34 @@  # -*- coding: utf-8 -*-  import re -from module.plugins.Hoster import Hoster +  from module.network.RequestFactory import getURL +from module.plugins.Hoster import Hoster  from module.utils import parseFileSize  class GamefrontCom(Hoster): -    __name__ = "GamefrontCom" -    __type__ = "hoster" -    __pattern__ = r'http://(?:www\.)?gamefront.com/files/[A-Za-z0-9]+' +    __name__    = "GamefrontCom" +    __type__    = "hoster"      __version__ = "0.04" + +    __pattern__ = r'http://(?:www\.)?gamefront\.com/files/\w+' +      __description__ = """Gamefront.com hoster plugin""" -    __author_name__ = "fwannmacher" -    __author_mail__ = "felipe@warhammerproject.com" +    __license__     = "GPLv3" +    __authors__     = [("fwannmacher", "felipe@warhammerproject.com")] +      PATTERN_FILENAME = r'<title>(.*?) | Game Front'      PATTERN_FILESIZE = r'<dt>File Size:</dt>[\n\s]*<dd>(.*?)</dd>' -    PATTERN_OFFLINE = r"This file doesn't exist, or has been removed." +    PATTERN_OFFLINE = r'This file doesn\'t exist, or has been removed.' +      def setup(self): -        self.resumeDownload = self.multiDL = True -        self.chunkLimit = -1 +        self.resumeDownload = True +        self.multiDL        = True +        self.chunkLimit     = -1 +      def process(self, pyfile):          self.pyfile = pyfile @@ -39,23 +46,26 @@ class GamefrontCom(Hoster):          self.download(link) +      def _checkOnline(self):          if re.search(self.PATTERN_OFFLINE, self.html):              return False          else:              return True +      def _getName(self):          name = re.search(self.PATTERN_FILENAME, self.html)          if name is None: -            self.fail("%s: Plugin broken." % self.__name__) +            self.fail(_("Plugin broken")          return name.group(1) +      def _getLink(self): -        self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=[A-Za-z0-9]+)", +        self.html2 = self.load("http://www.gamefront.com/" + re.search("(files/service/thankyou\\?id=\w+)",                                                                         self.html).group(1)) -        return re.search("<a href=\"(http://media[0-9]+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&") +        return re.search("<a href=\"(http://media\d+\.gamefront.com/.*)\">click here</a>", self.html2).group(1).replace("&", "&")  def getInfo(urls): | 
