- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试用 Python 创建一个程序,它可以自动检索特定 MP3 文件夹的歌词。 [我从azlyrics.com得到歌词]
到目前为止,除了将歌词实际嵌入“歌词”标签之外,我已经成功地完成了所有操作。
你回答了一个关于阅读歌词的问题 here .
我想知道您能否帮我设置歌词。这是我的代码。
import urllib2 # For downloading webpage
import time # For pausing
import eyed3 # For MP3s
import re # For replacing characters
import os # For reading folders
path = raw_input('Please enter folder of music') # TODO Must make GUI PATH SELECTION
files = os.listdir(path)
for x in files:
# Must make the program stop for a while to minimize server load
time.sleep(3)
# Opening MP3
mp3 = eyed3.load(path + '/' + x)
# Setting Values
artist = mp3.tag.artist.lower()
raw_song = str(mp3.tag.title).lower()
song = re.sub('[^0-9a-zA-Z]+', '', raw_song) #Stripping songs of anything other than alpha-numeric characters
# Generating A-Z Lyrics URL
url = "http://www.azlyrics.com/lyrics/" + artist + "/" + song + ".html"
# Getting Source and extracting lyrics
text = urllib2.urlopen(url).read()
where_start = text.find('<!-- start of lyrics -->')
start = where_start + 26
where_end = text.find('<!-- end of lyrics -->')
end = where_end - 2
lyrics = unicode(text[start:end].replace('<br />', ''), "UTF8")
# Setting Lyrics to the ID3 "lyrics" tag
mp3.tag.lyrics = lyrics ### RUNNING INTO PROBLEMS HERE
mp3.tag.save()
在执行倒数第二行后,我遇到了以下错误:-
Traceback (most recent call last):
File "<pyshell#62>", line 31, in <module>
mp3.tag.lyrics = lyrics
AttributeError: can't set attribute
我还想让您知道,我今年 15 岁,已经学习 Python 大约一年了。我到处搜索并尝试了所有方法,但我想我现在需要一些帮助。
在此先感谢您的帮助!
最佳答案
我不假装理解为什么会这样,但请查看 the handy example file 中的歌词是如何设置的:
from eyed3.id3 import Tag
t = Tag()
t.lyrics.set(u"""la la la""")
我认为这与将歌词放入框架有关,但其他人可能不得不对此进行更正。请注意,除非您将它传递给 unicode,否则这将失败。
关于python - 通过 eyeD3 更改 MP3 文件中的歌词,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18916127/
如果可能的话,我想使用外部PS眼动凸轮每秒节省30帧。 我不知道在哪里可以找到指南或代码本身,因为我很确定它应该在线。 任何帮助,将不胜感激。提前致谢! 最佳答案 因此,根据正在运行的OS,启动和运行
所以我终于让我的 php 数据库搜索正常运行,但我不知道如何格式化它以使其看起来更好。 目前我的回显码是 echo "".$results['lfname']."".$results['id'].$
Laugh eyes and lie face [ 会笑的眼和说谎的脸] My hand will only to lead me in the end will not separ
This question already has answers here: How does this one-hot vector conversion work? (2个答案) 3年前关闭。
我有一个 python 脚本,我想使用 Armadillo 用 C++ 重写。在 python 中我有一行 matrix = 1/(12*h)*(sparse.eye(num_points, k =
我的问题是,是否有人知道如何通过 openCV 使用 PS3 眼睛。 提前致谢。 最佳答案 只需安装适当的驱动程序(例如,here's Windows 版本)。之后 Ps3eye 将像普通网络摄像头一
问题是,给定任意一维向量y,将其扩展为具有n维度的d基向量。 展开的规则是:y中的每个元素是n*n单位矩阵中列的索引。 例如: y = [3, 0, 1] n = 4 由于n = 4,我们有4*4
这听起来像是一个愚蠢的问题,因为我尝试了一段时间来解决这个问题,但我不知道如何解决它。 我有两个名为 imagem.bmp 和 imagem2.bmp 的图像以及一个应该使用 gnome 之眼打开这两
我正在尝试在右侧添加一个眼睛图标。在我的原始代码中,它显示在右侧但没有响应,并且会在屏幕尺寸更改时移动。 下面是一个松散的实现。我希望它应该在输入字段在两个密码字段中结束之前显示在右侧。目前它显示但不
我很难把口音弄对,我相信大多数拉丁语都会遇到这种情况,就我而言,葡萄牙语 我有一个字符串作为参数,我必须得到第一个字母并将其大写!这在 ruby 中应该是微不足道的,但这里有一个问题: s1 =
我在一个文件夹中有 9025 个文件(从 img_00000.png 到 img_009024.png ),我不知道如何编写允许我从第一个文件开始打开一个图像查看器窗口并让我单击到的 python 代
我有一堆类似的曲线,例如 1000 个振幅、频率和相位略有不同的正弦波,它们看起来像下面这张图: 在上图中,每个正弦波的颜色来自标准的 pandas 颜色图;我想得到一个颜色与曲线“密度”相关的图。
我不明白这段代码出了什么问题 var sleepCheck = function(numHours) { if (sleepCheck >= 8) { return "You're
我已经用打开的 CV 设置了我的 ps3 眼睛,但是,当我调用函数 cvCaptureFromCAM(0) 时,它总是返回 null。我正在使用 these drivers对于我的 ps3 眼睛和 O
我问这个问题是我之前 question 的精简版.现在我有一张脸看着屏幕上的某个位置,还有双眼的注视坐标(俯仰和偏航)。让我们说 左眼 = [-0.06222888 -0.06577308] 右眼 =
在 SymPy 中,eye(5) 和 Identity(5) 有什么区别? 如果我有一个矩阵 X,我会看到 X + eye(5) 和 X + Identity(5) 给出不同的结果(后者不是矩阵)。
我正在做一个需要低分辨率和大约 110 fps 的项目。所以我买了 30 美元的 PlayStation eye,它在 240 分辨率下以 320 提供 120 fps。 我安装了以前版本的 maca
我看过 "Third Eye Crime" 的预告片. 如何实现蓝色视场锥体,使其形状根据障碍物发生变化? 我的尝试是转换光线直到出现障碍物,然后我用光线的终点绘制锥形。 我的方法的问题是圆锥体的精度
我正在使用 SceneKit。我创建了自己的相机并将其分配给场景,并且调整了它的 xFov 和 yFov。当我设置一个高于 50 的值时,开始出现一些失真。屏幕边缘附近的所有内容都被拉伸(stretc
int eye[3][3] = { { 1,0,0 }, { 0,1,0 }, { 0,0,1 } }; 有没有更短的初始化方法?它是如此规则,以至于必须有一种更智能的方法来初始化它,尤其
我是一名优秀的程序员,十分优秀!