summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/hoster/FastixRu.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/hoster/FastixRu.py')
-rw-r--r--pyload/plugins/hoster/FastixRu.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/pyload/plugins/hoster/FastixRu.py b/pyload/plugins/hoster/FastixRu.py
index db3302579..8805081c9 100644
--- a/pyload/plugins/hoster/FastixRu.py
+++ b/pyload/plugins/hoster/FastixRu.py
@@ -3,21 +3,17 @@
import re
from urllib import unquote
from random import randrange
-from pyload.plugins.Hoster import Hoster
-from pyload.utils import json_loads
+from module.plugins.Hoster import Hoster
+from module.common.json_layer import json_loads
class FastixRu(Hoster):
__name__ = "FastixRu"
- __version__ = "0.02"
+ __version__ = "0.04"
__type__ = "hoster"
- __config__ = [("activated", "bool", "Activated", "False"),
- ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),
- ("unloadFailing", "bool", "Revert to standard download if download fails", "False"),
- ("interval", "int", "Reload interval in hours (0 to disable)", "24")]
- __pattern__ = r"http?://.*fastix.ru\..*"
+ __pattern__ = r"http://(?:www\.)?fastix\.(ru|it)/file/(?P<ID>[a-zA-Z0-9]{24})"
__description__ = """Fastix hoster plugin"""
- __author_name__ = ("Massimo, Rosamilia")
+ __author_name__ = ("Massimo Rosamilia")
__author_mail__ = ("max@spiritix.eu")
def getFilename(self, url):
@@ -29,19 +25,18 @@ class FastixRu(Hoster):
name += "%s.tmp" % randrange(100, 999)
return name
- def init(self):
+ def setup(self):
self.chunkLimit = 3
self.resumeDownload = True
def process(self, pyfile):
- if not self.account:
- self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix")
- self.fail("No Fastix account provided")
-
- self.logDebug("Old URL: %s" % pyfile.url)
if re.match(self.__pattern__, pyfile.url):
new_url = pyfile.url
+ elif not self.account:
+ self.logError(_("Please enter your %s account or deactivate this plugin") % "Fastix")
+ self.fail("No Fastix account provided")
else:
+ self.logDebug("Old URL: %s" % pyfile.url)
api_key = self.account.getAccountData(self.user)
api_key = api_key["api"]
url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url)
@@ -53,7 +48,8 @@ class FastixRu(Hoster):
else:
new_url = data["downloadlink"]
- self.logDebug("New URL: %s" % new_url)
+ if new_url != pyfile.url:
+ self.logDebug("New URL: %s" % new_url)
if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"):
#only use when name wasnt already set