gmusicapi
gmusicapi copied to clipboard
support reordering multiple playlist entries at once
As detailed in #179, Google's backend doesn't appear to support moving a number of tracks when the individual mutations refer to eachother.
I'd really like to find a way to do this without making n requests to move n entries to enable an efficient reorder_playlist(pl_seq) interface.
The webclient actually supports this with one request, so maybe the mobileclient does too, now? See https://github.com/simon-weber/Autoplaylists-for-Google-Music/blob/a15d01ce65149d1173989db05b44db61c48ad2e7/src/js/googlemusic.js#L356.
So I know from autoplaylists that the mobileclient does support this now (see https://github.com/simon-weber/Autoplaylists-for-Google-Music/blob/dcfba5cac56f13b6c7571a5c7905821062326bed/src/js/syncing.js#L432 and https://github.com/simon-weber/Autoplaylists-for-Google-Music/blob/407cf37be8db164dd7aec2b51fc2fa965eb5d8c5/src/js/googlemusic_oauth.js#L222).
It can be batched into a single request of varying efficiency (in terms of number of mutations), depending on how the changes are declared:
- 2n: n deletes + n adds
- n: n reorders
- n-2sqrt(n): calculate the longest increasing subsequence then move all other entries
However, even the most efficient approach has caused performance issues on Google's end in autoplaylists, so I'm wary to implement it here.