From b8a1919d8194846cc1c8c5ba457bcc6d249fdf5c Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Fri, 6 Aug 2021 21:26:26 +0100 Subject: [PATCH] Add pickle support to TVInfoShow so diskcache can be used. --- lib/tvinfo_base/base.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/tvinfo_base/base.py b/lib/tvinfo_base/base.py index c4806f9..1b3c675 100644 --- a/lib/tvinfo_base/base.py +++ b/lib/tvinfo_base/base.py @@ -384,6 +384,18 @@ class TVInfoShow(dict): return results + def __getstate__(self): + d = dict(self.__dict__) + try: + del d['lock'] + except (BaseException, Exception): + pass + return d + + def __setstate__(self, d): + self.__dict__ = d + self.lock = threading.RLock() + __repr__ = __str__ __nonzero__ = __bool__