我正在尝试从存储在OneDrive中的Ogg文件中读取音频元数据。 OGG文件用VORBIS_COMMENTS标记如下:
album=Pulse
asin=B000002B35
musicbrainz_artistid=83d91898-7763-47d7-b03b-b92132375c47
musicbrainz_albumstatus=official
title=Speak to Me
artist=Pink Floyd
musicbrainz_trackid=d59cccb9-72da-45e6-be9f-84808deb8d33
artistsort=Pink Floyd
musicbrainz_albumartistid=83d91898-7763-47d7-b03b-b92132375c47
musicbrainz_albumtype=album
date=1995
tracknumber=1
discnumber=2
musicbrainz_albumid=76031424-5fd4-3948-a1f0-60eccc7c6d6e
REPLAYGAIN_TRACK_PEAK=0.56832260
REPLAYGAIN_TRACK_GAIN=+12.08 dB
REPLAYGAIN_ALBUM_PEAK=1.07863712
REPLAYGAIN_ALBUM_GAIN=-3.66 dB
但是,当我使用OneDrive API读取音频数据时,从未设置光盘编号。我可以成功读回专辑,艺术家,标题和曲目号。
我尝试了下面的代码,它总是报告光盘号为“ None”,但其他标签的有效值为:
http_provider = onedrivesdk.HttpProvider()
auth_provider = onedrivesdk.AuthProvider(
http_provider=http_provider,
client_id=client_id,
scopes=scopes)
auth_provider.load_session()
auth_provider.refresh_token()
client = onedrivesdk.OneDriveClient(api_base_url, auth_provider, http_provider)
collection = client.item(drive='me', id='root').children.request().get()
for item in collection:
if item.name == "Pulse":
pulse = client.item(id=item.id).children.request().get()
for pulse_item in pulse:
pprint(pulse_item.name)
if (pulse_item.audio):
print("Album: " + pulse_item.audio.album)
print("Artist: " + pulse_item.audio.artist)
print("Title: " + pulse_item.audio.title)
print("Track: " + str(pulse_item.audio.track))
print("Disc: " + str(pulse_item.audio.disc))
我希望可以正确检索光盘号,但是我得到的只是输出中的光盘号为“ None”。