PDA

View Full Version : Suggestion for tweak to Random Mix



Robin Bowes
2005-09-27, 18:00
Max,

Would it be possible to modify the Random mix plugin so that the
currently playing track is in the middle of the playlist, e.g. position 5?

So, when the Random mix is first chosen, it would start playing at
position 1, then 2, 3, 4, 5 and only start adding new songs to the end
of the list and dropping them from the top when it reaches track 6.

R.
--
http://robinbowes.com

If a man speaks in a forest,
and his wife's not there,
is he still wrong?

max.spicer
2005-09-27, 23:58
There's another thread in this forum where someone else has said exactly that. My answer, in short, is to go and change the preference telling it to delete old tracks. Yes, it would be possible, but I want to do other more interesting things for now and really don't see what's wrong with having all your history rather than just the last five tracks. That said, and seeing as it's you, patches welcome! I've already asked someone to file an rfe for this - not sure if they did or not. :-)

Max


Max,

Would it be possible to modify the Random mix plugin so that the
currently playing track is in the middle of the playlist, e.g. position 5?

So, when the Random mix is first chosen, it would start playing at
position 1, then 2, 3, 4, 5 and only start adding new songs to the end
of the list and dropping them from the top when it reaches track 6.

R.
--
http://robinbowes.com

If a man speaks in a forest,
and his wife's not there,
is he still wrong?

oreillymj
2005-09-28, 02:56
Yes, I suggested not removing items from the top of the playlist until we reach mid-way to keep a small history and still keep the playlist from growing.

I'm going to look at the perl to see what's involved. I would imagine only 2 or 3 lines of code.



Psuedo Code

If CurrentItemIndex > (NumberOfItems/2)-1 then
Remove Oldest Item From Playlist
AddItem to bottom of Playlist
End If

Move to next Item in playlist and update Index

robinbowes
2005-09-28, 05:39
There's another thread in this forum where someone else has said exactly that. My answer, in short, is to go and change the preference telling it to delete old tracks. Yes, it would be possible, but I want to do other more interesting things for now and really don't see what's wrong with having all your history rather than just the last five tracks. That said, and seeing as it's you, patches welcome! I've already asked someone to file an rfe for this - not sure if they did or not. :-)

Max

Ok, I'll see if I can get time to have a look at this.

R.

oreillymj
2005-09-28, 07:43
I've had a look at the final RandomMix plugin posted here http://forums.slimdevices.com/showpost.php?p=54711&postcount=72 and although I have a rough idea of the areas within the code which requires changing, I've no idea how to go about it.

dean
2005-09-28, 07:48
I think that it might be better to change the setting that says
whether or not to remove played tracks to a numerical value of how
many played tracks to keep.

This is how iTunes does it in the Party Mix, and it makes a lot of
sense. Make the default settings 5 ahead and 5 behind and we'll be
in great shape, I think.


On Sep 27, 2005, at 11:58 PM, max.spicer wrote:

>
> There's another thread in this forum where someone else has said
> exactly
> that. My answer, in short, is to go and change the preference telling
> it to delete old tracks. Yes, it would be possible, but I want to do
> other more interesting things for now and really don't see what's
> wrong
> with having all your history rather than just the last five tracks.
> That said, and seeing as it's you, patches welcome! I've already
> asked
> someone to file an rfe for this - not sure if they did or not. :-)
>
> Max
>
> Robin Bowes Wrote:
>
>> Max,
>>
>> Would it be possible to modify the Random mix plugin so that the
>> currently playing track is in the middle of the playlist, e.g.
>> position
>> 5?
>>
>> So, when the Random mix is first chosen, it would start playing at
>> position 1, then 2, 3, 4, 5 and only start adding new songs to the
>> end
>>
>> of the list and dropping them from the top when it reaches track 6.
>>
>> R.
>> --
>> http://robinbowes.com
>>
>> If a man speaks in a forest,
>> and his wife's not there,
>> is he still wrong?
>>
>
>
> --
> max.spicer
>
> The wild things roared their terrible roars and gnashed their terrible
> teeth
> and rolled their terrible eyes and showed their terrible claws
> but Max stepped into his private boat and waved good-bye
>

max.spicer
2005-09-28, 08:07
Go on then, I'll have a look into it. ;-) I personally will still want the whole history though, so I'll probably do something like negative = infinite. This can be made prettier in the gui.

Max


I think that it might be better to change the setting that says
whether or not to remove played tracks to a numerical value of how
many played tracks to keep.

This is how iTunes does it in the Party Mix, and it makes a lot of
sense. Make the default settings 5 ahead and 5 behind and we'll be
in great shape, I think.

dean
2005-09-28, 08:17
Negative? What are you, a programmer? :)

How about "leave blank to never remove songs".


On Sep 28, 2005, at 8:07 AM, max.spicer wrote:

>
> Go on then, I'll have a look into it. ;-) I personally will still
> want
> the whole history though, so I'll probably do something like
> negative =
> infinite. This can be made prettier in the gui.
>
> Max
>
> dean Wrote:
>
>> I think that it might be better to change the setting that says
>> whether or not to remove played tracks to a numerical value of how
>> many played tracks to keep.
>>
>> This is how iTunes does it in the Party Mix, and it makes a lot of
>> sense. Make the default settings 5 ahead and 5 behind and we'll be
>> in great shape, I think.
>>
>
>
> --
> max.spicer
>
> The wild things roared their terrible roars and gnashed their terrible
> teeth
> and rolled their terrible eyes and showed their terrible claws
> but Max stepped into his private boat and waved good-bye
>

