From 27b8c98b09aa9971724ed76608ad02ed98c01737 Mon Sep 17 00:00:00 2001 From: h3llrais3r Date: Thu, 16 Jul 2015 09:25:45 +0200 Subject: [PATCH] Fix scanning of DVD (VIDEO_TS) files This fixes issue https://github.com/RuudBurger/CouchPotatoServer/issues/3609 Thanks to @rhodespa --- couchpotato/core/plugins/scanner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/scanner.py b/couchpotato/core/plugins/scanner.py index 8ba5dae..1088ddd 100644 --- a/couchpotato/core/plugins/scanner.py +++ b/couchpotato/core/plugins/scanner.py @@ -797,6 +797,10 @@ class Scanner(Plugin): identifier = file_path.replace(folder, '').lstrip(os.path.sep) # root folder identifier = os.path.splitext(identifier)[0] # ext + # Exclude file name path if needed (f.e. for DVD files) + if exclude_filename: + identifier = identifier[:len(identifier) - len(os.path.split(identifier)[-1])] + # Make sure the identifier is lower case as all regex is with lower case tags identifier = identifier.lower() @@ -805,9 +809,6 @@ class Scanner(Plugin): identifier = path_split[-2] if len(path_split) > 1 and len(path_split[-2]) > len(path_split[-1]) else path_split[-1] # Only get filename except: pass - if exclude_filename: - identifier = identifier[:len(identifier) - len(os.path.split(identifier)[-1])] - # multipart identifier = self.removeMultipart(identifier)