mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 01:16:18 -05:00
Handling failure to read info_json in its method.
This commit is contained in:
parent
634b16e6a3
commit
ce2e133066
2 changed files with 7 additions and 6 deletions
|
|
@ -120,6 +120,9 @@ class Video(ModelHelper, Base):
|
|||
pass
|
||||
except UnknownDirectory:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(f'Unable to parse info json {self.info_json_path}', exc_info=e)
|
||||
return None
|
||||
|
||||
def get_video_description(self) -> Optional[str]:
|
||||
"""
|
||||
|
|
@ -205,11 +208,7 @@ class Video(ModelHelper, Base):
|
|||
|
||||
def __json__(self):
|
||||
from modules.videos.common import minimize_video_info_json
|
||||
try:
|
||||
info_json = minimize_video_info_json(self.get_info_json()) if self.info_json_path else None
|
||||
except Exception as e:
|
||||
logger.warning(f'Unable to parse info json {self.info_json_path}', exc_info=e)
|
||||
info_json = None
|
||||
info_json = minimize_video_info_json(self.get_info_json()) if self.info_json_path else None
|
||||
|
||||
d = dict(
|
||||
caption_path=self.caption_path,
|
||||
|
|
|
|||
|
|
@ -433,10 +433,12 @@ def get_relative_to_media_directory(path: str) -> Path:
|
|||
return absolute.relative_to(get_media_directory())
|
||||
|
||||
|
||||
def minimize_dict(d: dict, keys: Iterable) -> dict:
|
||||
def minimize_dict(d: dict, keys: Iterable) -> Union[dict, None]:
|
||||
"""
|
||||
Return a new dictionary that contains only the keys provided.
|
||||
"""
|
||||
if d is None:
|
||||
return
|
||||
return {k: d[k] for k in set(keys) & d.keys()}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue