michaelherger / lms-plugin-tidal

A TIDAL plugin to integrate with the Lyrion Music Server (fka. Logitech Media Server)
43 stars 8 forks source link

Tidal plugin 1.1.0 doesn't return all playlists #73

Closed bkmill closed 6 months ago

bkmill commented 6 months ago

Just installed the update and now i'm missing all my Tidal Playlists.

michaelherger commented 6 months ago

"your playlists": playlists you have created, or playlists you have added to your favorites?

bkmill commented 6 months ago

Playlists i have created in Tidal. They still showed in version 1.0.0 and are also still available in Tidal.

On 5 Apr 2024, at 17:56, Michael Herger @.***> wrote:

"your playlists": playlists you have created, or playlists you have added to your favorites?

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2040158629, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQDPRFJLT4VOHUAO7S3Y33CUNAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGE2TQNRSHE. You are receiving this because you authored the thread.

philippe44 commented 6 months ago

Was there anything special about these playlists? I changed something there but I checked and all my playlists appear

bkmill commented 6 months ago

Not really, most of them are containing some 300 songs. The playlists are still visible in the Tidal app on my computer and phone. With version 1.0.0 of the new Tidal Plugin everything worked fine.

On 5 Apr 2024, at 19:26, philippe44 @.***> wrote:

Was there anything special about these playlists? I changed something there but I checked and all my playlists appear

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2040301060, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQHQ5HXSZDLFECKP3QTY33NDZAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGMYDCMBWGA. You are receiving this because you authored the thread.

philippe44 commented 6 months ago

Are they public or private?

bkmill commented 6 months ago

Most of them are private, but i just changed a couple of them to public (using the desktop Tidal app) and that did not change the visibility in LMS. Restarting PCP and/or LMS did make a difference either.

On 5 Apr 2024, at 20:25, philippe44 @.***> wrote:

Are they public or private?

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2040391933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQAPW64VUSQDOXQWUJLY33UBPAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGM4TCOJTGM. You are receiving this because you authored the thread.

bkmill commented 6 months ago

I meant to say: did NOT make a difference. Sorry

On 5 Apr 2024, at 20:29, Ted Van der Wal @.***> wrote:

Most of them are private, but i just changed a couple of them to public (using the desktop Tidal app) and that did not change the visibility in LMS. Restarting PCP and/or LMS did make a difference either.

On 5 Apr 2024, at 20:25, philippe44 @.***> wrote:

Are they public or private?

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2040391933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQAPW64VUSQDOXQWUJLY33UBPAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGM4TCOJTGM. You are receiving this because you authored the thread.

philippe44 commented 6 months ago

I tried again with my playlist: 2 privates and an existing public one that I added to my favorites and they all appear under "Playlists"... Is there anything more you can tell about how you created your playlists?

philippe44 commented 6 months ago

Can you erase your LMS cache to be sure? (stop LMS and delete /var/lib/squeezeboxserver/cache/cache.db) and than that, a log with TIDAL set to info would be helpful.

michaelherger commented 6 months ago

That's pretty much the issue I've tried to address in the past. I don't remember whether there was a well defined rule as to which playlists would show up and which one wouldn't... I fear it's time to re-introduce that not so elegant code...

philippe44 commented 6 months ago

I would still like to go to the bottom of this as there has to be a logical reason and I know there is another api call as well.

philippe44 commented 6 months ago

Just to elaborate, there is an API playlistsAndFavoritePlaylists but AFAIK, any playlist that I have created is always automatically in Favorites and I've not see an option for it not to be. To the OP, have you done something special for that? I'm wondering if this is not an obsolete feature.

Also, what bothers me if that if we need to use userPlaylist query, then we do not detect changes in there. Maybe the TTL is short enough so that we don't really care...

bkmill commented 6 months ago

Just deleted /mnt/mmcblk0p2/tce/slimserver/Cache/cache.db That did not resolve the issue.

On 5 Apr 2024, at 21:22, philippe44 @.***> wrote:

Can you erase your LMS cache to be sure? (stop LMS and delete /var/lib/squeezeboxserver/cache/cache.db)

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2040494547, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQELZL2JQVR767WIJWDY332WLAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBQGQ4TINJUG4. You are receiving this because you authored the thread.

philippe44 commented 6 months ago

And if you create a fresh playlist, does it appear? Are you aware of any settings your would have change wrt blocking your playlists to be in favorites?

bkmill commented 6 months ago

I created a new public playlist in the Tidal app. It does NOT show up in LMS.

On 6 Apr 2024, at 10:51, philippe44 @.***> wrote:

And if you create a fresh playlist, does it appear? Are you aware of any settings your would have change wrt blocking your playlists to be in favorites?

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2041021110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQHKXZX4DK2YS6XTRP3Y36ZSRAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGAZDCMJRGA. You are receiving this because you authored the thread.

bkmill commented 6 months ago

Yes i have. Some of my playlist are created using the Tidal API and when i create the playlist i don’t add them to the Favorites because what’s the point of having a playlist and adding them to favorites.

But creating a new playlist in the Tidal app does not show up in LMS either.

On 6 Apr 2024, at 10:51, philippe44 @.***> wrote:

And if you create a fresh playlist, does it appear? Are you aware of any settings your would have change wrt blocking your playlists to be in favorites?

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2041021110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQHKXZX4DK2YS6XTRP3Y36ZSRAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGAZDCMJRGA. You are receiving this because you authored the thread.

bkmill commented 6 months ago

I just did a small test. I created a playlist using the Tidal API and also added it to my Tidal Favorites. The newly created playlist is now visible in LMS.

On 6 Apr 2024, at 10:51, philippe44 @.***> wrote:

And if you create a fresh playlist, does it appear? Are you aware of any settings your would have change wrt blocking your playlists to be in favorites?

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2041021110, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQHKXZX4DK2YS6XTRP3Y36ZSRAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGAZDCMJRGA. You are receiving this because you authored the thread.

philippe44 commented 6 months ago

Ok, this is really insane - I've created a playlist 20 times using the tidal and it always appeared in favorites immediately. Anyway, I will use the other api but I'll have also to think about changes detection

philippe44 commented 6 months ago

Can you share the code you used to create the playlist or at least the exact api calls?

bkmill commented 6 months ago

Yes, of course.

This is the Python code i changed this afternoon to add the playlist:

def createTidalPlaylist(session, playlistName, playlistDescription="", verbose=False):

user = Session.get_user(session, session.user.id)
playlistDescription = util_helper.printCurrentDateTime("Created by BarkingMill on", "%d-%m-%Y", False)

playlist = tidalapi.user.LoggedInUser(session, user.id).create_playlist(playlistName, playlistDescription)

# TW: 6-4-2024 Uncommented this line
# TW: No real need to add the playlist to favorites
# Don't forget to add the newly created playlist to your favorites
tidalapi.Favorites(session, user.id).add_playlist(playlist.id)

if playlist is not None:
    if verbose:
        print(f"{util_helper.bcolors.OKGREEN}Playlist {playlist.name}: {util_helper.bcolors.FAIL}{playlist.id}{util_helper.bcolors.OKGREEN} created.{util_helper.bcolors.ENDC}")

    return playlist

else:
    return None

On 6 Apr 2024, at 19:30, philippe44 @.***> wrote:

Can you share the code you used to create the playlist or at least the exact api calls?

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2041145533, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQHRQD3Q56LBDVYZBQDY4AWLXAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGE2DKNJTGM. You are receiving this because you authored the thread.

philippe44 commented 6 months ago

What python frontend lib do you use? tamland/python-tifal?

bkmill commented 6 months ago

https://tidalapi.netlify.app

On 6 Apr 2024, at 22:40, philippe44 @.***> wrote:

What python frontend lib do you use? tamland/python-tifal?

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2041200498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQCNOJ6TDHS3HVDTX5TY4BMU3AVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGIYDANBZHA. You are receiving this because you authored the thread.

chaseadam commented 6 months ago

It is conceivable that the "normal" UIs automatically add your playlist to your "favorites" and when you use the API it doesn't automatically add to favorites and/or it won't show up in your favorites API call. I was recently playing with the python tidalapi and found user.playlists(), but noted a few playlists missing and then found user.favorites.playlists() and it contained all of the playlists I wanted.

philippe44 commented 6 months ago

Yes, likely this is the case. I'll change that to reorganize a bit the current version as there is a dedicated api call to get everything.

philippe44 commented 6 months ago

I'm about to push and updated version, but what is interesting to see is that, at least on my setup, such playlists that are user-defined but removed from favorites through API disappear from the TIDAL app. They now remain on LMS and I assume on other apps using the API, but are gone on TIDAL. AFAIR, the TIDAL webapp uses a v2 version of the API for playlist, I traced that recently. So, it might be that, as in Deezer, when v2 is deployed, user playlist must be in favorites.

