revert a change

This commit is contained in:
Mattias Põldaru 2011-02-21 17:56:23 +02:00
parent 24519832df
commit e8b6bbe141

View File

@ -78,20 +78,7 @@ class CCLIFileImport(SongImport):
details = chardet.detect(detect_content) details = chardet.detect(detect_content)
detect_file.close() detect_file.close()
infile = codecs.open(filename, u'r', details['encoding']) infile = codecs.open(filename, u'r', details['encoding'])
try: lines = infile.readlines()
lines = infile.readlines()
infile.close()
except UnicodeDecodeError:
# First 2kB were not sufficient to detect file encoding.
# This time we read entire file.
detect_file = open(filename, u'r')
detect_content = detect_file.read()
details = chardet.detect(detect_content)
detect_file.close()
# We read the contents again. Should it be a try as well?
infile = codecs.open(filename, u'r', details['encoding'])
lines = infile.readlines()
infile.close()
ext = os.path.splitext(filename)[1] ext = os.path.splitext(filename)[1]
if ext.lower() == u'.usr': if ext.lower() == u'.usr':
log.info(u'SongSelect .usr format file found %s: ', log.info(u'SongSelect .usr format file found %s: ',