parse_filename: Fixed issues when filename contain dots.

Unfortunately the code of `parse_filename` seems to be duplicated. This patch should fix problems that arise when the file name contains dots. Obviously `name = fname.split('.')[0]` will not work in this case.

This should fix issue #6260.