If the in and out detectors are close enough together so that they are both broken at the same time (of course, one before the other), then it becomes a simple logic soln:
One LED detector drives the data pin of a D flipflop (7474). The other drives the clock. Let's call them C and D (clock and Data?)...
if C is broken BEFORE D, the f/f is clocked low. If D is broken before C, then the f/f is clocked high. This can be your direction bit... now all you have to do is delay your clock and then use it to clock an up/down counter (you don't want to clock the counter at the same time as you clock the direction f/f. When both LED detectors are inactive, you reset the f/f (or not, it will be clocked to the correct direction on the next clock pulse). This is a trick used in shaft encoders to determine the direction of rotation along with the speed.