mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 05:33:37 +00:00
0d9fbc1ad7
This version of SickBeard uses both TVDB and TVRage to search and gather it's series data from allowing you to now have access to and download shows that you couldn't before because of being locked into only what TheTVDB had to offer. Also this edition is based off the code we used in our XEM editon so it does come with scene numbering support as well as all the other features our XEM edition has to offer. Please before using this with your existing database (sickbeard.db) please make a backup copy of it and delete any other database files such as cache.db and failed.db if present, we HIGHLY recommend starting out with no database files at all to make this a fresh start but the choice is at your own risk! Enjoy!
40 lines
978 B
Python
40 lines
978 B
Python
class History(object):
|
|
"""
|
|
This holds all the response and request objects for a
|
|
session. A server using this should call "clear" after
|
|
each request cycle in order to keep it from clogging
|
|
memory.
|
|
"""
|
|
requests = []
|
|
responses = []
|
|
_instance = None
|
|
|
|
@classmethod
|
|
def instance(cls):
|
|
if not cls._instance:
|
|
cls._instance = cls()
|
|
return cls._instance
|
|
|
|
def add_response(self, response_obj):
|
|
self.responses.append(response_obj)
|
|
|
|
def add_request(self, request_obj):
|
|
self.requests.append(request_obj)
|
|
|
|
@property
|
|
def request(self):
|
|
if len(self.requests) == 0:
|
|
return None
|
|
else:
|
|
return self.requests[-1]
|
|
|
|
@property
|
|
def response(self):
|
|
if len(self.responses) == 0:
|
|
return None
|
|
else:
|
|
return self.responses[-1]
|
|
|
|
def clear(self):
|
|
del self.requests[:]
|
|
del self.responses[:]
|