From 2a862b5169821e1092a133f2519957bd66e32e80 Mon Sep 17 00:00:00 2001 From: Croneter Date: Thu, 3 May 2018 08:29:14 +0200 Subject: [PATCH] Optimize length for playlist filename (m3u instead of m3u8) --- resources/lib/playlists.py | 4 ++-- resources/lib/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/lib/playlists.py b/resources/lib/playlists.py index 0d71e442..6f71b14c 100644 --- a/resources/lib/playlists.py +++ b/resources/lib/playlists.py @@ -113,12 +113,12 @@ def create_kodi_playlist(plex_id=None, updated_at=None): if not occurance: path = os.path.join(v.PLAYLIST_PATH, playlist.type, - '%s_01.m3u' % name[:min(len(name), 247)]) + '%s_01.m3u' % name[:min(len(name), 248)]) else: occurance = int(occurance.group(1)) + 1 path = os.path.join(v.PLAYLIST_PATH, playlist.type, - '%s_%02d.m3u' % (name[:min(len(name), 247)], + '%s_%02d.m3u' % (name[:min(len(name), 248)], occurance)) LOG.debug('Kodi playlist path: %s', path) playlist.kodi_path = path diff --git a/resources/lib/utils.py b/resources/lib/utils.py index 1a89a9ae..6e35c429 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -317,9 +317,9 @@ def valid_filename(text): text = unicodedata.normalize('NFKD', text) text = text.encode('ascii', 'ignore') text = text.decode('ascii') - # Ensure that filename length is at most 255 chars (including 4 chars for + # Ensure that filename length is at most 255 chars (including 3 chars for # filename extension and 1 dot to separate the extension) - text = text[:min(len(text), 250)] + text = text[:min(len(text), 251)] return text