i think i nailed it...

This commit is contained in:
brent s. 2017-03-25 03:29:48 -04:00
parent 37c3059928
commit e8bf36d88a

View File

@ -291,6 +291,7 @@ def imgConv(imgfile):
# Be kind, please rewind. # Be kind, please rewind.
# Don't sue me, Blockbuster. lol # Don't sue me, Blockbuster. lol
img_stream.seek(0) img_stream.seek(0)
img_stream = img_stream.read()
else: else:
with open(imgfile) as f: with open(imgfile) as f:
img_stream = f.read() img_stream = f.read()
@ -308,11 +309,11 @@ def tagMP3(conf, mediafile):
tag.add(TALB(encoding = 3, tag.add(TALB(encoding = 3,
text = [conf['tags']['album']])) text = [conf['tags']['album']]))
tag.add(APIC(encoding = 3, tag.add(APIC(encoding = 3,
mime = imgmime, mime = img_meta['mime'],
type = 3, type = 3,
desc = '{0} ({1})'.format(conf['tags']['artist'], desc = '{0} ({1})'.format(conf['tags']['artist'],
conf['tags']['comment']), conf['tags']['comment']),
data = img_stream.read())) data = img_stream))
tag.add(TDRC(encoding = 3, tag.add(TDRC(encoding = 3,
text = ['{0}.{1}.{2}'.format(conf['tags']['year'], text = ['{0}.{1}.{2}'.format(conf['tags']['year'],
conf['episode']['month'], conf['episode']['month'],
@ -338,7 +339,6 @@ def tagMP3(conf, mediafile):
tag.add(TCOP(encoding = 3, tag.add(TCOP(encoding = 3,
text = [conf['tags']['copyright']])) text = [conf['tags']['copyright']]))
tag.save() tag.save()
img_stream.seek(0)


def tagOGG(conf, mediafile): def tagOGG(conf, mediafile):
# https://mutagen.readthedocs.io/en/latest/user/vcomment.html # https://mutagen.readthedocs.io/en/latest/user/vcomment.html
@ -354,7 +354,9 @@ def tagOGG(conf, mediafile):
picture.mime = img_meta['mime'] picture.mime = img_meta['mime']
picture.width = img_meta['width'] picture.width = img_meta['width']
picture.height = img_meta['height'] picture.height = img_meta['height']
picture.depth = img_meta['bits'] picture.depth = img_meta['depth']
picture.desc = '{0} ({1})'.format(conf['tags']['artist'],
conf['tags']['comment'])
containered_data = picture.write() containered_data = picture.write()
encoded_data = base64.b64encode(containered_data) encoded_data = base64.b64encode(containered_data)
img_tag = encoded_data.decode('ascii') img_tag = encoded_data.decode('ascii')
@ -375,7 +377,6 @@ def tagOGG(conf, mediafile):
tag['ENCODER'] = conf['tags']['encoded'] tag['ENCODER'] = conf['tags']['encoded']
tag['METADATA_BLOCK_PICTURE'] = [img_tag] tag['METADATA_BLOCK_PICTURE'] = [img_tag]
tag.save() tag.save()
img_stream.seek(0)


def getSHA256(mediafile): def getSHA256(mediafile):
print('{0}: Generating SHA256 for {1}...'.format(datetime.datetime.now(), print('{0}: Generating SHA256 for {1}...'.format(datetime.datetime.now(),