0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

eyed3 / mp3のtag情報をpythonで操作する

Posted at

mp3の情報を操作する

import eyed3

audiofile = eyed3.load("song.mp3")
audiofile.tag.artist = u"Nobunny"
audiofile.tag.album = u"Love Visions"
audiofile.tag.title = u"I Am a Girlfriend"
audiofile.tag.track_num = 4
audiofile.tag.save()

python自作プログラム

# !/usr/bin/python
# -*- coding: utf-8 -*-
#
import    os
import    sys
import    glob
import    eyed3


def    prtinfo( songfile, song ):
    print    "sonffile:", songfile
    print    "title   :", song.tag.title
    print    "artist  :", song.tag.artist
    print    "album   :", song.tag.album
    print    "a_artist:", song.tag.album_artist
    print    "track   :", song.tag.track_num
    # print song.tag.frame_set

def    prtinfo2( songfile, song ):
    frame=song.tag.frame_set[ 'TXXX' ]
    if frame is None:
        return
    else:
        for x in frame:
            print x.description, "=>", x.text

def delUserTextFrame( sonfgile, song ):
    frame=song.tag.frame_set[ 'TXXX' ]
    if frame is None:
        return
    else:
        del frame[:]
    pass



'''=====
main
'''

for argv in sys.argv[ 1: ] :
    songfile=argv
    song=eyed3.load( songfile )

    print "==== MP3 tags ===="
    prtinfo( songfile, song )
    print "==== User Text Frame ===="
    prtinfo2( songfile, song )
    delUserTextFrame( songfile, song )

    # prtinfo()
    # prtinfo2()
    song.tag.save()

eyeD3 コマンド

eyeD3 hoge.mp3
eyeD3 --help
# タグの削除
eyeD3 --user-text-frame '93A74BEA-CE97-5571-A56A-C5084DBA9873:' *.mp3
eyeD3 --remove-all-comments *.mp3
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?