Slashdot Mirror


A LAN-based Democratic Jukebox?

Talez asks: "The environment I live in is pretty much communal and frequented by a few people. Sadly, none of us really agree that much on particular songs. What I'm trying to do is take a Linux box with a high quality soundcard and a bloody big hard drive and try to turn it into a democratic jukebox." Sounds like an interesting idea, and would be interesting to implement on a PC considering the variety of media out there (Vorbis, MP3, CDs and other digital audio formats). Has anyone looked into doing something like this? If this turns out to be a DIY solution, how would you do it?

"I'm trying to find the right combination of hardware and software to accomplish this. What I'm looking for is a system where we can bring up a page on the local LAN, and punch in a username, password and a rating for the song that is playing. Over time, the songs that have been rated higher by the people around the area will get played while the ones rated down won't get played that often. Also, if all of us say that a song -really- sucks, we can get it to skip the song.

While hardware is a matter of choice, I'd appreciate any experience people have had with different soundcards and high quality output. Also, all of us can code decent C, one of us has decent C++ skills and I can throw together semi-basic SQL queries. Is there any software out there that will fit the needs for this situation or at least provide an open source building block for us to go from?"

1 of 27 comments (clear)

  1. One Solution by HyPeR_aCtIvE · · Score: 3, Insightful

    I don't think that this really would be all that hard. In the situation you are in of course. Heck, I think a small script/batch file and a few web pages would about do it.

    Here is my thought.

    You have this PC machine with the good speakers/etc playing the songs (I'm assuming that this is powering speakers that everyone can hear, if this is shoutcasting or streaming somehow, that's a different story, but not TOO much worse).

    On that machine make sure you have a web server going.

    Now, write a small script that will look through a directory of mp3s, randomly pick one and play it. As it does this, it 'marks' that one as being played (for example, writes it's name into a file 'nowplaying.txt').

    Ok, now write a little CGI/PHP/etc page on your website. Make it prompt for a username/password, and then display the song that is playing (by reading nowplaying.txt), and ask for a rating.

    Store these ratings in a big file, let's say 'ratings.txt'. This file can have 1 line per song, and have a list of ratings after it. So if you have 5 people, and you only have 2 ratings (0=hate it, 1=like it) it might look like this:
    Stairway_to_Heaven.mp3 0 1 0 1 1

    Ok, So actually what you would need to do is autogenerate this ratings.txt file in the first place with ALL of the filenames in it, but no ratings yet. Now, instead of making your random player script actually look at the directory of MP3s, have it each time load this ratings file, and 'randomly' pick from it. In this case, if you have 5 people, and a hate it/love it system. You could simply have any song that has 3 hate its, never be played. Beyond that, give any song as many 'chances' as it has 'love its'. So a song that is 4 loves, 1 hate, as twice as much chance to be played as a song with 2 loves, 2 hates, which has twice as much chance to be played as a song with 1 love, 0 hates. etc.

    Of course, this is the simple version. You could easily have a more complicated rating system and therefore a more complicated picking system.

    But the basic gist is:
    1) A random picker script that loops forever, reading ratings.txt (or a DB), applying rules to pick the song to play, and playing.

    2) A CGI that asks for input on the song being played via reading nowplaying.txt, and updates ratings.txt