oreillymj
2005-09-28, 08:44
Or just "imitate" i-tunes, but add an "All" option

Display 0,5,10,15,20,25,50,75,100,All recently played songs and
0,5,10,15,20,25,50,75,100 upcoming songs


Apple do tend to do a good design job in terms of UI.

max.spicer
2005-09-28, 10:11
Pah, it will be negative until you tell me how to validate something that can either be empty or a positive integer. Saying, "just define your own validation function" is the wrong answer. ;-)

Max


Negative? What are you, a programmer? :)

How about "leave blank to never remove songs".

dean
2005-09-28, 10:26
How about not validating?

On Sep 28, 2005, at 10:11 AM, max.spicer wrote:

>
> Pah, it will be negative until you tell me how to validate something
> that can either be empty or a positive integer. Saying, "just define
> your own validation function" is the wrong answer. ;-)
>
> Max
>
> dean Wrote:
>
>> Negative? What are you, a programmer? :)
>>
>> How about "leave blank to never remove songs".
>>
>
>
> --
> max.spicer
>
> The wild things roared their terrible roars and gnashed their terrible
> teeth
> and rolled their terrible eyes and showed their terrible claws
> but Max stepped into his private boat and waved good-bye
>

max.spicer
2005-09-28, 10:46
That's what I'm doing atm, but I'm not sure what I'm going to do if the user enters aoeu. Is there not an easy way of saying "may be blank, but if not must be an integer"?

Max


How about not validating?

On Sep 28, 2005, at 10:11 AM, max.spicer wrote:

>
> Pah, it will be negative until you tell me how to validate something
> that can either be empty or a positive integer. Saying, "just define
> your own validation function" is the wrong answer. ;-)
>
> Max
>
> dean Wrote:
>
>> Negative? What are you, a programmer? :)
>>
>> How about "leave blank to never remove songs".
>>
>
>
> --
> max.spicer
>
> The wild things roared their terrible roars and gnashed their terrible
> teeth
> and rolled their terrible eyes and showed their terrible claws
> but Max stepped into his private boat and waved good-bye
>

dean
2005-09-28, 11:01
aeiou is not a number, so it should be handled the same as blank (and
probably set to blank when entered.)


On Sep 28, 2005, at 10:46 AM, max.spicer wrote:

>
> That's what I'm doing atm, but I'm not sure what I'm going to do if
> the
> user enters aoeu. Is there not an easy way of saying "may be blank,
> but if not must be an integer"?
>
> Max
>
> dean Wrote:
>
>> How about not validating?
>>
>> On Sep 28, 2005, at 10:11 AM, max.spicer wrote:
>>
>>
>>>
>>> Pah, it will be negative until you tell me how to validate something
>>> that can either be empty or a positive integer. Saying, "just
>>>
>> define
>>
>>> your own validation function" is the wrong answer. ;-)
>>>
>>> Max
>>>
>>> dean Wrote:
>>>
>>>
>>>> Negative? What are you, a programmer? :)
>>>>
>>>> How about "leave blank to never remove songs".
>>>>
>>>>
>>>
>>>
>>> --
>>> max.spicer
>>>
>>> The wild things roared their terrible roars and gnashed their
>>>
>> terrible
>>
>>> teeth
>>> and rolled their terrible eyes and showed their terrible claws
>>> but Max stepped into his private boat and waved good-bye
>>>
>>>
>
>
> --
> max.spicer
>
> The wild things roared their terrible roars and gnashed their terrible
> teeth
> and rolled their terrible eyes and showed their terrible claws
> but Max stepped into his private boat and waved good-bye
>

max.spicer
2005-09-28, 12:04
One of us is missing the point here. ;-)

I have code such as the following:
my %setupPrefs = (

'plugin_random_number_of_tracks' => {

'validate' => \&Slim::Web::Setup::validateInt,
'validateArgs' => [1, undef, 1],
},

'plugin_random_number_of_old_tracks' => {}
);

I want to apply validation to plugin_random_number_of_old_tracks that accepts either an integer, or the empty string. If I use validateInt as it is used above, it only accepts integers and so rejects the empty string. I just wondered if there was a built in way of doing this, or if I need to write my own validation function.

Max



aeiou is not a number, so it should be handled the same as blank (and
probably set to blank when entered.)

max.spicer
2005-09-28, 12:08
Or, to put it another way, is there a way of saying to the web ui that the parameter is optional.

Max


One of us is missing the point here. ;-)

I have code such as the following:
my %setupPrefs = (

'plugin_random_number_of_tracks' => {

'validate' => \&Slim::Web::Setup::validateInt,
'validateArgs' => [1, undef, 1],
},

'plugin_random_number_of_old_tracks' => {}
);

I want to apply validation to plugin_random_number_of_old_tracks that accepts either an integer, or the empty string. If I use validateInt as it is used above, it only accepts integers and so rejects the empty string. I just wondered if there was a built in way of doing this, or if I need to write my own validation function.

Max

max.spicer
2005-09-28, 12:36
Just posted a patch for this. Should be in tomorrow's nightly with any luck.

Max


Go on then, I'll have a look into it. ;-) I personally will still want the whole history though, so I'll probably do something like negative = infinite. This can be made prettier in the gui.

Max

robinbowes
2005-09-29, 07:12
Just posted a patch for this. Should be in tomorrow's nightly with any luck.

Cool. I'll check it out (I use SVN so I'll get the change as soon as it's been committed).

R.