-
Notifications
You must be signed in to change notification settings - Fork 251
Adding a user view #646
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
base: main
Are you sure you want to change the base?
Adding a user view #646
Conversation
This makes the height of the description consistent with the artist image (in most cases). It also removes the redundant strings on the stats number and hides any stats if they are non-existent. --------- Co-authored-by: Samuel Oldham <so9010>
Copied some of artist into user, changing some. This is not how to do it I feel.
|
Wooho! With new visual sections and UI it's great if you add a small screenshot/cap of the UI or screen state so we can better review. |
|
Ok yeah, so would adding a new page actually work 😆 |
* Fix lyrics call by setting base uri in the builder, drop auth token
|
NOTE: Copy-pasted thing and made it compile |
|
No rush, but when you get a chance, posting a screenshot of an example profile in the UI would be great! |
|
Still warnings and nothing to show for it. |
|
Just to let you know you can use 'cargo clippy --fix --allow-dirty' to remove many of the warnings which you are encountering it is best if you run it regularly. If you use vscode you can set it to format on save which is honestly a god send imo! Also if you feel as though you want any help do let me know and you can let me know what you are doing and trying to achieve. I had a small look through your code so far and I thought to provide some feedback, i think you are trying to do too much at once as you have copy pasted the code from the album view and i assume you are trying to then change bits till it works, which will work but may get confusing and frustrating. What my advice would be is to start small. Just start with displaying the users name and images as that is already part of public users, from this you can then understand better how druid handles new pages. Now that #631 has been merged, rebase your fork with that and then it will make approaching this a lot easier. You can make it so that this is clickable and that is what opens the page for now. What I would also like to note is that you make want to also have a look at adding to the api here. To get user profiles you will need to perform a call to: which returns roughly this : To follow and unfollow it requres a different api call a POST call to https://api-partner.spotify.com/pathfinder/v2/query with the JSON roughly set as:
But just focus on the requesting user-profile-view for now. If you need any help with that just let me know. Please feel free to disregard this advice if you dont want/need it but when I started contributing I did the same thing and got very burnt out. |
|
The API on the Spotify site is only really meant for the current user, not for public users in general (do correct me if I'm wrong though!). The API that Spotify actually uses - like in their Web Player - seems to have access to public playlists and a lot more. Right now, we're using a mix of both: the official APIs they provide and the ones used by their Web Player. For this feature specifically, I think we'll need to use the latter - the one that isn't directly provided. But yeah, like I said before, I'm more than happy to help with it :) As for the image issue - I think it's to do with how the struct is being deserialized hence the JSON error message. You may also need to use Option in case there are no images. I can't properly check the code at the moment, but if you're just calling Vec: : new() you're not actually putting any data in, right? I'll have a better look at it soon though. |
|
Hey! I had a quick look at your get_publicuser_info function - it looks like you might are calling the endpoint for artists, which isn't quite the one we need here. Did you get a chance to use the info I sent about the correct endpoint to call? Unless I'm misunderstanding something, it seems like it's just the wrong type of request. Let me know if I've got that wrong though! :) |
You didn't get it wrong, and I've now probably "fixed" at least that? |
|
I ran your fork and I'm a bit confused about the changes? Could you explain the changes and perhaps why playlist details aren't shown properly and what you have changed to the left hand panel? They generally for this don't need to be touched apart from making the user name clickable. It may help me understand what you have done if you talk me through it? Also could you commit the changes all in one go with a roughly detailed name as its so much harder to read the changes of each commit. Also please do use clippy to format the code regularly so it makes it easier to read :) Edit: I'm a bit confused about why the playlist info isn't loading on your fork your change should be ok? |
|
Implementing the |
|
Yeah, you just need the option keyword or https://serde.rs/attr-skip-serializing.html#:~:text=Please%20use%20the%20skip%20attribute,skip_deserializing%20to%20skip%20deserializing%20only. |
|
Or not |
|
Oh you added skip serialising you need skip deserialising :) or just use skip :) to skip both |
|
https://serde.rs/field-attrs.html#skip #[serde(skip_serializing_if = "path")] |
|
But then you have to populate the images struct using a different API, (perhaps the one mentioned before) |
|
So the API things, how do they work? |
|
What do you mean? |
|
Sorry what I meant was how do you call the api, model the json and plug in all the values correctly, cause my thing/code doesn't work. Thanks for your help!
|
|
Heya I think I'll have time in the evening to work out the API, it's a bit trickier than the normal ones as I need to sit there and watch Spotify make it's requests on the web app version. I think whas going wrong with yours is that your using the id which is an encoded id, but for the call you want to make you need to have the original username or the end bit of something like this spotify:user:michaeljesse. To find that I'm not sure yet but I'll give it a go this evening. |
|
Ok so I've had a look through and did a few small changes, the api now works correctly, and all you need to do (still not an easy feat but you should be able to do it as you got it to work 90% with userProfile)! So you are very close now! Great job! If you need my help again just let me know! I added PublicUserDetail which now contains. pub uri: String,
pub name: String,
pub image_url: String,
pub followers_count: i64,
pub following_count: i64,
pub is_following: bool,
pub recently_played_artists: Vec<RecentlyPlayedArtist>,
pub public_playlists: Vec<PublicPlaylist>,
pub total_public_playlists_count: i64,
pub allow_follows: bool,
pub show_follows: bool,Which will make it far easier now ;) |
|
Okay, will have to try next next week.
|
|
Will have to step away, good luck. |

Ehm, so I tried something.
This is not how to do it, I feel.
Context: Trying to add a user view.
Will fix: #616