diff options
author | Florian Franzen <FlorianFranzen@gmail.com> | 2012-05-30 18:06:04 +0200 |
---|---|---|
committer | Florian Franzen <FlorianFranzen@gmail.com> | 2012-05-30 18:06:04 +0200 |
commit | b9c2bce5efa67bd9f30ab47586282561c13fe6df (patch) | |
tree | f8468da20c692257a93937644fe44e112ec46f7f /module | |
parent | simple checksum and download scheduler hooks; keep config options ordered (diff) | |
download | pyload-b9c2bce5efa67bd9f30ab47586282561c13fe6df.tar.xz |
PremiumizeMe: Added code that generates fall back file names (used for freakshare, etc, which do not supply filenames while downloading). Fixed #581.
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/PremiumizeMe.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index 2b1306820..4ae59d198 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -4,12 +4,12 @@ from module.common.json_layer import json_loads class PremiumizeMe(Hoster):
__name__ = "PremiumizeMe"
- __version__ = "0.1"
+ __version__ = "0.11"
__type__ = "hoster"
__description__ = """Premiumize.Me hoster plugin"""
# Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady create the regex patterns for us using getHosters in our PremiumizeMe hook.
- __pattern__ = ""
+ __pattern__ = None
__author_name__ = ("Florian Franzen")
__author_mail__ = ("FlorianFranzen@gmail.com")
@@ -20,17 +20,26 @@ class PremiumizeMe(Hoster): self.logError(_("Please enter a valid premiumize.me account or deactivate this plugin"))
self.fail("No valid premiumize.me account provided")
+ # In some cases hostsers do not supply us with a filename at download, so we are going to set a fall back filename (e.g. for freakshare or xfileshare)
+ self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash
+
+ # Correction for automatic assigned filename: Removing html at end if needed
+ suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
+ temp = self.pyfile.name.split('.')
+ if temp.pop() in suffix_to_remove:
+ self.pyfile.name = ".".join(temp)
+
# Get account data
(user, data) = self.account.selectAccount()
# Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
- answer = self.load("https://api.premiumize.me/pm-api/v1.php?method=directdownloadlink¶ms[login]=%s¶ms[pass]=%s¶ms[link]=%s" % (user, data['password'], pyfile.url))
+ answer = self.load("https://api.premiumize.me/pm-api/v1.php?method=directdownloadlink¶ms[login]=%s¶ms[pass]=%s¶ms[link]=%s" % (user, data['password'], self.pyfile.url))
data = json_loads(answer)
# Check status and decide what to do
status = data['status']
if status == 200:
- self.download(data['result']['location'])
+ self.download(data['result']['location'], disposition=True)
elif status == 400:
self.fail("Invalid link")
elif status == 404:
@@ -38,4 +47,4 @@ class PremiumizeMe(Hoster): elif status >= 500:
self.tempOffline()
else:
- self.fail(data['statusmessage'])
\ No newline at end of file + self.fail(data['statusmessage'])
|