Forum

Optimal approach to switching spreads

Hi all,

I’m reading a bunch of .csv files as video playlists and then using Zip to pack them into one output before unzipping later using an index to select the playlist i want, then randomly selecting a video from it.

Is Zip/Unzip/Switch the most performant way to do this? Hopefully its clear from the screenshot what i’m trying to do. Still new to vvvv and not convinced i’ve at all grasped the right way to work with data.

i think it would be better to use cons, with zip, you combine first slice of each input, not sure it’s exactly what you want check this link, with cons you will know how many slices you have in playlist dynamically also, then instead of switch you use getslice with index is your playlist and binsize connected to corresponding cons pin

i wonder if you could simplify it to something like:

grafik

note that here one Reader node, loads the contents of all .csv files at once and returns them as a spread. then you first select the one playlist your interested in (via ActiveSlice) and only then you use Separate… to split only the one selected playlist.

@antokhio thanks for the tip, I was using cons in earlier version of this thing before starting to try and handle multiple playlists. How would i go about splitting the playlists back apart again though? i’ve got different amounts of videos in each one, would it be 11 GetSlices connected to the cons node with an offset?

@joreg Oh yeah that’s cool. I was wondering how to open multiple files, so would that wildcard work the same as other program like if you have prefix_*.csv? I’ll try and switch from zip to cons first and then have a go at simplifying it.

Thanks both!

here try like that
image
aproach.v4p (4.4 KB)

ok thanks will take a look at it. not quite twigged yet but i’ll get there eventually :)

wow yeah thanks so much guys, as far as I can tell this now does exactly the same as my over complicated network. just had to adjust the names of the csvs so they are in the right order to correspond with the slice indexs coming from up stream.

many thanks! :) v3_LoadAllPlaylists

1 Like