prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Implemented StreamcloudEu plugin based on XFileSharingPro
  Resolves #128
  
  
  </issue>
  <code>
  [start of module/plugins/hoster/StreamcloudEu.py]
  1 # -*- coding: utf-8 -*-
  2 from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
  3 import re
  4 
  5 class StreamcloudEu(XFileSharingPro):
  6     __name__ = "StreamcloudEu"
  7     __type__ = "hoster"
  8     __pattern__ = r"http://(www\.)?streamcloud\.eu/\S+"
  9     __version__ = "0.01"
  10     __description__ = """Streamcloud.eu hoster plugin"""
  11     __author_name__ = ("seoester")
  12     __author_mail__ = ("seoester@googlemail.com")
  13 
  14     HOSTER_NAME = "streamcloud.eu"
  15     DIRECT_LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud.eu:?\d*/.*/video\.mp4)",'
  16 
  17     def setup(self):
  18         super(XFileSharingPro, self).setup()
  19         self.multiDL = True
  20 
  21     def getDownloadLink(self):
  22         found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S)
  23         if found:
  24             return found.group(1)
  25 
  26         return super(XFileSharingPro, self).getDownloadLink()
  27 
  28 getInfo = create_getInfo(StreamcloudEu)
  29
  [end of module/plugins/hoster/StreamcloudEu.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py
  --- a/module/plugins/hoster/StreamcloudEu.py
  +++ b/module/plugins/hoster/StreamcloudEu.py
  @@ -1,5 +1,7 @@
   # -*- coding: utf-8 -*-
   from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
  +from module.network.HTTPRequest import HTTPRequest
  +from time import sleep
   import re
   
   class StreamcloudEu(XFileSharingPro):
  @@ -15,7 +17,7 @@
       DIRECT_LINK_PATTERN = r'file: "(http://(stor|cdn)\d+\.streamcloud.eu:?\d*/.*/video\.mp4)",'
   
       def setup(self):
  -        super(XFileSharingPro, self).setup()
  +        super(StreamcloudEu, self).setup()
           self.multiDL = True
   
       def getDownloadLink(self):
  @@ -23,6 +25,87 @@
           if found:
               return found.group(1)
   
  -        return super(XFileSharingPro, self).getDownloadLink()
  +        for i in range(5):
  +            self.logDebug("Getting download link: #%d" % i)
  +            data = self.getPostParameters()
  +            httpRequest = HTTPRequest(options=self.req.options)
  +            httpRequest.cj = self.req.cj
  +            sleep(10)
  +            self.html = httpRequest.load(self.pyfile.url, post = data, referer=False, cookies=True, decode = True)
  +            self.header = httpRequest.header
  +
  +            found = re.search("Location\s*:\s*(.*)", self.header, re.I)
  +            if found:
  +                break
  +
  +            found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S)
  +            if found:
  +                break
  +
  +        else:
  +            if self.errmsg and 'captcha' in self.errmsg:
  +                self.fail("No valid captcha code entered")
  +            else:
  +                self.fail("Download link not found")
  +
  +        return found.group(1)
  +
  +    def getPostParameters(self):
  +        for i in range(3):
  +            if not self.errmsg: self.checkErrors()
  +
  +            if hasattr(self,"FORM_PATTERN"):
  +                action, inputs = self.parseHtmlForm(self.FORM_PATTERN)
  +            else:
  +                action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")})
  +
  +            if not inputs:
  +                action, inputs = self.parseHtmlForm('F1')
  +                if not inputs:
  +                    if self.errmsg:
  +                        self.retry()
  +                    else:
  +                        self.parseError("Form not found")
  +
  +            self.logDebug(self.HOSTER_NAME, inputs)
  +
  +            if 'op' in inputs and inputs['op'] in ('download1', 'download2', 'download3'):
  +                if "password" in inputs:
  +                    if self.passwords:
  +                        inputs['password'] = self.passwords.pop(0)
  +                    else:
  +                        self.fail("No or invalid passport")
  +
  +                if not self.premium:
  +                    found = re.search(self.WAIT_PATTERN, self.html)
  +                    if found:
  +                        wait_time = int(found.group(1)) + 1
  +                        self.setWait(wait_time, False)
  +                    else:
  +                        wait_time = 0
  +
  +                    self.captcha = self.handleCaptcha(inputs)
  +
  +                    if wait_time: self.wait()
  +
  +                self.errmsg = None
  +                self.logDebug("getPostParameters {0}".format(i))
  +                return inputs
  +
  +            else:
  +                inputs['referer'] = self.pyfile.url
  +
  +                if self.premium:
  +                    inputs['method_premium'] = "Premium Download"
  +                    if 'method_free' in inputs: del inputs['method_free']
  +                else:
  +                    inputs['method_free'] = "Free Download"
  +                    if 'method_premium' in inputs: del inputs['method_premium']
  +
  +                self.html = self.load(self.pyfile.url, post = inputs, ref = False)
  +                self.errmsg = None
  +
  +        else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))
  +
   
   getInfo = create_getInfo(StreamcloudEu)
  
