If all Products that are Media Type are in one categories_id then you could check the count against the number of products with the master_categories_id that matches this categories_id and when they are the same, you know it is all media ... and when different then you know to skip it ...
I thought I posted something similar on FIRST CLASS the other day that you could probably use to show you where in the code you need to manage a switch ...


I tried copying the code Ajeh provided into usps.php .. No luck. 

