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

Merged
merged 12 commits into from
Oct 30, 2024
Merged

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-30 01:16:59 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/

@MonkeyDo
Copy link
Member

Let me know if that does the trick

image

@amCap1712
Copy link
Member Author

@MonkeyDo looks great, thanks!

@amCap1712 amCap1712 marked this pull request as ready for review October 28, 2024 18:02
@@ -242,6 +233,36 @@ def refresh_service_token(service_name: str):
return jsonify({"access_token": user["access_token"]})


@settings_bp.route('/music-services/<service_name>/connect/', methods=['POST'])
Copy link
Member

Choose a reason for hiding this comment

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

I just wanted to mention here that this new /connect endpoint is a departure from our existing mechanism, where we call the /disconnect endpoint with an action set in the request body.

IMHO it makes more sense to have separate connect/disconnect endpoints, it would make sense to refactor other services to use /connect (with an action) to connect to services, and /disconnect (with no action) to disconnect.
Will need a couple of small changes in the front-end so we would need to coordinate a bit.

Copy link
Member Author

Choose a reason for hiding this comment

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

The last.fm connections differ from other services because of the absence of the oauth workflow or options on how the connection should work. We can look into separating the disconnect endpoint into two but will need to figure out and ensure that you can switch the permissions granted to a service in one click on LB.

@amCap1712 amCap1712 merged commit 7aa61ee into master Oct 30, 2024
3 checks passed
@amCap1712 amCap1712 deleted the lfm-importer branch October 30, 2024 01:24
MonkeyDo added a commit that referenced this pull request Oct 30, 2024
After #2991 , Last.FM imports are managed in the back-end, making this front-end manual import a duplicated we want to get rid of.

Keep the mechanism as we still use it for Libre.FM imports, and rename the components accrodingly, making them work by default and primarily for LibreFM.
Once we have converted LibreFM import as well we can get rid of the front-end importer components
MonkeyDo added a commit that referenced this pull request Nov 7, 2024
The corresponding endpoint was removed in #2991, removing the UI for it
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