mherger wrote:
> > It looks like smarmix always takes the first match: it always takes
> the
> > live version of Smells Like Teen Spirit. Is it possible to change
> that
> > behavior: if there are two or more matches (same artist/title) ->
> choose
> > one at random?
>
> I'm already doing this:
>
> # sometimes we have multiple IDs for one track - pick a random one...
> if ($song->{foreign_ids} && scalar @{$song->{foreign_ids}}) {
> my $songIds = $song->{foreign_ids};
> $song = $songIds->[rand @$songIds]->{foreign_id} if scalar @$songIds;
>
> "rand @$songIds" would pick a random index. But rand sometimes just
> doesn't look random enough...
>
> --
>
> Michael
Hmmm... I did a test: created a Nirvana artist mix. Ran it five times
(generate an other order of songs every time) and got the live version
of Smells Like Teen Spirit every time.
I do understand that a random function might be not so random when it
can only choose between 2 values, but 5 out of 5...
Could it be that you need to initialize rand with some random seed (like
CPU time) before you can use it (think it's like that in Java, but don't
know what program language you used for you plugin)?
My LMS on my Synology NAS is version 1.6.8
------------------------------------------------------------------------
kefkekeyser's Profile: http://forums.slimdevices.com/member.php?userid=64536
View this thread: http://forums.slimdevices.com/showthread.php?t=97668
_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins