Festify / app

:tada: Festify Host & Client
https://festify.rocks/
413 stars 73 forks source link

Shuffle/Reorder Songs #270

Open Colter-Hammer opened 5 years ago

Colter-Hammer commented 5 years ago

People seem to add songs in huge lists by artist, so I get full albums of the same people.
It would be awesome to be able to either shuffle the songs, or manually reorder them. I've been trying to find if this is possible or already requested, but I haven't found anything.

Love what you guys are doing! Thanks!

c-dot-gonz commented 2 years ago

I'd also like to second this feature. Sometimes if people don't feel like voting for songs (or don't know the other songs well enough to vote on them), one person will be able to monopolize the time by putting in all their requests at once.

Ideally this would work, at least in my use case, is by shuffling all available songs in the queue, and when a song is voted on, it moves it to the top like normal.

It'd be even better if it could shuffle through contributors and not just random songs. So if I have 4 people adding songs, instead of choosing random songs from all submitted songs, it chooses a random song from person 2, then person 4, then person 3, then person 1, and then generates a new random permutation of 1-4 after the last person's song is played.

leolabs commented 2 years ago

This is a cool idea! I'm not sure how to implement this efficiently. Currently, we calculate an ordering score based on the date a song was added and the number of votes (vote-processor.ts).

Maybe we could add a random factor to this score when a new track is added to the queue. This wouldn't have a round-robin behavior like you described, but it would make sure that if multiple people add songs, it's not possible for one person to abuse the system.

We also have a setting to disable adding multiple songs from the same search results list to avoid spamming.

c-dot-gonz commented 2 years ago

I have very limited knowledge of coding (mostly limited to a vague understanding of JS), but maybe some general process like: -attach an identifier for each user who has added a song (an arbitrary user number based on IP or a device ID, for example; I imagine you already do this as a way to prevent users from voting on their own songs) -store all identifiers for users in an array ("user array") -if a song is played with no votes based on the date it was added, store the identifier for the user who added the current song in an array ("played array") -the next time there are no votes, choose the next song added by a user still in the "user array", then move the user to the "played array" -if no users exist in the "user array", pop out the last user in the array and unshift to the "user array"

That doesn't randomize the users like I initially suggested, but I'd be more than happy with a round robin method that's based on date added.

There's also likely a more elegant way to do it.

c-dot-gonz commented 2 years ago

I tried to take a look at this again and I agree that adding a random factor to the score would be good enough for my purposes.

I've tried to set line 129 of vote-processor.ts to the following code, but I keep running into all sorts of difficulties trying to get Festify unpackged from package.json (something seems to be up with my Python installation) so I'm unable to test it myself:

((track.added_at - partyCreated)) + ((Math.floor(Math.random() 900 + 100)) 1e7) - (voteCount * VOTE_FACTOR);

This is just to add a really big random number, big enough that it won't be accidentally surpassed in the same party, but small enough that VOTE_FACTOR still pushes items to the top of the list. A release where this could be toggled in settings would be ideal. I really wish I could get this sorted to be able to test it, but it will be a while until I have time to try.

leolabs commented 2 years ago

Thanks for the suggestion! I think it would be a good idea to make this an option that admins can enable if they notice the normal system is being abused. In most cases, having a FIFO system is easier to explain to guests.

@NeoLegends do you have anything to add? :)

c-dot-gonz commented 8 months ago

I've just started using Festify again and wanted to check in to see if this feature could possibly be added. A toggle in the Admin panel to shuffle the order of songs with only 1 vote would be awesome. In addition to my "random number" suggestion, you could also split songs into 2 different arrays by vote count and shuffling the 1 vote array, then when something gets a second vote you move it into the other array, making sure that the songs in the 2+ vote array get played first.