reading video from USB memory (unplug/reinster causes issues

listdir() on /media would work fine I guess in the condition that only memory drives appear there, and plugging some other USB device won’t have a folder with an executable or something along this line show up there. As you can see I’m not really experienced with Linux…
Panda is running fine on Ubuntu on the Gizmo 2 board though and not giving me any trouble.