Merge pull request #717 from croneter/fix-playlists
Fix rare case where thousands of identical playlists could be generated
This commit is contained in:
commit
da1cb6e3d7
1 changed files with 5 additions and 1 deletions
|
@ -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):
|
def create(plex_id):
|
||||||
|
@ -53,6 +53,10 @@ def create(plex_id):
|
||||||
'%s_01.m3u' % name[:min(len(name), 248)])
|
'%s_01.m3u' % name[:min(len(name), 248)])
|
||||||
else:
|
else:
|
||||||
number = int(occurance.group(1)) + 1
|
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)
|
basename = re.sub(REGEX_FILE_NUMBERING, '', path)
|
||||||
path = '%s_%02d.m3u' % (basename, number)
|
path = '%s_%02d.m3u' % (basename, number)
|
||||||
LOG.debug('Kodi playlist path: %s', path)
|
LOG.debug('Kodi playlist path: %s', path)
|
||||||
|
|
Loading…
Reference in a new issue