This is a completed script I've used for about a day, so … caveat emptor….

It takes items that are drops from sieves and makes the broken ores into gravel, and passes the rest on through to the output

http://pastebin.com/0byF0CBr