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

Automatically add songOrder to playlists #118

Closed

Conversation

daladim
Copy link
Contributor

@daladim daladim commented Feb 27, 2023

This fixes #117

When adding songs to a playlist, let's automatically assign it a sortOrder so that it appears at the end of the playlist.

This does not prevent to re-order songs after they have been added.

@daladim
Copy link
Contributor Author

daladim commented Feb 27, 2023

I was not sure how to implement PlaylistSongJoinDao.appendSongs() using a simple, single SQLite query. Since it was used at two places, I used a simple iteration on all songs instead.

We could probably find some magic SQLite query that does this for us, and which would be more performant than iterating ourselves, but I don't think users will often add millions of songs to a playlist, so maybe this is fine this way.

@timusus
Copy link
Owner

timusus commented Mar 10, 2023

Hey @daladim, would you mind reviewing #119

It should solve the problem in a similar fashion, but without the need for the SQL query.

I slightly prefer that approach, as it doesn't require us to query the database song count for every song insert. It's possibly slightly more efficient.

@timusus timusus closed this Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Songs added to playlists appear at random places
2 participants