from pydub import AudioSegment
from pydub.utils import mediainfo
import pprint
import argparse
ap = argparse.ArgumentParser("metadatatohtml")
ap.add_argument("mp3")
args = ap.parse_args()
z = mediainfo(args.mp3)
# sound= AudioSegment.from_file("podcasts/3_podcast.mp3", format="mp3")
# file=sound.export("out.mp3", tags={"podcaster":"lain"})
# print (mediainfo("out.mp3"))
def dict_to_html(dd, level=0):
"""
Convert dict to html using basic html tags
"""
import simplejson
text = ''
for k, v in dd.items():
text += '
' + ' '*(4*level) + '%s: %s' % (k, dict_to_html(v, level+1) if isinstance(v, dict) else (simplejson.dumps(v) if isinstance(v, list) else v))
return text
def dict_to_html_ul(dd, level=0):
"""
Convert dict to html using ul/li tags
"""
import simplejson
text = '