From eb265d7a1303b94f6a2fbb22a9b48f758eb587b7 Mon Sep 17 00:00:00 2001 From: yk <849628213@qq.com> Date: Mon, 29 Jun 2020 20:20:48 +0800 Subject: [PATCH] add dvd directry support --- jellyfin_kodi/helper/__init__.py | 1 + jellyfin_kodi/helper/utils.py | 15 +++++++++++++++ jellyfin_kodi/objects/movies.py | 9 ++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/jellyfin_kodi/helper/__init__.py b/jellyfin_kodi/helper/__init__.py index b07a518c..8ba02c02 100644 --- a/jellyfin_kodi/helper/__init__.py +++ b/jellyfin_kodi/helper/__init__.py @@ -14,6 +14,7 @@ from .utils import find from .utils import event from .utils import validate from .utils import validate_bluray_dir +from .utils import validate_dvd_dir from .utils import values from .utils import JSONRPC from .utils import compare_version diff --git a/jellyfin_kodi/helper/utils.py b/jellyfin_kodi/helper/utils.py index 47dbeb05..be8c3cd4 100644 --- a/jellyfin_kodi/helper/utils.py +++ b/jellyfin_kodi/helper/utils.py @@ -276,6 +276,21 @@ def validate_bluray_dir(path): return True +def validate_dvd_dir(path): + + ''' Verify if path/VIDEO_TS/ is accessible. + ''' + + path = path + '/VIDEO_TS/' + + if not xbmcvfs.exists(path): + return False + + window('jellyfin_pathverified.bool', True) + + return True + + def values(item, keys): ''' Grab the values in the item for a list of keys {key},{key1}.... diff --git a/jellyfin_kodi/objects/movies.py b/jellyfin_kodi/objects/movies.py index d28f8e8a..27be5792 100644 --- a/jellyfin_kodi/objects/movies.py +++ b/jellyfin_kodi/objects/movies.py @@ -8,7 +8,7 @@ from kodi_six.utils import py2_encode import downloader as server from database import jellyfin_db, queries as QUEM -from helper import api, stop, validate, validate_bluray_dir, jellyfin_item, library_check, values, Local +from helper import api, stop, validate, validate_bluray_dir, validate_dvd_dir, jellyfin_item, library_check, values, Local from helper import LazyLogger from .obj import Objects @@ -176,6 +176,13 @@ class Movies(KodiDb): raise Exception("Failed to validate path. User stopped.") obj['Path'] = obj['Path'].replace(obj['Filename'], "") + + '''check dvd directries and point it to ./VIDEO_TS/VIDEO_TS.IFO''' + if validate_dvd_dir(obj['Path'] + obj['Filename']): + obj['Path'] = obj['Path'] + obj['Filename'] + '/VIDEO_TS/' + obj['Filename'] = 'VIDEO_TS.IFO' + LOG.debug("DVD directry %s",obj['Path']) + '''check bluray directries and point it to ./BDMV/index.bdmv''' if validate_bluray_dir(obj['Path'] + obj['Filename']): obj['Path'] = obj['Path'] + obj['Filename'] + '/BDMV/'