remove output options
This commit is contained in:
parent
110d3076df
commit
cdc1706ab7
1 changed files with 3 additions and 28 deletions
|
@ -134,36 +134,11 @@ class GetYoutubeVideos:
|
||||||
data['last_update'] = time.time()
|
data['last_update'] = time.time()
|
||||||
with open(self.config['cache_file'], 'w', encoding='utf-8') as cache_file:
|
with open(self.config['cache_file'], 'w', encoding='utf-8') as cache_file:
|
||||||
json.dump(data, cache_file, indent=2)
|
json.dump(data, cache_file, indent=2)
|
||||||
self._debug(
|
self._log.debug(
|
||||||
f"Saved cached data in '{self.config['cache_file']}'",
|
"Saved cached data in '%s'",
|
||||||
|
self.config['cache_file']
|
||||||
)
|
)
|
||||||
|
|
||||||
def _output(self, message):
|
|
||||||
if self.config['output_format'] == 'JSON':
|
|
||||||
return json.dumps(message, indent=2)
|
|
||||||
elif self.config['output_format'] == 'YAML':
|
|
||||||
return yaml.dump(message, Dumper=yaml.Dumper)
|
|
||||||
elif self.config['output_format'] == 'PLAIN':
|
|
||||||
return f"{message}"
|
|
||||||
else:
|
|
||||||
self._log.warning(
|
|
||||||
"Output format '%s' not supported",
|
|
||||||
self.config['output_format']
|
|
||||||
)
|
|
||||||
return message
|
|
||||||
|
|
||||||
def _info(self, message):
|
|
||||||
return self._log.info(self._output(message))
|
|
||||||
|
|
||||||
def _warning(self, message):
|
|
||||||
return self._log.warning(self._output(message))
|
|
||||||
|
|
||||||
def _error(self, message):
|
|
||||||
return self._log.error(self._output(message))
|
|
||||||
|
|
||||||
def _debug(self, message):
|
|
||||||
return self._log.debug(self._output(message))
|
|
||||||
|
|
||||||
def _is_numeric(self, variable):
|
def _is_numeric(self, variable):
|
||||||
if isinstance(variable, (int, float, complex)):
|
if isinstance(variable, (int, float, complex)):
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue