From 7e113c61d336d677b96ff0ed55a5f81eb2b80d53 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Mon, 17 Jun 2019 14:26:05 +0200 Subject: [PATCH] Str/bytes fix for publishing audiobooks. --- src/catalogue/models/bookmedia.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.20.1