BimmerGestalt / AAIdrive

Implementations of some Android Auto features as unofficial IDrive apps
MIT License
541 stars 90 forks source link

Spotify can't jump to track on favorite songs playlist #352

Closed TimonBerlin closed 2 years ago

TimonBerlin commented 3 years ago

Hey Guys Very create app! But I can't change the track when I am in the favorite songs playlist. It works fine with any others like albums or artists but I do not work with favorite songs. It always restarts the first track. Any ideas ? :)

hufman commented 3 years ago

Alas this is a known bug, and we're unsure of the best way to resolve it. This Liked Songs playlist is somehow special and the normal skipToIndex command picks the first song (or a random song is shuffle is enabled). We've tried experimenting with sending multiple single skip commands with poor reliability, and have one experimental branch for cloning the Liked Songs playlist to a normal playlist. There isn't a firm timeline to committing a fix, I sincerely apologize!

hufman commented 3 years ago

This should be fixed with the recent merge of #263, can you test the nightly build and confirm?

TimonBerlin commented 3 years ago

This should be fixed with the recent merge of #263, can you test the nightly build and confirm?

Hey Thanks for the Update ! I cant install this APK. My Phone just said : "App wasn't installed".

hufman commented 3 years ago

Do you have a 1.3rc version installed? I misunderstood the Android naming scheme when I released these Release Candidates, and the phone considers the 1.3 release to be a later version than the 1.3rc versions, and so you'll have to uninstall the previous version and install the new one. Someone just encountered this in #375.

TimonBerlin commented 3 years ago

Do you have a 1.3rc version installed? I misunderstood the Android naming scheme when I released these Release Candidates, and the phone considers the 1.3 release to be a later version than the 1.3rc versions, and so you'll have to uninstall the previous version and install the new one. Someone just encountered this in #375.

Okay now i can install it but the Error is still there. Can't select a song in my favorites. :(

hufman commented 3 years ago

What error do you see? Can you check in your Spotify library (in the real Spotify app) to see if a new playlist has shown up named AAI_LIKED_SONGS? AAIdrive should mirror your main Liked Songs playlist to this to enable skipping.

TimonBerlin commented 3 years ago

What error do you see? Can you check in your Spotify library (in the real Spotify app) to see if a new playlist has shown up named AAI_LIKED_SONGS? AAIdrive should mirror your main Liked Songs playlist to this to enable skipping.

There is no error message and i cant see the AAI_LIKED_SONGS Playlist in my spotify. But what i just notice is that the app is always crashing when i try to authorize the Web API. Is there some Error Log in Android which i can access ? :D

hufman commented 3 years ago

Ah yes, there were unfortunately some bugs around this new feature, which should be resolved just this morning: Originally there was a crash on Nougat phones, and the first fix for that caused the Web API to crash on all the other phones. This major bug should be fixed yesterday in a3b7a18, and I just now fixed up the Nougat bug with 4324247. Check the version that you have installed, which I'm guessing is older than these fixes, and download the current latest build again. I sincerely appreciate your patience in testing!

TimonBerlin commented 3 years ago

You mean 1.3 ? Or where I can find the last Release? I am happy when I can help :)

hufman commented 3 years ago

Indeed, I had guessed that you downloaded the nightly build that first added the new functionality, but which included a few bugs, and pointed out the specific versions where the bugs were fixed to compare your current version number to.

I believe the crashes in this new feature have been fixed, download the latest nightly build and try it out!

TimonBerlin commented 3 years ago

Okay now I have installed the nightly build. And when I select a song now it playes an random song instead. But I now have the new AAI_LIKED_SONGS playlist. 😅

hufman commented 3 years ago