verification_info: {"golden_diff": "diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py\n--- a/module/plugins/hoster/StreamcloudEu.py\n+++ b/module/plugins/hoster/StreamcloudEu.py\n@@ -1,5 +1,7 @@\n # -*- coding: utf-8 -*-\n from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo\n+from module.network.HTTPRequest import HTTPRequest\n+from time import sleep\n import re\n \n class StreamcloudEu(XFileSharingPro):\n@@ -15,7 +17,7 @@\n     DIRECT_LINK_PATTERN = r'file: \"(http://(stor|cdn)\\d+\\.streamcloud.eu:?\\d*/.*/video\\.mp4)\",'\n \n     def setup(self):\n-        super(XFileSharingPro, self).setup()\n+        super(StreamcloudEu, self).setup()\n         self.multiDL = True\n \n     def getDownloadLink(self):\n@@ -23,6 +25,87 @@\n         if found:\n             return found.group(1)\n \n-        return super(XFileSharingPro, self).getDownloadLink()\n+        for i in range(5):\n+            self.logDebug(\"Getting download link: #%d\" % i)\n+            data = self.getPostParameters()\n+            httpRequest = HTTPRequest(options=self.req.options)\n+            httpRequest.cj = self.req.cj\n+            sleep(10)\n+            self.html = httpRequest.load(self.pyfile.url, post = data, referer=False, cookies=True, decode = True)\n+            self.header = httpRequest.header\n+\n+            found = re.search(\"Location\\s*:\\s*(.*)\", self.header, re.I)\n+            if found:\n+                break\n+\n+            found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S)\n+            if found:\n+                break\n+\n+        else:\n+            if self.errmsg and 'captcha' in self.errmsg:\n+                self.fail(\"No valid captcha code entered\")\n+            else:\n+                self.fail(\"Download link not found\")\n+\n+        return found.group(1)\n+\n+    def getPostParameters(self):\n+        for i in range(3):\n+            if not self.errmsg: self.checkErrors()\n+\n+            if hasattr(self,\"FORM_PATTERN\"):\n+                action, inputs = self.parseHtmlForm(self.FORM_PATTERN)\n+            else:\n+                action, inputs = self.parseHtmlForm(input_names={\"op\": re.compile(\"^download\")})\n+\n+            if not inputs:\n+                action, inputs = self.parseHtmlForm('F1')\n+                if not inputs:\n+                    if self.errmsg:\n+                        self.retry()\n+                    else:\n+                        self.parseError(\"Form not found\")\n+\n+            self.logDebug(self.HOSTER_NAME, inputs)\n+\n+            if 'op' in inputs and inputs['op'] in ('download1', 'download2', 'download3'):\n+                if \"password\" in inputs:\n+                    if self.passwords:\n+                        inputs['password'] = self.passwords.pop(0)\n+                    else:\n+                        self.fail(\"No or invalid passport\")\n+\n+                if not self.premium:\n+                    found = re.search(self.WAIT_PATTERN, self.html)\n+                    if found:\n+                        wait_time = int(found.group(1)) + 1\n+                        self.setWait(wait_time, False)\n+                    else:\n+                        wait_time = 0\n+\n+                    self.captcha = self.handleCaptcha(inputs)\n+\n+                    if wait_time: self.wait()\n+\n+                self.errmsg = None\n+                self.logDebug(\"getPostParameters {0}\".format(i))\n+                return inputs\n+\n+            else:\n+                inputs['referer'] = self.pyfile.url\n+\n+                if self.premium:\n+                    inputs['method_premium'] = \"Premium Download\"\n+                    if 'method_free' in inputs: del inputs['method_free']\n+                else:\n+                    inputs['method_free'] = \"Free Download\"\n+                    if 'method_premium' in inputs: del inputs['method_premium']\n+\n+                self.html = self.load(self.pyfile.url, post = inputs, ref = False)\n+                self.errmsg = None\n+\n+        else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN'))\n+\n \n getInfo = create_getInfo(StreamcloudEu)\n", "issue": "Implemented StreamcloudEu plugin based on XFileSharingPro\nResolves #128\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo\nimport re\n\nclass StreamcloudEu(XFileSharingPro):\n    __name__ = \"StreamcloudEu\"\n    __type__ = \"hoster\"\n    __pattern__ = r\"http://(www\\.)?streamcloud\\.eu/\\S+\"\n    __version__ = \"0.01\"\n    __description__ = \"\"\"Streamcloud.eu hoster plugin\"\"\"\n    __author_name__ = (\"seoester\")\n    __author_mail__ = (\"seoester@googlemail.com\")\n\n    HOSTER_NAME = \"streamcloud.eu\"\n    DIRECT_LINK_PATTERN = r'file: \"(http://(stor|cdn)\\d+\\.streamcloud.eu:?\\d*/.*/video\\.mp4)\",'\n\n    def setup(self):\n        super(XFileSharingPro, self).setup()\n        self.multiDL = True\n\n    def getDownloadLink(self):\n        found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S)\n        if found:\n            return found.group(1)\n\n        return super(XFileSharingPro, self).getDownloadLink()\n\ngetInfo = create_getInfo(StreamcloudEu)\n", "path": "module/plugins/hoster/StreamcloudEu.py"}]}