File info: code refactoring

Changes for don't repeat code :)

Only make a dict with extensions and encodings, instead of check the extensions with 'elif'.