Repository navigation
Expand file tree
/
Copy pathPremiumizeMeHook.py
More file actions
40 lines (30 loc) · 1.59 KB
/
Copy pathPremiumizeMeHook.py
File metadata and controls
40 lines (30 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
from module.common.json_layer import json_loads
from module.plugins.internal.MultiHook import MultiHook
class PremiumizeMeHook(MultiHook):
__name__ = "PremiumizeMeHook"
__type__ = "hook"
__version__ = "0.20"
__status__ = "testing"
__config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
("reload" , "bool" , "Reload plugin list" , True ),
("reloadinterval", "int" , "Reload interval in hours" , 12 )]
__description__ = """Premiumize.me hook plugin"""
__license__ = "GPLv3"
__authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")]
def get_hosters(self):
#: Get account data
user, info = self.account.select()
#: Get supported hosters list from premiumize.me using the
#: json API v1 (see https://secure.premiumize.me/?show=api)
answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10
get={'method' : "hosterlist",
'params[login]': user,
'params[pass]' : info['login']['password']})
data = json_loads(answer)
#: If account is not valid thera are no hosters available
if data['status'] != 200:
return []
#: Extract hosters from json file
return data['result']['hosterlist']