【问题标题】:How can I get banner art, artist name and the song name from a .mp3 file using python?如何使用 python 从 .mp3 文件中获取横幅艺术、艺术家姓名和歌曲名称?
【发布时间】:2020-09-09 16:30:06
【问题描述】:

**

我想制作一个音乐应用程序,并且我成功地获取了歌曲并使用来自 kivy.core.audio 的 SoundLoader 播放它们

我还将它们添加到 OneLineIconList 项目中但我不知道如何仅使用 python 获取专辑封面/横幅艺术、艺术家姓名、歌曲名称和歌曲的持续时间

还有可能使其全部离线。如果是,那么请您给我代码


提前感谢您

**

【问题讨论】:

标签: python-3.x kivy kivy-language kivymd albumart


【解决方案1】:
import os

st = os.stat("file.dat")

这个函数接受一个文件名,并返回一个包含以下内容的 10 成员元组:

(mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)

下面是一个简短的用法示例:

import os, time
from stat import * # ST_SIZE etc

try:
    st = os.stat(file)
except IOError:
    print "failed to get information about", file
else:
    print "file size:", st[ST_SIZE]
    print "file modified:", time.asctime(time.localtime(st[ST_MTIME]))

来源:http://effbot.org/zone/python-fileinfo.htm

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-30
    • 1970-01-01
    • 2016-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多