Finding the length of an mp3 file

前端 未结 5 1370
孤城傲影
孤城傲影 2020-12-09 09:02

So i have the code:

import glob,os
import random


path = \'C:\\\\Music\\\\\'
aw=[]
for infile in glob.glob( os.path.join(path,\'*.mp3\') ):
    libr = infil         


        
5条回答
  •  感动是毒
    2020-12-09 09:31

    You can use mutagen to get the length of the song (see the tutorial):

    from mutagen.mp3 import MP3
    audio = MP3("example.mp3")
    print(audio.info.length)
    

提交回复
热议问题