-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't Love track using example code #407
Comments
It's failing to authenticate before even calling network = pylast.LastFMNetwork(
api_key=API_KEY,
api_secret=API_SECRET,
username=username,
password_hash=password_hash,
) I can reproduce. Maybe Last.fm have removed that authentication method? Instead of that line, can you try this lot instead? SESSION_KEY_FILE = os.path.join(os.path.expanduser("~"), ".session_key")
network = pylast.LastFMNetwork(API_KEY, API_SECRET)
if not os.path.exists(SESSION_KEY_FILE):
skg = pylast.SessionKeyGenerator(network)
url = skg.get_web_auth_url()
print(f"Please authorize this script to access your account: {url}\n")
import time
import webbrowser
webbrowser.open(url)
while True:
try:
session_key = skg.get_web_auth_session_key(url)
with open(SESSION_KEY_FILE, "w") as f:
f.write(session_key)
break
except pylast.WSError:
time.sleep(1)
else:
session_key = open(SESSION_KEY_FILE).read()
network.session_key = session_key Remember to call the # Now you can use that object everywhere
track = network.get_track("Iron Maiden", "The Nomad")
track.love()
track.add_tags(("awesome", "favorite")) |
Thanks. That worked. Now off to love my scrobbles. Scrobble scrobble. Just wish LastFM would try to keep some consistency in their API longer term. |
Good to hear! Maybe related to #357. Let's update the |
Not a programmer, so shooting in the dark, blind as hell. artist = os.popen("/usr/bin/mpc -f %albumartist%").read()
artist = artist.split('\n')[0]
title = os.popen("/usr/bin/mpc -f %title%").read()
title = title.split('\n')[0]
# Now you can use that object everywhere
track = network.get_track(artist, title) |
What did you do?
Tried using the example from the readme, to love a trrack.
What did you expect to happen?
Love specified track
What actually happened?
Some sort of authentication error.
What versions are you using?
Please include code that reproduces the issue.
Code in the Github readme
The text was updated successfully, but these errors were encountered: