我需要帮助使用library.add_相册pylast(pylast)的特性姓氏.fmapi包装)

2024-05-23 21:42:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图访问pylast的库类,但一定是做错了什么。我可以让大多数其他功能正常工作。下面是一个代码示例,它只是采用了标准的工作示例,并添加了我认为是向我的姓氏.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的库类,但一定是做错了什么。我可以让大多数其他功能正常工作。下面是一个代码示例,它只是采用了标准的工作示例,并添加了我认为是向我的姓氏.fm图书馆:

^{pr2}$

我是python新手,如果这很明显,我很抱歉,我已经被困了好几天了,决定问一下。在


Tags: tokeyapi示例getsecretartistusername
2条回答

是皮拉斯特的一只虫子。在

1957号线(干线)应为:

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

而不是:

^{pr2}$

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

answer by miles82显示了这个bug,它是reported to pylast。在

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

相关问题 更多 >