pubic_id, load utf-16 subtitles, fix oxid

This commit is contained in:
j 2011-10-18 14:01:01 +02:00
commit 234085a2db
3 changed files with 11 additions and 10 deletions

View file

@ -188,7 +188,6 @@ class File(models.Model):
bomDetection = bomDict.get((byte1, byte2, byte3, None))
if not bomDetection:
bomDetection = bomDict.get((byte1, byte2, None, None))
## if BOM detected, we're done :-)
fp.seek(oldFP)
if bomDetection:
@ -211,7 +210,6 @@ class File(models.Model):
encoding = _detectEncoding(f)
data = f.read()
f.close()
data = data.replace('\r\n', '\n')
try:
data = unicode(data, encoding)
except:
@ -220,7 +218,7 @@ class File(models.Model):
except:
print "failed to detect encoding, giving up"
return srt
data = data.replace('\r\n', '\n')
srts = re.compile('(\d\d:\d\d:\d\d[,.]\d\d\d)\s*-->\s*(\d\d:\d\d:\d\d[,.]\d\d\d)\s*(.+?)\n\n', re.DOTALL)
i = 0
for s in srts.findall(data):