1

我正在尝试访问 pylast 的库类,但一定是做错了什么。我可以让大多数其他功能正常工作。以下是一个代码示例,它仅采用标准工作示例,并添加了我认为将专辑添加到我的 last.fm 库的正确方法:

import pylast

# You have to have your own unique two values for API_KEY and API_SECRET
# Obtain yours from http://www.last.fm/api/account for Last.fm
API_KEY = "80a1c765efb52869575821c03d93a30e" # this is a sample key
API_SECRET = "2ba567f5b0d74c6cc6a8d07ef2cbc2d"

# In order to perform a write operation you need to authenticate yourself
username = "astroid0"
password_hash = pylast.md5("xxx")

network = pylast.LastFMNetwork(api_key = API_KEY, api_secret = 
    API_SECRET, username = username, password_hash = password_hash)

# now you can use that object every where
artist = network.get_artist("System of a Down")
artist.shout("<3")


track = network.get_track("Iron Maiden", "The Nomad")
track.love()
track.add_tags(("awesome", "favorite"))

## This is the area causing trouble
library1 = pylast.Library(user = "astroid0", network = "LastFM")
album1 = network.get_album("The Rolling Stones", "Sticky Fingers")
library1.add_album(album1)

ss pylast 的库类,但一定是做错了什么。我可以让大多数其他功能正常工作。以下是一个代码示例,它仅采用标准工作示例,并添加了我认为将专辑添加到我的 last.fm 库的正确方法:

 library1 = pylast.Library(user = "astroid0", network = "LastFM")
 album1 = network.get_album("The Rolling Stones", "Sticky Fingers")
 library1.add_album(album1)

我是python的新手,所以如果这很明显,我很抱歉,我刚刚被困了好几天,决定问一下。

4

2 回答 2

1

这是 pylast 中的一个错误。

第 1957 行(来自主干)应该是:

params["artist"] = album.get_artist().get_name()

代替:

params["artist"] = album.get_artist.get_name()

您可以在此处向作者报告问题。

于 2011-04-04T18:08:02.583 回答
0

miles82的答案显示了该错误,并且已将其报告给 pylast

不幸的是,这几年没有更新,所以我在我的 pylast 分支中修复了这个问题。

于 2014-03-05T09:56:33.617 回答