Excellent! So that step worked. Does Spotify say it is Playing from Liked Songs, or Playing from AAI_LIKED_SONGS? It should be the case that selecting a song from Now Playing will switch to playing that song from the AAI_LIKED_SONGS playlist. One known issue is that the actual song played might be a few entries down the list from the one you picked, if some of the songs in the playlist are unavailable for some reason (#291), perhaps this is the random song you experienced?.

TimonBerlin commented 3 years ago

Sorry for let you waiting ! Here is my update: I habe two of the new playlist and both have one song less then my favorite songs list. And the songs that are played are very old like from the bottom of my favorite song list. I have 1100 songs and when I select a song from the top 5 it plays an old song like Form the first 100 or so. I also noticed thet when I manuell select the new playlist and switch song the whole things crashes. Greetings!

hufman commented 3 years ago

Very interesting! I haven't seen any crashes come through the analytics, can you tell me more about the crash? The behavior about picking the wrong song is curious, not just a small offset but a completely different section of the playlist? Very curious! Once it switches Spotify into playing from AAI_LIKED_SONGS it should behave exactly like any other playlist and play with the correct index. @Ben2356 do you have any ideas? Is there something in the pagination and index logic that could be confused, perhaps in the transition from Liked Songs to AAI_LIKED_SONGS?

Ben2356 commented 2 years ago

Hmm upon further investigation of this over the last few days my AAI_LIKED_SONGS playlist did somehow manage to get out of sync and the hashcode stored on the TemporaryPlaylistState was the new updated hashcode (with some newly added songs) but the AAI_LIKED_SONGS playlist was not updated appropriately. Since the queueItems is being used from the Web API's call to the getLikedSongs endpoint it is displaying the properly updated queue. As a result when trying to play at index for a certain song I was noticing the offset bug coming up which depending on how out of date the AAI_LIKED_SONGS playlist is the offset is directly affected (missing one song then offset of 1, missing 2 then offset of 2, etc). But since there is only a one song difference I'm still trying to piece together how offset could be so massive there.

I have an idea that it could be a race condition scenario since I've noticed the doubly created AAI_LIKED_SONGS sometimes pops up in my Spotify playlists when creating those for the first time and when the Liked Songs library is the one that is loaded in context since it appears as though the Spotify probing service is being called as well as initializing the current queue, both of which call into the SpotifyAppController initialization logic which constructs the temporary playlist is if it is not already present so maybe this has something to do with this situation.

Either way there is definitely a problem and I'm working on understanding it and getting some fixes out for this. I'm not sure why these scenarios are just now showing up 😞

TimonBerlin commented 2 years ago

@Ben2356 if i can test anything for you let me know !

Ben2356 commented 2 years ago

@TimonBerlin Thank you, the fixes I was working on to address this issue as well as some other issues that users are reporting have been pushed to the main branch. If you could please test these fixes with a clean installation (deleting the AAIDRIVE_LIKED_SONGS playlist from Spotify and wiping your app cache and data before starting the updated app) I would greatly appreciate it!

SBRK commented 2 years ago

I don't know if this is related, but when playing a playlist with shuffle on, the list I get in the "now playing" screen and on the dashboard when scrolling the wheel are not shuffled. If I select one it will play another song, at random

hufman commented 2 years ago

@SBRK does it also jump to the first track when shuffle is off? This may be related, some of the automatic playlists exhibit this same behavior. What playlist(s) are you seeing this behavior on? I believe we should have the fix in for Artists playlists, so please share what other playlists you are seeing this on.

SBRK commented 2 years ago

@hufman I have this behavior with any playlist, not just the liked songs.

does it also jump to the first track when shuffle is off?

You mean if I disable shuffle, then it jumps to the first track of the playlist ? I don't know, I will have to try it out. Can I try directly from the Android app interface, will it have the same behavior ? (because I don't use my car everyday, it's not in the same building, and I don't have any internet service in the parking where it's parked)

hufman commented 2 years ago

Yes, the little music app interface within the AAIdrive phone ui will behave the same, it is meant as a test interface for this reason :)

hufman commented 2 years ago

I believe the original Liked Songs bug has been fixed, thanks to @Ben2356, so I'm closing this issue.