From c0d9d616c88a39f47401a4a2bea9bf41827a5733 Mon Sep 17 00:00:00 2001 From: spl0k Date: Sun, 10 Mar 2019 11:52:18 +0100 Subject: [PATCH] Truncate artist, album and title when scanning Closes #138 --- supysonic/scanner.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/supysonic/scanner.py b/supysonic/scanner.py index 76a4544..6da6d22 100644 --- a/supysonic/scanner.py +++ b/supysonic/scanner.py @@ -130,13 +130,13 @@ class Scanner: trdict = { 'path': path } - artist = self.__try_read_tag(tag, 'artist', '[unknown]') - album = self.__try_read_tag(tag, 'album', '[non-album tracks]') - albumartist = self.__try_read_tag(tag, 'albumartist', artist) + artist = self.__try_read_tag(tag, 'artist', '[unknown]')[:255] + album = self.__try_read_tag(tag, 'album', '[non-album tracks]')[:255] + albumartist = self.__try_read_tag(tag, 'albumartist', artist)[:255] trdict['disc'] = self.__try_read_tag(tag, 'discnumber', 1, lambda x: int(x.split('/')[0])) trdict['number'] = self.__try_read_tag(tag, 'tracknumber', 1, lambda x: int(x.split('/')[0])) - trdict['title'] = self.__try_read_tag(tag, 'title', os.path.basename(path)) + trdict['title'] = self.__try_read_tag(tag, 'title', os.path.basename(path))[:255] trdict['year'] = self.__try_read_tag(tag, 'date', None, lambda x: int(x.split('-')[0])) trdict['genre'] = self.__try_read_tag(tag, 'genre') trdict['duration'] = int(tag.info.length)