Sharing: Beginning idea and a weird bug

I’ve made somewhat of a frankenstein monster of pre-existing modules I have found and messing about with the way they work. Maybe someone will find what I’ve made useful? There is a bug, though. Any insight would be appreciated (and apologies for the long post to fully explain).

I’ve taken the video bin found in the Rouge video mixer ( [url]http://www.maryfranck.net/rouge/[/url] ), and then output the active bin’s table. This gives a list of the video file filepaths. That goes into the nVoid playlist creator system, ( [url]https://github.com/nVoid/TouchDesigner-Playlist-Creator[/url] ) which I have modified. Then a table is output from the playlist, which shows the active scene, in this case being the filepath for the video. This feeds into a moviefilein TOP, which then plays the video that resides in the filepath it is given.

It ain’t pretty. I’m going through it to try and comment in a more helpful way later on, but it is still messy.

In my current setup, I have 6 videos. They are all approximately 30 seconds, except for the second one, which is around 60 seconds. For the most part, everything works. Using MediaInfo, I’m able to grab the length of a given video file when adding a video to the list. The videos will cycle through the playlist, previous and next buttons work, and all that.

I have a bug. A really weird one.

The ‘Next’ button goes to the next scene in the playlist. As I’ve tested this setup, I noticed something odd about the second 60sec movie file. If I just click next, next, next, everything works fine. Playlist entry one, two, three, etc. If I let it play, again everything works fine. However, if I click ‘Next’ while viewing the second 60sec entry, and I am above 30-35 seconds into that clip, my playlist skips to the fourth playlist entry and not the third.

That is a normal bug. So I went about diagnosing it. While doing that, I went into the CHOP Execute for the next button. I put print() debugging statements in the “While Off” function to show what my current segment was. Nothing else. No commands, just a print. When I do this, and enable the “While Off” parameter on the CHOP Execute, when the second 60sec clip reaches just after 31 seconds, the playlist prematurely cuts off the playlist entry and continues on to the third playlist entry. Entirely without clicking a thing.

I’ve been teaching myself TD for the past few months. But I have programming experience, so when clicking “next” skipped an entry I knew I had done something wrong. But the idea that simply debugging with a print() command can change the behavior of a TD program is entirely baffling to me as a programmer. Anyone have any wisdom as to what is going on here? Is the “while on” effecting the cook of the operators somehow? Very, very confused.

I’ve attached my program, if anyone wants to take a look. I’ve set it up so that the left pane is looking at the master component and the right pane is looking at the chopexec code for the next button. The bug should be replicated without having to add anything, but if you want to see how everything works- run this file in a folder with a folder inside called “Utilities”, and put MediaInfo.exe inside of that. I also created a folder called “Video” where I can put my video files, so the filepaths are relative and therefore easier on the eyes.

Press Previous and Next buttons on the component to cycle through the playlist entries. Let it play by itself. In both cases, functionality should work fine.

To replicate the normal bug, press “Next” while the second 60sec long entry is at about 35-40 seconds in (or longer). You will see that you are sent to the fourth playlist entry instead of the third. If you click before the 30sec mark, it will be the third.

Then to replicate the weird bug, turn on the “While Off” parameter of chopexec1, which should be visible on the right hand pane, location at /project1/container1/playlist1/transport/next2. Now let the second clip play. At about 31 seconds it will jump to the third entry.

I think I just got a little carried away with adding, deleting, ripping out and generally improvising on a pre-existing piece that was fairly intricate. Definitely know I’ll need to study up more on my TD programming best practices. But having the print() make things even funkier not only confuses the hell out of me, but makes it harder for me to figure out where I went wrong.

I’d be grateful for any lessons on this! Thanks.
VideoPlaylistSystem.toe (42.7 KB)