An Edinburgh man has been jailed for explosives offences and possession of nearly 1500 indecent images of children.