Skip to content

Commit

Permalink
Add framerate as a dvd system fallback method
Browse files Browse the repository at this point in the history
Should fix or help mitigate #193
  • Loading branch information
Audionut committed Dec 13, 2024
1 parent 02534d3 commit 5ee0bce
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,9 @@ async def process_tracker(tracker_name, meta):
meta['3D'] = self.is_3d(mi, bdinfo)
if meta.get('manual_source', None):
meta['source'] = meta['manual_source']
_, meta['type'] = self.get_source(meta['type'], video, meta['path'], meta['is_disc'], meta)
_, meta['type'] = self.get_source(meta['type'], video, meta['path'], meta['is_disc'], meta, folder_id, base_dir)
else:
meta['source'], meta['type'] = self.get_source(meta['type'], video, meta['path'], meta['is_disc'], meta)
meta['source'], meta['type'] = self.get_source(meta['type'], video, meta['path'], meta['is_disc'], meta, folder_id, base_dir)
if meta.get('service', None) in (None, ''):
meta['service'], meta['service_longname'] = self.get_service(video, meta.get('tag', ''), meta['audio'], meta['filename'])
elif meta.get('service'):
Expand Down Expand Up @@ -2511,7 +2511,9 @@ def get_tag(self, video, meta):
tag = ""
return tag

def get_source(self, type, video, path, is_disc, meta):
def get_source(self, type, video, path, is_disc, meta, folder_id, base_dir):
with open(f'{base_dir}/tmp/{folder_id}/MediaInfo.json', 'r', encoding='utf-8') as f:
mi = json.load(f)
resolution = meta['resolution']
try:
try:
Expand Down Expand Up @@ -2546,6 +2548,17 @@ def get_source(self, type, video, path, is_disc, meta):
system = "NTSC"
except Exception:
system = ""
if system == "":
try:
framerate = mi['media']['track'][1].get('FrameRate', '')
if framerate == "25":
system = "PAL"
elif framerate:
system = "NTSC"
else:
system = ""
except Exception:
system = ""
finally:
if system is None:
system = ""
Expand Down

0 comments on commit 5ee0bce

Please sign in to comment.