Skip to content
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

Add last.fm backend importer - interim check in #2991

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

amCap1712
Copy link
Member

No description provided.

@pep8speaks
Copy link

pep8speaks commented Oct 2, 2024

Hello @amCap1712! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 12:131: E501 line too long (138 > 130 characters)

Line 76:5: E303 too many blank lines (2)
Line 100:5: E303 too many blank lines (2)

Comment last updated at 2024-10-25 14:58:35 UTC

@amCap1712
Copy link
Member Author

amCap1712 commented Oct 24, 2024

@MonkeyDo need your help to add a way for users to link their last.fm account with ListenBrainz. The last.fm username is required and the time they want to start their import from is optional. The data should be posted in a JSON body like {"external_user_id": "amCap1712", "latest_listened_at": "2024-10-24T10:10:53.519338"} to https://(beta.|test.)listenbrainz.org/settings/music-services/lastfm/connect/

Comment on lines +250 to +253
try:
latest_listened_at = datetime.fromisoformat(data["latest_listened_at"])
except (ValueError, TypeError):
raise APIBadRequest(f"Value of latest_listened_at '{data['latest_listened_at']} is invalid.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making latest_listened_at optional

Suggested change
try:
latest_listened_at = datetime.fromisoformat(data["latest_listened_at"])
except (ValueError, TypeError):
raise APIBadRequest(f"Value of latest_listened_at '{data['latest_listened_at']} is invalid.")
latest_listened_at = None
if data["latest_listened_at"] is not None:
try:
latest_listened_at = datetime.fromisoformat(data["latest_listened_at"])
except (ValueError, TypeError):
raise APIBadRequest(f"Value of latest_listened_at '{data['latest_listened_at']} is invalid.")

@MonkeyDo
Copy link
Contributor

Let me know if that does the trick

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants