From de80885aa5321b7176806fb7d2259cee09c41a5c Mon Sep 17 00:00:00 2001 From: croneter Date: Thu, 28 Mar 2019 13:08:03 +0100 Subject: [PATCH] Fix playback sometimes not being reported for direct paths --- resources/lib/kodi_db/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/lib/kodi_db/__init__.py b/resources/lib/kodi_db/__init__.py index 70e79bf9..052f7827 100644 --- a/resources/lib/kodi_db/__init__.py +++ b/resources/lib/kodi_db/__init__.py @@ -22,9 +22,14 @@ def kodiid_from_filename(path, kodi_type=None, db_type=None): """ kodi_id = None path = utils.try_decode(path) - path, filename = path_ops.path.split(path) # Make sure path ends in either '/' or '\' - path = path_ops.path.join(path, '') + # We CANNOT use path_ops.path.join as this can result in \ where we need / + try: + filename = path.rsplit('/', 1)[1] + path = path.rsplit('/', 1)[0] + '/' + except IndexError: + filename = path.rsplit('\\', 1)[1] + path = path.rsplit('\\', 1)[0] + '\\' if kodi_type == v.KODI_TYPE_SONG or db_type == 'music': with KodiMusicDB(lock=False) as kodidb: try: