|
|
@ -32,7 +32,6 @@ except ImportError: |
|
|
|
|
|
|
|
|
|
|
|
class HDBitsProvider(generic.TorrentProvider): |
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
|
|
|
|
generic.TorrentProvider.__init__(self, "HDBits") |
|
|
@ -68,8 +67,10 @@ class HDBitsProvider(generic.TorrentProvider): |
|
|
|
|
|
|
|
if 'status' in parsedJSON and 'message' in parsedJSON: |
|
|
|
if parsedJSON.get('status') == 5: |
|
|
|
logger.log(u"Incorrect authentication credentials for " + self.name + " : " + parsedJSON['message'], logger.DEBUG) |
|
|
|
raise AuthException("Your authentication credentials for " + self.name + " are incorrect, check your config.") |
|
|
|
logger.log(u"Incorrect authentication credentials for " + self.name + " : " + parsedJSON['message'], |
|
|
|
logger.DEBUG) |
|
|
|
raise AuthException( |
|
|
|
"Your authentication credentials for " + self.name + " are incorrect, check your config.") |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
@ -147,7 +148,8 @@ class HDBitsProvider(generic.TorrentProvider): |
|
|
|
post_data = { |
|
|
|
'username': self.username, |
|
|
|
'passkey': self.password, |
|
|
|
'category': [2], # TV Category |
|
|
|
'category': [2], |
|
|
|
# TV Category |
|
|
|
} |
|
|
|
|
|
|
|
if episode: |
|
|
@ -179,7 +181,6 @@ class HDBitsProvider(generic.TorrentProvider): |
|
|
|
|
|
|
|
|
|
|
|
class HDBitsCache(tvcache.TVCache): |
|
|
|
|
|
|
|
def __init__(self, provider): |
|
|
|
|
|
|
|
tvcache.TVCache.__init__(self, provider) |
|
|
@ -215,7 +216,8 @@ class HDBitsCache(tvcache.TVCache): |
|
|
|
if parsedJSON and 'data' in parsedJSON: |
|
|
|
items = parsedJSON['data'] |
|
|
|
else: |
|
|
|
logger.log(u"Resulting JSON from " + self.provider.name + " isn't correct, not parsing it", logger.ERROR) |
|
|
|
logger.log(u"Resulting JSON from " + self.provider.name + " isn't correct, not parsing it", |
|
|
|
logger.ERROR) |
|
|
|
return [] |
|
|
|
|
|
|
|
ql = [] |
|
|
@ -231,7 +233,8 @@ class HDBitsCache(tvcache.TVCache): |
|
|
|
myDB.mass_action(ql) |
|
|
|
|
|
|
|
else: |
|
|
|
raise exceptions.AuthException("Your authentication info for " + self.provider.name + " is incorrect, check your config") |
|
|
|
raise exceptions.AuthException( |
|
|
|
"Your authentication info for " + self.provider.name + " is incorrect, check your config") |
|
|
|
|
|
|
|
else: |
|
|
|
return [] |
|
|
@ -247,10 +250,12 @@ class HDBitsCache(tvcache.TVCache): |
|
|
|
logger.log(u"Adding item to results: " + title, logger.DEBUG) |
|
|
|
return self._addCacheEntry(title, url) |
|
|
|
else: |
|
|
|
logger.log(u"The data returned from the " + self.provider.name + " is incomplete, this result is unusable", logger.ERROR) |
|
|
|
logger.log(u"The data returned from the " + self.provider.name + " is incomplete, this result is unusable", |
|
|
|
logger.ERROR) |
|
|
|
return None |
|
|
|
|
|
|
|
def _checkAuth(self, data): |
|
|
|
return self.provider._checkAuthFromData(data) |
|
|
|
|
|
|
|
|
|
|
|
provider = HDBitsProvider() |
|
|
|