philippe44 commented 6 months ago

I created a new public playlist in the Tidal app. It does NOT show up in LMS.

And that never been my experience. Every time I create a playlist in TIDAL, with v1.1 on this plugin, it always appeared in LMS. And I've done that many times.

michaelherger commented 6 months ago

Thanks for looking into this, @philippe44!

bkmill commented 6 months ago

Thanks very much. Just installed the update and voila, all the playlists are back.

On 7 Apr 2024, at 07:03, Michael Herger @.***> wrote:

Thanks for looking into this, @philippe44 https://github.com/philippe44!

— Reply to this email directly, view it on GitHub https://github.com/michaelherger/lms-plugin-tidal/issues/73#issuecomment-2041312127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2WWQCNGC63DLTK4RTBELTY4DHRPAVCNFSM6AAAAABFZMCKYSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGMYTEMJSG4. You are receiving this because you authored the thread.

philippe44 commented 6 months ago

Cool - it's just so weird why, using their official app, I can'reproduce the issue and have a user playlist that is NOT in favorite / collection.

bkmill commented 6 months ago

I'm sorry, i think i was a bit premature. Although my "old" Tidal playlists are now visible in LMS, newly created playlists, created by code but also created with the Tidal Desktop app, are NOT visible in LMS. The "new" playlists however are visible in both the Tidal desktop and mobile app. I'm not sure what's wrong.

philippe44 commented 6 months ago

What country are you in? That does not make sense, I've tried times and times and times. So, you create a playlist "mine" in the desktop app, add tracks to it and it does NOT appear in LMS ???

bkmill commented 6 months ago

Netherlands

bkmill commented 6 months ago

Yep, i created a playlist, added titles to it in the Tidal desktop app. The playlist is visible in the Tidal app but not in LMS.

philippe44 commented 6 months ago

@michaelherger : can you try on your side as well? This will drive me insane. I just tried again creating one in the desktop app (Windows) and the playlist was immediately visible in LMS. I did nothing special.

philippe44 commented 6 months ago

@bkmill : how many playlists do you have?

bkmill commented 6 months ago

About 60. If needed for testing i can delete them because most of them are generated.

philippe44 commented 6 months ago

https://github.com/michaelherger/lms-plugin-tidal/assets/9712599/99a33a43-b27e-449a-bd15-c3f7e14064b0 😠 😠 😠 I'm about to revert everything to 1.0 and take a hike

bkmill commented 6 months ago

My scenario is the same, the only difference is the playlist not showing up in LMS :-(

philippe44 commented 6 months ago

I found the issue. It's a paging problem. You have 60 playlist and paging is 50. When I set paging to 2, I only see 2 playlists...

bkmill commented 6 months ago

Yep... you're right. I deleted most of my playlists and de newly created ones showed up. Pfieuuuwwww.

philippe44 commented 6 months ago

Now I need to talk to @michaelherger / spend more time because I was reading the paging mechanism and now I'm totally confused.

bkmill commented 6 months ago

Take your time, i'm not in a hurry. Thank you for your effort.

michaelherger commented 6 months ago

I think I've found something: I passed $acb as the callback for the _call method, which would return the result and the response object as the second argument. But $acb would consider a second argument an error. Thus would cut short and return only the first page of results, assuming the others failed.

By explicitly calling $acb->(shift) we only pass the result set. Which allows achain to evaluate all result sets of all the calls.

philippe44 commented 6 months ago

Yes, my slow brain was getting there as well. Don't you think as well that _nocache => 1 should be set to every amap action?

michaelherger commented 6 months ago

https://github.com/michaelherger/lms-plugin-tidal/commit/16d31a33d2df00570f61c5bb60ffa32dd84f3352

philippe44 commented 6 months ago

I've checked and we must not cache the sub-page calls or at least we should follow what the initial request wrt cache was. I think it's not useful to cache these interim results knowing that we want to cache the final result, but more important, if we cache them (say we cache 0..49,50..99 and 100..120) then next time we have a request for the whole lot asking us to not cache or to refresh, then the first 0..49 will be refreshed/not use cache but the others will be taken from the previous cached data, which is wrong. Hence I think the best is to simply not cache sub-pages queries, rather than passing through _nocache/refresh.