2006-02-21, 17:42
if the controls are exposed to python it would be easy enough to use the autoexec.py to auto start party mode.
(jmarshall @ feb. 21 2006,01:01 Wrote:regarding the randomness, i don't think that calling srand(timegettime()); rand() is necessarily a reliable random sequence - the "random" number is tied to close to the current time. it gets even worse if you modulo it as the low bits of rand() are less variable than the high bits. this is used elsewhere in xbmc as well and is the reason for a number of other phenomena such as the slideshow random angles not being particularly random.agreed, jonathan, but more importantly, even if you had a truely "random" distribution, without protecting against it, you could have a legit double hit of one song in a 10 of 38 selection...just making a point that pure random distributions won't prevent something selected once from showing up again until all possible values have been populated. in this case, i think a check needs to be made not to add the random song to the queue unless there are 10 or fewer files to pick from (at which time you just fall into randomizing the order of the files that you do have) if it is already in the queue.
perhaps we could have a random number class that seeds once and then uses the one sequence (up until a set number of drawings, then re-seed it) so that we can get reasonable randomness? i think using srand() and rand() is fine as long as we do it sensibly.
also, we could have a history vector of song ids for database::getrandomsong() to eliminate the issues pike is seeing for say 100 songs or so.
party mode looking great though - i like it
cheers,
jonathan
Quote:but, this presents some questions for discussion... how should select/play and queue ultimately work during party mode?i kind of agree with the last poster, but i kind of think that select/play should play the selected song immediately and queue should put it next, right after currently playing song. or for future consideration, once you have a flag to know which songs are random and which songs are user-picked, queue would add to the bottom of the user-picked list (which may be at any position).
should select/play put the selected items beneath the currently playing item as sollie suggests, or should it interupt the list as it does now? (i really think that select/play should work as it does today. if someone plays something, it means they want to hear it immediately.)
where should queue put the items? underneath the currently playing song, underneath the last user added item, or at the bottom like it does today?
Quote:error party mode: cannot get songs from database. aborting.in my case is because songs are picked random from 1 to nr of song in the database. i did a "clean database" recently because i renamed some music so those songs were removed from the database and readded after a new scan. so some songs it won't find because the id's don't exist in the database anymore and some songs it will never pick because those id's are higher then the nr of songs in the database.
Quote:i didnt look at athe code yet but it feels that its grabbing the files one by one from the db. perhaps it should calculate all the random file ids first and grab then all at once from the db, however, i am being very picky now, as it works well now, as the list is small.yes, for two reasons... 1) the process is metered to run on a fixed interval and 2) once its going, it really only needs to get one random song. but, yes you are right that when you first enable it, its not that efficient. it could just as many songs as necessary every iteration to keep the song at a depth of 10.
Quote:small bug, party mode doesnt disable automatically when you stop playback. maybe this is intended, but if u eg. watch a video and then return to partymode without disable/re-enable it doesnt workyes, i skipped over the stop action because i wasnt sure what it should do. should it completely disable party mode? this is a minor bug that can be corrected when we decided what stop should do. if you play a movie while party mode is playing, it should work correctly. and disabling and re-enabling party mode from the library window should get it going again. (i'm assuming in this particular condition the button still shows it active, right?)
Quote:the reason i say select/play should play immediately is because if one of the random songs it picks sucks (limp bizkit hahaha), you can just find the best song in the list below it and hit play to play right now instead of having to wait for the sucky song to finish.this is one of the reasons why i think play should interrupt.
Quote: in my case is because songs are picked random from 1 to nr of song in the database. i did a "clean database" recently because i renamed some music so those songs were removed from the database and readded after a new scan. so some songs it won't find because the id's don't exist in the database anymore and some songs it will never pick because those id's are higher then the nr of songs in the database.thanks for pointing this out. this is something i didnt consider. in your case, the number of songs doesnt match the existing id's. hmm. i have to think about how to compensate for this. maybe if the picked id doesnt exist, keep incrementing by 1 until a valid id is found?
Quote:i think a graded function with a set percentage of say 80% or whatever before 100 songs, and 80 after that would be ok. we can always change it as we find a good balance. the first query when starting party mode would determine the history size.sorry, i dont follow. the first query being what?
Quote:i think play/select should always act as it does now -i agree with this logic. so the "add" item would function like queue does today and adds the item at the bottom of the queue?
it should play immediately. queue should queue up underneath the currently playing item. in addition, the queue option should be renamed "play next in party shuffle" in the context menu, and a "add to party shuffle" item added.
Quote:yes, i skipped over the stop action because i wasnt sure what it should do. should it completely disable party mode? this is a minor bug that can be corrected when we decided what stop should do. if you play a movie while party mode is playing, it should work correctly. and disabling and re-enabling party mode from the library window should get it going again. (i'm assuming in this particular condition the button still shows it active, right?)yes you are corrent in describing its behavior. i believe party mode should simply be disabled and playlist cleared. this is consistant with general xbmc usage
Quote:this is one of the reasons why i think play should interrupt.very much agreed. queue action is there for a reason
Quote:this, in particular, is why i coded it the way i did. it didnt want to get a large returned list and then pick from it. but, as charly has already identified, theres a flaw in this logic because it assumes that the song ids are consecutive.why not select all ids insted of the full songview. after id's have been selected then go and fetch the needed information (path, title, etc) from the db. though it sounds like you may have already coded something completely different, i dont want to poo poo your method.
Quote:[current playing] song 12345
--another enqueued song would be added here--
[enqueued] third enqueued
[enqueued] second enqueued
[enqueued] first enqueued
[random] song1
[random] song2
[random] song3
Quote:[current playing] song 12345
[enqueued] first enqueued
[enqueued] second enqueued
[enqueued] third enqueued
--another enqued song would be added here--
[random] song1
[random] song2
[random] song3
Quote:maybe if the picked id doesnt exist, keep incrementing by 1 until a valid id is found?a few options: