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

Spotify updates #5

Merged
merged 11 commits into from
Jun 14, 2022
Merged

Spotify updates #5

merged 11 commits into from
Jun 14, 2022

Conversation

Zibbp
Copy link
Owner

@Zibbp Zibbp commented Jun 13, 2022

This PR includes a non-backwards compatible update with how the application authenticates with Spotify.

Feature request found in #2.

Changes

  • Spotify OAuth login.
  • By default, playlists to convert are now retrieved from the user's own playlists or liked playlists.

Notes

Before this PR, Spotify API access was accomplished using an application id and secret allowing an "anonymous" login. Now logging into Spotify requires an authorization flow granting access to tidal-utils. This allows the application to read what playlists you own or have liked.

The new login method allows tidal-utils to convert any playlist you own or have liked automatically without the need to manually enter playlist IDs. For users who prefer to manually enter playlist IDs, it will still be possible by setting a config option.

@Zibbp Zibbp added the enhancement New feature or request label Jun 13, 2022
internal/spotify/auth.go Outdated Show resolved Hide resolved
@Leptopoda
Copy link

Leptopoda commented Jun 14, 2022

The docker compose file should also expose the redirect port

    ports:
      - 28542:28542

I'm currently able to log in to spotify but have problems loading the playlists:

Attaching to tidal-utils
tidal-utils  | time="2022-06-14T07:53:53Z" level=info msg="Tidal access token is valid."
tidal-utils  | time="2022-06-14T07:53:53Z" level=info msg="User mode enabled."
tidal-utils  | time="2022-06-14T07:53:53Z" level=debug msg="Getting playlists for Tidal user :upside_down_face:"
tidal-utils  | time="2022-06-14T07:53:53Z" level=debug msg="Getting https://listen.tidal.com/v1/users/:upside_down_face:/playlists"
tidal-utils exited with code 0

Gonna try to debug it now

EDIT:
Seems like it only takes into account public playlists displayed on my profile. As I don't publicly advertise my playlists on my profile
usrPlaylists is empty and no playlist is downloaded.
As soon as I add a playlist to the profile it starts downloading them.

Also the oauth access requested by the app does only ask for public playlists so the auth token doesn't have the scope to access private playlists.

EDIT2:

https://github.com/zmb3/spotify/blob/c886435b98ac304491c4e993ecd95988b0a86415/playlist.go#L124-L132

reading a bit in the library code it indeed seems to be some scope related issue.

@Zibbp
Copy link
Owner Author

Zibbp commented Jun 14, 2022

I'll take a look at the scopes and see what I can find for private playlists.

@Zibbp
Copy link
Owner Author

Zibbp commented Jun 14, 2022

I've added the ScopePlaylistReadPrivate scope which should allow the playlists to be read now. My private playlists were able to be read before without this scope, so you must have something enabled locking them down even more.

@Leptopoda
Copy link

regarding the api scpoe it is working now.
#1 is also fixed (closing)

But now the program hangs before showing the tidal login url (when starting fresh withouth a tidal login token)

@Zibbp
Copy link
Owner Author

Zibbp commented Jun 14, 2022

It was working in VS Code's terminal but couldn't get the link either in a different shell. I just pushed a commit that uses the logging package to show the oauth URLs.

@Leptopoda
Copy link

works great now.
Thanks for taking the time to debug/implement this :)

@Zibbp
Copy link
Owner Author

Zibbp commented Jun 14, 2022

Thanks for testing my changes! I'll merge this and put out a new release soon.

@Zibbp Zibbp merged commit 9a03c42 into master Jun 14, 2022
@Zibbp Zibbp deleted the Spotify-Updates branch June 14, 2022 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants