Optimize length for playlist filename (m3u instead of m3u8)

This commit is contained in:
Croneter 2018-05-03 08:29:14 +02:00
parent 6bcddc8382
commit 2a862b5169
2 changed files with 4 additions and 4 deletions

View file

@ -113,12 +113,12 @@ def create_kodi_playlist(plex_id=None, updated_at=None):
if not occurance: if not occurance:
path = os.path.join(v.PLAYLIST_PATH, path = os.path.join(v.PLAYLIST_PATH,
playlist.type, playlist.type,
'%s_01.m3u' % name[:min(len(name), 247)]) '%s_01.m3u' % name[:min(len(name), 248)])
else: else:
occurance = int(occurance.group(1)) + 1 occurance = int(occurance.group(1)) + 1
path = os.path.join(v.PLAYLIST_PATH, path = os.path.join(v.PLAYLIST_PATH,
playlist.type, playlist.type,
'%s_%02d.m3u' % (name[:min(len(name), 247)], '%s_%02d.m3u' % (name[:min(len(name), 248)],
occurance)) occurance))
LOG.debug('Kodi playlist path: %s', path) LOG.debug('Kodi playlist path: %s', path)
playlist.kodi_path = path playlist.kodi_path = path

View file

@ -317,9 +317,9 @@ def valid_filename(text):
text = unicodedata.normalize('NFKD', text) text = unicodedata.normalize('NFKD', text)
text = text.encode('ascii', 'ignore') text = text.encode('ascii', 'ignore')
text = text.decode('ascii') 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) # filename extension and 1 dot to separate the extension)
text = text[:min(len(text), 250)] text = text[:min(len(text), 251)]
return text return text