repair.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:MusicNow 作者: kalbhor 项目源码 文件源码
def add_albumart(albumart, song_title):
    '''
    Adds the album art to the song
    '''

    try:
        img = urlopen(albumart)  # Gets album art from url

    except Exception:
        log.log_error("* Could not add album art", indented=True)
        return None

    audio = EasyMP3(song_title, ID3=ID3)
    try:
        audio.add_tags()
    except _util.error:
        pass

    audio.tags.add(
        APIC(
            encoding=3,  # UTF-8
            mime='image/png',
            type=3,  # 3 is for album art
            desc='Cover',
            data=img.read()  # Reads and adds album art
        )
    )
    audio.save()
    log.log("> Added album art")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号