only add to cache if not empty

This commit is contained in:
Roy Olav Purser 2021-06-04 09:18:57 +02:00
parent a38d7bef9c
commit 1176c35981
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -78,6 +78,11 @@ class StreamData():
return self.values.get("description")
def complete(self):
return None not in self.values.values()
def has_data(self):
for elem in self.values.values():
if isinstance(elem, str):
return True
return False
def meta(self):
data = []
if isinstance(self.values.get("thumbnail"), str):
@ -246,8 +251,9 @@ async def get_from_runner(cache_key, runner, logger):
except Exception as e:
logger.info(e)
else:
upstream_cache[cache_key] = result_temp
result = result_temp
if isinstance(result_temp, StreamData) and result_temp.has_data():
upstream_cache[cache_key] = result_temp
result = result_temp
return result
async def get_streamlink(upstream, proxy, logger):