1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-12-22 17:06:17 +00:00

Truncate artist, album and title when scanning

Closes #138
This commit is contained in:
spl0k 2019-03-10 11:52:18 +01:00
parent a73d42b9d8
commit c0d9d616c8

View File

@ -130,13 +130,13 @@ class Scanner:
trdict = { 'path': path } trdict = { 'path': path }
artist = self.__try_read_tag(tag, 'artist', '[unknown]') artist = self.__try_read_tag(tag, 'artist', '[unknown]')[:255]
album = self.__try_read_tag(tag, 'album', '[non-album tracks]') album = self.__try_read_tag(tag, 'album', '[non-album tracks]')[:255]
albumartist = self.__try_read_tag(tag, 'albumartist', artist) 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['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['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['year'] = self.__try_read_tag(tag, 'date', None, lambda x: int(x.split('-')[0]))
trdict['genre'] = self.__try_read_tag(tag, 'genre') trdict['genre'] = self.__try_read_tag(tag, 'genre')
trdict['duration'] = int(tag.info.length) trdict['duration'] = int(tag.info.length)