2006-05-10 (15:28 EDT) 20.28.00 # is anyone here really familiar with the algorithm by which "insert shuffled" (for, let's say, recursive folders) works? 20.28.41 # i'm poking around in playlist.c, but the code is a bit too obfuscated [and my C skills likewise rusty] to get it well 20.28.59 Join obo [0] (n=obo@82-46-82-224.cable.ubr02.trow.blueyonder.co.uk) 20.29.17 # Falco98: sure, what's your question? 20.29.50 Quit thegeek (Read error: 113 (No route to host)) 20.30.50 Join Rob2222 [0] (n=Miranda@ACB24D7B.ipt.aol.com) 20.31.39 # well in a perfect world, i'd like to code up an additional folder context-menu item called something like "insert shuffled folders", etc 20.32.10 # where instead of shuffling all songs, it only shuffles the order in which folders are added, but then the tracks therein will play in order 20.32.27 # (basically accomplishing the "album shuffle mode" that a few people are clamoring for) 20.32.48 # but i'm afraid at this point my programming skills might not be up-to-task 20.33.29 # anyway, i've been reading the code, and i can't figure out how the "insert shuffled" command picks what position each track is inserted 20.33.31 # Falco98: it would be a little messy because of the recursion... we don't have a complete list of all the subdirectories available 20.33.43 # yeah 20.33.54 # that seems to be the biggest obstacle 20.33.56 # insert shuffled inserts the next track at some point between current playing track and end of playlist 20.34.04 # but that's not what you'd want to use 20.34.22 # instead, take a look at playlist_insert_directory()... that's where you'd want to make the changes you suggest 20.34.29 # how about when you "insert shuffled" on an entire file tree? 20.35.00 # same thing, it inserts randomly between 1 and N where N is number of tracks 20.35.03 # i'm already in "add_directory_to_playlist", which seems to be the true recursive function 20.35.08 # what, it inserts in-order? 20.35.23 # insert what in-order? 20.35.34 # it goes through the directories in order and inserts each track randomly 20.36.07 # ah 20.36.26 # for some reason i thought if i did "insert shuffled" on my root music folder, it would basically be a random-all 20.36.27 # no? 20.36.28 # hmmm, there might be an optimization I can do there... if we're inserting shuffled, no reason to sort the tracks 20.36.53 # Falco98: yeah, it would be a random-all 20.37.14 # since the tracks are being inserted randomly 20.37.16 # oh.. it steps through every track (recursively) inserting *that track* into a random position in the playlist-so-far? 20.37.30 # yes 20.37.33 # ahh 20.37.36 # that makes sense 20.37.40 # hmm 20.38.05 # if directory cache is enabled, you may be able to get a list of all subdirectories 20.38.18 # i wonder if it would be possible to do that kind of thing for "random folder insert".. it would only need to keep index positions for where each "album" ends 20.39.12 # how much more code would that take, do you think? having it create a temporary index list, indexing the album start/end positions for the playlist it's generating? 20.39.13 # yeah, that may work 20.39.31 # then when it goes to insert the next folder, it picks one of those positions at random and inserts the whole folder in order... 20.39.56 # hmmm 20.40.51 # that would completely negate the need for any current directory listing 20.41.14 # and wouldn't put any (or much?) more stress on the system than the current "insert shuffled" 20.41.15 Quit damaki_ (Read error: 110 (Connection timed out)) 20.41.38 # i don't think it would be all that hard to add actually 20.42.04 # just thinking if there are any corner cases you'd need to watch out for 20.42.21 # maybe some really weird ones 20.42.34 # but as long as the "index" idea handles "first" and "last" cases well.. 20.42.55 # easiest way would be to limit the number of directories to a few hundred so that you could just use the stack for storage 20.43.14 # the big problem i can think of is it would require fucking with the current way the recursive function determines a random position.. but then again, i'm new enough to this code so it may be easier than i think 20.43.21 # yeah 20.43.33 # well the H140 says it only handles 2000 folders anyway 20.43.37 # you wouldn't want to use the insert_shuffled option 20.43.45 # You don't even need to save end-indexes for albums 20.43.46 # and the "index" would only thus be 200 or so integers 20.43.48 # Just star-indexes 20.43.50 # start 20.43.54 # yeah 20.43.58 # Then, when randomly inserting, you do it at "random start-1" 20.44.09 # instead, you would specify an exact position 20.44.14 # well when i mention start-and-end i am only being complete :-P 20.45.00 # But all ends are going to be start-1 of the next one anyway. Save on a bit of storage. ;-) The only problem case there is if it's the start of the first album, or if you want to place it after the last one. 20.45.10 # indeed 20.45.40 # really all you need is a list of numbers separated by .. arbitrary non-integer (whitespace, newline, comma) 20.45.51 # 0,12,25,etc 20.45.54 # i think an array would be easier 20.46.14 # oh i guess the index list would change every time something is inserted in the middle though 20.46.29 # keep track what albums have been inserted where 20.46.30 # yeah an array makes more sense 20.46.32 # ahhh 20.46.37 # my settings were wiped :( 20.46.40 # and then randomly choose a "slot" for the next album 20.46.50 # at this point i'm still thinking visually instead of code :-P 20.46.56 # (somewhere between beginning and last album) 20.47.35 # yeah 20.47.54 # so what would the array contain.. just the number of tracks on each album? 20.48.23 # index where either the first or last track of the album is located 20.48.28 # in the playlist 20.48.40 # and when you choose a "slot", you tell it to insert the tracks at array[0] + array[1] .... +array [i] 20.48.54 # does the latest CVS build wipe configs? 20.48.56 # hmm 20.49.06 # no, it would be array[slot]+1, array[slot]+2, etc 20.49.23 # klrspz: i think so.. you should save your settings by doing "write .cfg" before you update to latest build 20.49.43 # yeah, i had an older one luckily.. but stil gotta make some changes... oh well.. 20.49.55 # hardeep: but then when a new album is inserted somewhere in the middle, wouldn't all the other array members need to be shifted? 20.50.12 # Falco98: yes, that's the idea 20.50.47 Join Bagder [0] (n=daniel@1-1-5-26a.hud.sth.bostream.se) 20.51.02 # keeping a count wouldn't save you much, either way you would need to count all elements 20.51.08 # both ways work fine though 20.51.10 # wouldn't it be less processor intensive to have the array value be the number of tracks in that album, and do a summation of 0 -> i to get the index value for insertion? 20.51.17 # yeah 20.51.22 # i suppose you're right 20.51.28 # hmm 20.51.37 # i'm thinking of putting a bounty on this :-P 20.51.50 # since i don't think i could ever quite handle the programming job myself 20.52.12 Join DrMoos [0] (i=DrMoos@m75.net81-66-158.noos.fr) 20.52.54 # BTW i've submitted it to flyspray, an hour or so ago 20.52.55 # http://www.rockbox.org/tracker/task/5338 20.53.01 Quit Moos (Read error: 104 (Connection reset by peer)) 20.53.08 Nick DrMoos is now known as Moos (i=DrMoos@m75.net81-66-158.noos.fr) 20.53.41 # ooh someone has commented too :-D 20.54.52 # Falco98: testing 20.57.53 # hardeep: do you think you could take a stab at it? i'd be unbelievably grateful 20.58.19 Join mirak [0] (n=mirak@AAubervilliers-152-1-3-120.w82-121.abo.wanadoo.fr) 20.59.11 # not right now but maybe after the 3.0 release 20.59.52 # cool