From 873c9e74f55a8afa897590cde7ac0c33136b0a0b Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 8 Feb 2019 15:15:52 +0100 Subject: [PATCH] Fix rare case where thousands of identical playlists could be generated --- resources/lib/playlists/kodi_pl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/lib/playlists/kodi_pl.py b/resources/lib/playlists/kodi_pl.py index 84afd07f..f131d79d 100644 --- a/resources/lib/playlists/kodi_pl.py +++ b/resources/lib/playlists/kodi_pl.py @@ -17,7 +17,7 @@ LOG = getLogger('PLEX.playlists.kodi_pl') ############################################################################### -REGEX_FILE_NUMBERING = re.compile(r'''_(\d+)\.\w+$''') +REGEX_FILE_NUMBERING = re.compile(r'''_(\d\d)\.\w+$''') def create(plex_id): @@ -53,6 +53,10 @@ def create(plex_id): '%s_01.m3u' % name[:min(len(name), 248)]) else: number = int(occurance.group(1)) + 1 + if number > 3: + LOG.error('Detected spanning tree issue, abort sync for %s', + playlist) + raise PlaylistError('Spanning tree warning') basename = re.sub(REGEX_FILE_NUMBERING, '', path) path = '%s_%02d.m3u' % (basename, number) LOG.debug('Kodi playlist path: %s', path)