From a1cef0b9582eb70f3facbc0adc972c3bd7cb422d Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 30 Jun 2014 10:48:18 -0700 Subject: [PATCH] Added in context to aid in garbage cleanup to help reduce memory usage. --- sickbeard/autoPostProcesser.py | 3 +++ sickbeard/blackandwhitelist.py | 3 +++ sickbeard/dailysearcher.py | 3 +++ sickbeard/failedProcessor.py | 3 +++ sickbeard/generic_queue.py | 6 ++++++ sickbeard/image_cache.py | 3 +++ sickbeard/indexers/indexer_api.py | 3 +++ sickbeard/logger.py | 6 ++++++ sickbeard/maintenance.py | 3 +++ sickbeard/name_parser/parser.py | 8 ++++++++ sickbeard/postProcessor.py | 2 ++ sickbeard/properFinder.py | 3 +++ sickbeard/providers/btn.py | 6 ++++++ sickbeard/providers/ezrss.py | 6 ++++++ sickbeard/providers/fanzub.py | 5 +++++ sickbeard/providers/generic.py | 10 +++++++++- sickbeard/providers/hdbits.py | 6 ++++++ sickbeard/providers/hdtorrents.py | 6 ++++++ sickbeard/providers/iptorrents.py | 6 ++++++ sickbeard/providers/kat.py | 6 ++++++ sickbeard/providers/newzbin.py | 9 +++++++++ sickbeard/providers/newznab.py | 6 ++++++ sickbeard/providers/nextgen.py | 6 ++++++ sickbeard/providers/nyaatorrents.py | 5 +++++ sickbeard/providers/omgwtfnzbs.py | 6 ++++++ sickbeard/providers/publichd.py | 6 ++++++ sickbeard/providers/rsstorrent.py | 6 ++++++ sickbeard/providers/scc.py | 6 ++++++ sickbeard/providers/speedcd.py | 6 ++++++ sickbeard/providers/thepiratebay.py | 9 +++++++++ sickbeard/providers/torrentday.py | 6 ++++++ sickbeard/providers/torrentleech.py | 6 ++++++ sickbeard/providers/tvtorrents.py | 6 ++++++ sickbeard/providers/womble.py | 6 ++++++ sickbeard/rssfeeds.py | 19 +++++-------------- sickbeard/scheduler.py | 3 +++ sickbeard/searchBacklog.py | 5 +++++ sickbeard/search_queue.py | 15 +++++++++++++++ sickbeard/showUpdater.py | 3 +++ sickbeard/traktChecker.py | 3 +++ sickbeard/tv.py | 6 ++++++ sickbeard/tvcache.py | 9 ++++++--- sickbeard/ui.py | 6 ++++++ sickbeard/versionChecker.py | 3 +++ 44 files changed, 240 insertions(+), 18 deletions(-) diff --git a/sickbeard/autoPostProcesser.py b/sickbeard/autoPostProcesser.py index a81aa963..c2950d05 100644 --- a/sickbeard/autoPostProcesser.py +++ b/sickbeard/autoPostProcesser.py @@ -42,3 +42,6 @@ class PostProcesser(): return processTV.processDir(sickbeard.TV_DOWNLOAD_DIR) + + def __del__(self): + pass diff --git a/sickbeard/blackandwhitelist.py b/sickbeard/blackandwhitelist.py index 70b35cd0..07d36ebd 100644 --- a/sickbeard/blackandwhitelist.py +++ b/sickbeard/blackandwhitelist.py @@ -35,6 +35,9 @@ class BlackAndWhiteList(object): self.show_id = show_id self.refresh() + def __del__(self): + pass + def refresh(self): logger.log(u"Building black and white list for " + str(self.show_id), logger.DEBUG) diff --git a/sickbeard/dailysearcher.py b/sickbeard/dailysearcher.py index 967d3a47..3559f371 100644 --- a/sickbeard/dailysearcher.py +++ b/sickbeard/dailysearcher.py @@ -36,6 +36,9 @@ class DailySearcher(): self.amActive = False + def __del__(self): + pass + def run(self, force=False): self.amActive = True diff --git a/sickbeard/failedProcessor.py b/sickbeard/failedProcessor.py index 9633fda3..b1862239 100644 --- a/sickbeard/failedProcessor.py +++ b/sickbeard/failedProcessor.py @@ -44,6 +44,9 @@ class FailedProcessor(object): self.log = "" + def __del__(self): + pass + def process(self): self._log(u"Failed download detected: (" + str(self.nzb_name) + ", " + str(self.dir_name) + ")") diff --git a/sickbeard/generic_queue.py b/sickbeard/generic_queue.py index e2fdb74f..3ecfdc5a 100644 --- a/sickbeard/generic_queue.py +++ b/sickbeard/generic_queue.py @@ -43,6 +43,9 @@ class GenericQueue(object): self.lock = threading.Lock() + def __del__(self): + pass + def pause(self): logger.log(u"Pausing queue") self.min_priority = 999999999999 @@ -116,6 +119,9 @@ class QueueItem: self.added = None + def __del__(self): + pass + def get_thread_name(self): if self.thread_name: return self.thread_name diff --git a/sickbeard/image_cache.py b/sickbeard/image_cache.py index 2501ad87..d7854374 100644 --- a/sickbeard/image_cache.py +++ b/sickbeard/image_cache.py @@ -33,6 +33,9 @@ class ImageCache: def __init__(self): pass + def __del__(self): + pass + def _cache_dir(self): """ Builds up the full path to the image cache directory diff --git a/sickbeard/indexers/indexer_api.py b/sickbeard/indexers/indexer_api.py index f13d5a1f..d8467c52 100644 --- a/sickbeard/indexers/indexer_api.py +++ b/sickbeard/indexers/indexer_api.py @@ -25,6 +25,9 @@ class indexerApi(object): def __init__(self, indexerID=None): self.indexerID = int(indexerID) if indexerID else None + def __del__(self): + pass + def indexer(self, *args, **kwargs): if self.indexerID: return indexerConfig[self.indexerID]['module'](*args, **kwargs) diff --git a/sickbeard/logger.py b/sickbeard/logger.py index a4202a6c..c4c51592 100644 --- a/sickbeard/logger.py +++ b/sickbeard/logger.py @@ -67,6 +67,9 @@ class SBRotatingLogHandler(object): self.console_logging = False self.log_lock = threading.Lock() + def __del__(self): + pass + def close_log(self, handler=None): if not handler: handler = self.cur_handler @@ -302,6 +305,9 @@ class DispatchingFormatter: self._formatters = formatters self._default_formatter = default_formatter + def __del__(self): + pass + def format(self, record): formatter = self._formatters.get(record.name, self._default_formatter) return formatter.format(record) diff --git a/sickbeard/maintenance.py b/sickbeard/maintenance.py index d9a6b01f..9bce6481 100644 --- a/sickbeard/maintenance.py +++ b/sickbeard/maintenance.py @@ -31,6 +31,9 @@ class Maintenance(): self.amActive = False + def __del__(self): + pass + def run(self, force=False): self.amActive = True diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 6176408e..b1565dc2 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -45,6 +45,9 @@ class NameParser(object): self.convert = convert self.naming_pattern = naming_pattern + def __del__(self): + pass + def clean_series_name(self, series_name): """Cleans up series name by removing any . and _ characters, along with any trailing hyphens. @@ -443,6 +446,9 @@ class ParseResult(object): self.show = show self.score = score + def __del__(self): + pass + def __eq__(self, other): if not other: return False @@ -618,6 +624,8 @@ class NameParserCache(object): logger.log("Using cached parse result for: " + name, logger.DEBUG) return self._previous_parsed[name] + def __del__(self): + pass name_parser_cache = NameParserCache() diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index 57f352c1..777a5a19 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -96,6 +96,8 @@ class PostProcessor(object): self.log = '' + def __del__(self): + pass def _log(self, message, level=logger.MESSAGE): """ diff --git a/sickbeard/properFinder.py b/sickbeard/properFinder.py index 86fe3468..e0301923 100644 --- a/sickbeard/properFinder.py +++ b/sickbeard/properFinder.py @@ -40,6 +40,9 @@ class ProperFinder(): def __init__(self): self.amActive = False + def __del__(self): + pass + def run(self, force=False): if not sickbeard.DOWNLOAD_PROPERS: diff --git a/sickbeard/providers/btn.py b/sickbeard/providers/btn.py index 71c69c48..70038bbd 100644 --- a/sickbeard/providers/btn.py +++ b/sickbeard/providers/btn.py @@ -49,6 +49,9 @@ class BTNProvider(generic.TorrentProvider): self.url = "http://api.btnapps.net" + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -315,6 +318,9 @@ class BTNCache(tvcache.TVCache): # At least 15 minutes between queries self.minTime = 15 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/ezrss.py b/sickbeard/providers/ezrss.py index 316f83e0..4d594c5f 100644 --- a/sickbeard/providers/ezrss.py +++ b/sickbeard/providers/ezrss.py @@ -47,6 +47,9 @@ class EZRSSProvider(generic.TorrentProvider): self.url = 'https://www.ezrss.it/' + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -178,6 +181,9 @@ class EZRSSCache(tvcache.TVCache): # only poll EZRSS every 15 minutes max self.minTime = 15 + def __del__(self): + pass + def _getRSSData(self): rss_url = self.provider.url + 'feed/' diff --git a/sickbeard/providers/fanzub.py b/sickbeard/providers/fanzub.py index 03d18470..27c61bbb 100644 --- a/sickbeard/providers/fanzub.py +++ b/sickbeard/providers/fanzub.py @@ -45,6 +45,9 @@ class Fanzub(generic.NZBProvider): self.url = 'http://fanzub.com/' + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -131,6 +134,8 @@ class FanzubCache(tvcache.TVCache): # we get 100 post each call ! self.minTime = 20 + def __del__(self): + pass def _getRSSData(self): diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 61d29d93..599d0233 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -68,6 +68,9 @@ class GenericProvider: self.session.headers.update({ 'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}) + def __del__(self): + pass + def getID(self): return GenericProvider.makeID(self.name) @@ -406,9 +409,14 @@ class NZBProvider(GenericProvider): self.providerType = GenericProvider.NZB + def __del__(self): + pass class TorrentProvider(GenericProvider): def __init__(self, name): GenericProvider.__init__(self, name) - self.providerType = GenericProvider.TORRENT \ No newline at end of file + self.providerType = GenericProvider.TORRENT + + def __del__(self): + pass diff --git a/sickbeard/providers/hdbits.py b/sickbeard/providers/hdbits.py index 5737114a..6e91e472 100644 --- a/sickbeard/providers/hdbits.py +++ b/sickbeard/providers/hdbits.py @@ -55,6 +55,9 @@ class HDBitsProvider(generic.TorrentProvider): self.rss_url = 'http://hdbits.org/api/torrents' self.download_url = 'http://hdbits.org/download.php?' + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -214,6 +217,9 @@ class HDBitsCache(tvcache.TVCache): # only poll HDBits every 15 minutes max self.minTime = 15 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/hdtorrents.py b/sickbeard/providers/hdtorrents.py index d0b3f5a4..3c43e203 100644 --- a/sickbeard/providers/hdtorrents.py +++ b/sickbeard/providers/hdtorrents.py @@ -73,6 +73,9 @@ class HDTorrentsProvider(generic.TorrentProvider): self.cookies = None + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -351,6 +354,9 @@ class HDTorrentsCache(tvcache.TVCache): # only poll HDTorrents every 10 minutes max self.minTime = 20 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/iptorrents.py b/sickbeard/providers/iptorrents.py index 7d78df12..e72972d8 100644 --- a/sickbeard/providers/iptorrents.py +++ b/sickbeard/providers/iptorrents.py @@ -65,6 +65,9 @@ class IPTorrentsProvider(generic.TorrentProvider): self.categorie = 'l73=1&l78=1&l66=1&l65=1&l79=1&l5=1&l4=1' + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -292,6 +295,9 @@ class IPTorrentsCache(tvcache.TVCache): # Only poll IPTorrents every 10 minutes max self.minTime = 10 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/kat.py b/sickbeard/providers/kat.py index d2f196ac..c3a2d426 100644 --- a/sickbeard/providers/kat.py +++ b/sickbeard/providers/kat.py @@ -68,6 +68,9 @@ class KATProvider(generic.TorrentProvider): self.searchurl = self.url + 'usearch/%s/?field=seeders&sorder=desc' #order by seed + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -430,6 +433,9 @@ class KATCache(tvcache.TVCache): # only poll ThePirateBay every 10 minutes max self.minTime = 20 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/newzbin.py b/sickbeard/providers/newzbin.py index bdf4b31e..685afc4b 100644 --- a/sickbeard/providers/newzbin.py +++ b/sickbeard/providers/newzbin.py @@ -40,6 +40,9 @@ class NewzbinDownloader(urllib.FancyURLopener): def __init__(self): urllib.FancyURLopener.__init__(self) + def __del__(self): + pass + def http_error_default(self, url, fp, errcode, errmsg, headers): # if newzbin is throttling us, wait seconds and try again @@ -73,6 +76,9 @@ class NewzbinProvider(generic.NZBProvider): self.NEWZBIN_DATE_FORMAT = '%a, %d %b %Y %H:%M:%S %Z' + def __del__(self): + pass + def isEnabled(self): return sickbeard.NEWZBIN @@ -334,6 +340,9 @@ class NewzbinCache(tvcache.TVCache): # only poll Newzbin every 10 mins max self.minTime = 1 + def __del__(self): + pass + def _getRSSData(self): return self.provider._getRSSData() diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 6ff1f239..6328f67d 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -69,6 +69,9 @@ class NewznabProvider(generic.NZBProvider): self.default = False + def __del__(self): + pass + def configStr(self): return self.name + '|' + self.url + '|' + self.key + '|' + self.catIDs + '|' + str(int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback)) @@ -292,6 +295,9 @@ class NewznabCache(tvcache.TVCache): # only poll newznab providers every 15 minutes max self.minTime = 15 + def __del__(self): + pass + def _getRSSData(self): params = {"t": "tvsearch", diff --git a/sickbeard/providers/nextgen.py b/sickbeard/providers/nextgen.py index 8e1685c4..db25d5d5 100644 --- a/sickbeard/providers/nextgen.py +++ b/sickbeard/providers/nextgen.py @@ -71,6 +71,9 @@ class NextGenProvider(generic.TorrentProvider): self.login_opener = None + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -341,6 +344,9 @@ class NextGenCache(tvcache.TVCache): # Only poll NextGen every 10 minutes max self.minTime = 10 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/nyaatorrents.py b/sickbeard/providers/nyaatorrents.py index 6ac9e208..719feaee 100644 --- a/sickbeard/providers/nyaatorrents.py +++ b/sickbeard/providers/nyaatorrents.py @@ -45,6 +45,9 @@ class NyaaProvider(generic.TorrentProvider): self.url = 'http://www.nyaa.se/' + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -127,6 +130,8 @@ class NyaaCache(tvcache.TVCache): # only poll NyaaTorrents every 15 minutes max self.minTime = 15 + def __del__(self): + pass def _getRSSData(self): params = { diff --git a/sickbeard/providers/omgwtfnzbs.py b/sickbeard/providers/omgwtfnzbs.py index d3fc8f1e..7da7fdf3 100644 --- a/sickbeard/providers/omgwtfnzbs.py +++ b/sickbeard/providers/omgwtfnzbs.py @@ -49,6 +49,9 @@ class OmgwtfnzbsProvider(generic.NZBProvider): self.url = 'https://omgwtfnzbs.org/' self.supportsBacklog = True + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -157,6 +160,9 @@ class OmgwtfnzbsCache(tvcache.TVCache): tvcache.TVCache.__init__(self, provider) self.minTime = 20 + def __del__(self): + pass + def _getRSSData(self): params = {'user': provider.username, 'api': provider.api_key, diff --git a/sickbeard/providers/publichd.py b/sickbeard/providers/publichd.py index 13a3ea2d..d370f2c2 100644 --- a/sickbeard/providers/publichd.py +++ b/sickbeard/providers/publichd.py @@ -67,6 +67,9 @@ class PublicHDProvider(generic.TorrentProvider): self.categories = {'Season': ['23'], 'Episode': ['7', '14', '24'], 'RSS': ['7', '14', '23', '24']} + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -314,6 +317,9 @@ class PublicHDCache(tvcache.TVCache): # only poll ThePirateBay every 10 minutes max self.minTime = 20 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/rsstorrent.py b/sickbeard/providers/rsstorrent.py index 64d6e64d..3aac4d8d 100644 --- a/sickbeard/providers/rsstorrent.py +++ b/sickbeard/providers/rsstorrent.py @@ -52,6 +52,9 @@ class TorrentRssProvider(generic.TorrentProvider): else: self.cookies = '' + def __del__(self): + pass + def configStr(self): return self.name + '|' + self.url + '|' + self.cookies + '|' + str(int(self.enabled)) + '|' + self.search_mode + '|' + str(int(self.search_fallback)) + '|' + str(int(self.backlog_only)) @@ -170,6 +173,9 @@ class TorrentRssCache(tvcache.TVCache): tvcache.TVCache.__init__(self, provider) self.minTime = 15 + def __del__(self): + pass + def _getRSSData(self): logger.log(u"TorrentRssCache cache update URL: " + self.provider.url, logger.DEBUG) if self.provider.cookies: diff --git a/sickbeard/providers/scc.py b/sickbeard/providers/scc.py index 4ec68eef..564b3daf 100644 --- a/sickbeard/providers/scc.py +++ b/sickbeard/providers/scc.py @@ -73,6 +73,9 @@ class SCCProvider(generic.TorrentProvider): self.headers = {'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'} + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -336,6 +339,9 @@ class SCCCache(tvcache.TVCache): # only poll SCC every 10 minutes max self.minTime = 20 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/speedcd.py b/sickbeard/providers/speedcd.py index 690e11ac..16d611e3 100644 --- a/sickbeard/providers/speedcd.py +++ b/sickbeard/providers/speedcd.py @@ -66,6 +66,9 @@ class SpeedCDProvider(generic.TorrentProvider): self.categories = {'Season': {'c14': 1}, 'Episode': {'c2': 1, 'c49': 1}, 'RSS': {'c14': 1, 'c2': 1, 'c49': 1}} + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -276,6 +279,9 @@ class SpeedCDCache(tvcache.TVCache): # only poll Speedcd every 20 minutes max self.minTime = 20 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/thepiratebay.py b/sickbeard/providers/thepiratebay.py index 54a49817..e7818827 100644 --- a/sickbeard/providers/thepiratebay.py +++ b/sickbeard/providers/thepiratebay.py @@ -67,6 +67,9 @@ class ThePirateBayProvider(generic.TorrentProvider): self.re_title_url = '/torrent/(?P\d+)/(?P.*?)//1".+?(?P<url>magnet.*?)//1".+?(?P<seeders>\d+)</td>.+?(?P<leechers>\d+)</td>' + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -409,6 +412,9 @@ class ThePirateBayCache(tvcache.TVCache): # only poll ThePirateBay every 10 minutes max self.minTime = 20 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days @@ -471,6 +477,9 @@ class ThePirateBayWebproxy: 'Hiload.org (NL)': 'http://hiload.org/', } + def __del__(self): + pass + def isEnabled(self): """ Return True if we Choose to call TPB via Proxy """ return self.enabled diff --git a/sickbeard/providers/torrentday.py b/sickbeard/providers/torrentday.py index 9fadfab1..a7e0275c 100644 --- a/sickbeard/providers/torrentday.py +++ b/sickbeard/providers/torrentday.py @@ -72,6 +72,9 @@ class TorrentDayProvider(generic.TorrentProvider): self.categories = {'Season': {'c14': 1}, 'Episode': {'c2': 1, 'c26': 1, 'c7': 1, 'c24': 1}, 'RSS': {'c2': 1, 'c26': 1, 'c7': 1, 'c24': 1, 'c14': 1}} + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -300,6 +303,9 @@ class TorrentDayCache(tvcache.TVCache): # Only poll IPTorrents every 10 minutes max self.minTime = 10 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/torrentleech.py b/sickbeard/providers/torrentleech.py index 833749be..08384528 100644 --- a/sickbeard/providers/torrentleech.py +++ b/sickbeard/providers/torrentleech.py @@ -67,6 +67,9 @@ class TorrentLeechProvider(generic.TorrentProvider): self.categories = "2,26,27,32" + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -295,6 +298,9 @@ class TorrentLeechCache(tvcache.TVCache): # only poll TorrentLeech every 20 minutes max self.minTime = 20 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/providers/tvtorrents.py b/sickbeard/providers/tvtorrents.py index fbbc17dd..c743dc30 100644 --- a/sickbeard/providers/tvtorrents.py +++ b/sickbeard/providers/tvtorrents.py @@ -47,6 +47,9 @@ class TvTorrentsProvider(generic.TorrentProvider): self.url = 'http://www.tvtorrents.com/' + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -86,6 +89,9 @@ class TvTorrentsCache(tvcache.TVCache): # only poll TvTorrents every 15 minutes max self.minTime = 15 + def __del__(self): + pass + def _getRSSData(self): # These will be ignored on the serverside. ignore_regex = "all.month|month.of|season[\s\d]*complete" diff --git a/sickbeard/providers/womble.py b/sickbeard/providers/womble.py index c14dfc7a..df2fe780 100644 --- a/sickbeard/providers/womble.py +++ b/sickbeard/providers/womble.py @@ -31,6 +31,9 @@ class WombleProvider(generic.NZBProvider): self.cache = WombleCache(self) self.url = 'http://newshost.co.za/' + def __del__(self): + pass + def isEnabled(self): return self.enabled @@ -41,6 +44,9 @@ class WombleCache(tvcache.TVCache): # only poll Womble's Index every 15 minutes max self.minTime = 15 + def __del__(self): + pass + def updateCache(self): # delete anything older then 7 days diff --git a/sickbeard/rssfeeds.py b/sickbeard/rssfeeds.py index d843c551..b6611a0f 100644 --- a/sickbeard/rssfeeds.py +++ b/sickbeard/rssfeeds.py @@ -23,23 +23,14 @@ class RSSFeeds: logger.log(u"RSS error: " + ex(e), logger.ERROR) raise - def __enter__(self): - return self - - def __exit__(self, type, value, tb): - self.fc = None + def __del__(self): self.fs.close() def clearCache(self, age=None): - if not self.fc: - return - - self.fc.purge(age) - - def getRSSFeed(self, url, post_data=None, request_headers=None): - if not self.fc: - return + with feed_lock: + self.fc.purge(age) + def getFeed(self, url, post_data=None, request_headers=None): with feed_lock: parsed = list(urlparse.urlparse(url)) parsed[2] = re.sub("/{2,}", "/", parsed[2]) # replace two or more / with one @@ -59,4 +50,4 @@ class RSSFeeds: logger.log(u"No RSS items found using URL: " + url, logger.WARNING) return - return feed + return feed diff --git a/sickbeard/scheduler.py b/sickbeard/scheduler.py index 70ae21ae..de3a2891 100644 --- a/sickbeard/scheduler.py +++ b/sickbeard/scheduler.py @@ -44,6 +44,9 @@ class Scheduler: self.abort = False self.force = False + def __del__(self): + pass + def initThread(self): if self.thread == None or not self.thread.isAlive(): self.thread = threading.Thread(None, self.runAction, self.threadName) diff --git a/sickbeard/searchBacklog.py b/sickbeard/searchBacklog.py index e162d390..6cf37916 100644 --- a/sickbeard/searchBacklog.py +++ b/sickbeard/searchBacklog.py @@ -40,6 +40,8 @@ class BacklogSearchScheduler(scheduler.Scheduler): else: return datetime.date.fromordinal(self.action._lastBacklog + self.action.cycleTime) + def __del__(self): + pass class BacklogSearcher: def __init__(self): @@ -53,6 +55,9 @@ class BacklogSearcher: self._resetPI() + def __del__(self): + pass + def _resetPI(self): self.percentDone = 0 self.currentSearchInfo = {'title': 'Initializing'} diff --git a/sickbeard/search_queue.py b/sickbeard/search_queue.py index 1eb53157..c1968440 100644 --- a/sickbeard/search_queue.py +++ b/sickbeard/search_queue.py @@ -43,6 +43,9 @@ class SearchQueue(generic_queue.GenericQueue): generic_queue.GenericQueue.__init__(self) self.queue_name = "SEARCHQUEUE" + def __del__(self): + pass + def is_in_queue(self, show, segment): for cur_item in self.queue: if isinstance(cur_item, BacklogQueueItem) and cur_item.show == show and cur_item.segment == segment: @@ -93,6 +96,9 @@ class DailySearchQueueItem(generic_queue.QueueItem): self.show = show self.segment = segment + def __del__(self): + pass + def execute(self): generic_queue.QueueItem.execute(self) @@ -125,6 +131,9 @@ class ManualSearchQueueItem(generic_queue.QueueItem): self.show = show self.segment = segment + def __del__(self): + pass + def execute(self): generic_queue.QueueItem.execute(self) @@ -168,6 +177,9 @@ class BacklogQueueItem(generic_queue.QueueItem): self.show = show self.segment = segment + def __del__(self): + pass + def execute(self): generic_queue.QueueItem.execute(self) @@ -211,6 +223,9 @@ class FailedQueueItem(generic_queue.QueueItem): self.segment = segment self.success = None + def __del__(self): + pass + def execute(self): generic_queue.QueueItem.execute(self) diff --git a/sickbeard/showUpdater.py b/sickbeard/showUpdater.py index 30067a0f..8d371af3 100644 --- a/sickbeard/showUpdater.py +++ b/sickbeard/showUpdater.py @@ -103,3 +103,6 @@ class ShowUpdater(): ui.ProgressIndicators.setIndicator('dailyUpdate', ui.QueueProgressIndicator("Daily Update", piList)) logger.log(u"Completed full update on all shows") + + def __del__(self): + pass diff --git a/sickbeard/traktChecker.py b/sickbeard/traktChecker.py index a33ef817..51d2b7ef 100644 --- a/sickbeard/traktChecker.py +++ b/sickbeard/traktChecker.py @@ -33,6 +33,9 @@ class TraktChecker(): self.todoWanted = [] self.todoBacklog = [] + def __del__(self): + pass + def run(self, force=False): # add shows from trakt.tv watchlist if sickbeard.TRAKT_USE_WATCHLIST: diff --git a/sickbeard/tv.py b/sickbeard/tv.py index f06d75dd..11dfa536 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -103,6 +103,9 @@ class TVShow(object): self.loadFromDB() + def __del__(self): + pass + name = property(lambda self: self._name, dirty_setter("_name")) indexerid = property(lambda self: self._indexerid, dirty_setter("_indexerid")) indexer = property(lambda self: self._indexer, dirty_setter("_indexer")) @@ -1348,6 +1351,9 @@ class TVEpisode(object): self.checkForMetaFiles() + def __del__(self): + pass + name = property(lambda self: self._name, dirty_setter("_name")) season = property(lambda self: self._season, dirty_setter("_season")) episode = property(lambda self: self._episode, dirty_setter("_episode")) diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index 8dfeb7e8..d27bf9b6 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -68,6 +68,8 @@ class CacheDBConnection(db.DBConnection): if str(e) != "table lastUpdate already exists": raise + def __del__(self): + pass class TVCache(): def __init__(self, provider): @@ -76,6 +78,9 @@ class TVCache(): self.providerID = self.provider.getID() self.minTime = 10 + def __del__(self): + pass + def _getDB(self): return CacheDBConnection(self.providerID) @@ -134,9 +139,7 @@ class TVCache(): return [] def getRSSFeed(self, url, post_data=None, request_headers=None): - with RSSFeeds(self.providerID) as feed: - data = feed.getRSSFeed(url, post_data, request_headers) - return data + return RSSFeeds(self.providerID).getFeed(url, post_data, request_headers) def _translateTitle(self, title): return title.replace(' ', '.') diff --git a/sickbeard/ui.py b/sickbeard/ui.py index 43044c6c..44348b69 100644 --- a/sickbeard/ui.py +++ b/sickbeard/ui.py @@ -30,6 +30,9 @@ class Notifications(object): self._messages = [] self._errors = [] + def __del__(self): + pass + def message(self, title, message=''): """ Add a regular notification to the queue @@ -89,6 +92,9 @@ class Notification(object): else: self._timeout = datetime.timedelta(minutes=1) + def __del__(self): + pass + def is_new(self, remote_ip='127.0.0.1'): """ Returns True if the notification hasn't been displayed to the current client (aka IP address). diff --git a/sickbeard/versionChecker.py b/sickbeard/versionChecker.py index 86fc2753..59215eff 100644 --- a/sickbeard/versionChecker.py +++ b/sickbeard/versionChecker.py @@ -53,6 +53,9 @@ class CheckVersion(): else: self.updater = None + def __del__(self): + pass + def run(self, force=False): if self.check_for_new_version(): if sickbeard.AUTO_UPDATE: