mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
Info_json may not yet be a MediaPath.
This commit is contained in:
parent
f9a1f736ca
commit
7d23a914e6
1 changed files with 6 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
import pathlib
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
|
@ -129,7 +130,11 @@ class Video(ModelHelper, Base):
|
|||
If this Video has an info_json file, return it's contents. Otherwise, return None.
|
||||
"""
|
||||
try:
|
||||
if self.info_json_path:
|
||||
if isinstance(self.info_json_path, pathlib.Path):
|
||||
with open(self.info_json_path, 'rb') as fh:
|
||||
contents = json.load(fh)
|
||||
return contents
|
||||
elif self.info_json_path:
|
||||
with open(self.info_json_path.path, 'rb') as fh:
|
||||
contents = json.load(fh)
|
||||
return contents
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue