From: Radek Czajka Date: Mon, 17 Jun 2019 12:26:05 +0000 (+0200) Subject: Str/bytes fix for publishing audiobooks. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/7e113c61d336d677b96ff0ed55a5f81eb2b80d53 Str/bytes fix for publishing audiobooks. --- diff --git a/src/catalogue/models/bookmedia.py b/src/catalogue/models/bookmedia.py index 957e982d1..ec37849d2 100644 --- a/src/catalogue/models/bookmedia.py +++ b/src/catalogue/models/bookmedia.py @@ -99,10 +99,10 @@ class BookMedia(models.Model): artist_name = ', '.join(', '.join(tag.text) for tag in audio.getall('TPE1')) director_name = ', '.join(', '.join(tag.text) for tag in audio.getall('TPE3')) project = ", ".join([ - t.data for t in audio.getall('PRIV') + t.data.decode('utf-8') for t in audio.getall('PRIV') if t.owner == 'wolnelektury.pl?project']) funded_by = ", ".join([ - t.data for t in audio.getall('PRIV') + t.data.decode('utf-8') for t in audio.getall('PRIV') if t.owner == 'wolnelektury.pl?funded_by']) except MutagenError: pass @@ -134,7 +134,7 @@ class BookMedia(models.Model): if filetype == 'mp3': try: audio = id3.ID3(filepath) - return [t.data for t in audio.getall('PRIV') + return [t.data.decode('utf-8') for t in audio.getall('PRIV') if t.owner == 'wolnelektury.pl?flac_sha1'][0] except (MutagenError, IndexError): return None