【问题标题】:get audio file object from amazon s3从 amazon s3 获取音频文件对象
【发布时间】:2019-06-25 10:32:51
【问题描述】:

我想从音频文件中获取音频标签。为此,我使用了 eyed3 插件。

import eyed3
mp3_file = "The_File_Path"
audiofile = eyed3.load(mp3_file)
year = audiofile.tag.getBestDate()

但我只有音频文件的 amazon s3 URL。如何从 s3 URL 获取文件对象?

【问题讨论】:

  • 你看过boto3吗?
  • 你在问如何下载文件吗?..
  • @Sayse 不下载,想用 eyed3 读取文件
  • @aws_apprentice 还没有
  • 所以查看boto3 并使用它来下载并使用这个其他程序eyed3 来阅读音频

标签: python amazon-s3 mp3 audioformat eyed3


【解决方案1】:

eyed3.load() 命令需要本地操作系统中文件的路径。

因此,您需要先将文件下载到本地机器,然后再加载:

import boto3
s3_client = boto3.resource('s3', region='us-west-2')
s3_client.download_file('my-bucket', 'music.mp3', '/tmp/music.mp3')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-29
    • 2014-02-17
    • 1970-01-01
    • 1970-01-01
    • 2013-10-25
    相关资源
    最近更新 更多