mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-29 21:51:31 +00:00
中文播放bug fix
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
from argparse import ArgumentParser, FileType
|
||||
from contextlib import closing
|
||||
from codecs import open as copen
|
||||
from io import open as copen
|
||||
from json import dumps
|
||||
from math import ceil
|
||||
import re
|
||||
@@ -46,20 +46,20 @@ def scriptToJSON(scriptf, timing=None):
|
||||
ret = []
|
||||
|
||||
with closing(scriptf):
|
||||
scriptf.readline() # ignore first header line from script file
|
||||
print "# %s #" % scriptf.readline() # ignore first header line from script file
|
||||
offset = 0
|
||||
for t in timing:
|
||||
dt = scriptf.read(t[1])
|
||||
data = escapeString(dt)
|
||||
# print ('###### (%s, %s)' % (t[1], data))
|
||||
print ('###### (%s, %s)' % (t[1], repr(data)))
|
||||
offset += t[0]
|
||||
ret.append((data, offset))
|
||||
return dumps(ret)
|
||||
|
||||
|
||||
def renderTemplate(script_path, time_file_path, dimensions=(24, 80), templatename=DEFAULT_TEMPLATE):
|
||||
# with copen(script_path, encoding='utf-8', errors='replace') as scriptf:
|
||||
with open(script_path) as scriptf:
|
||||
with copen(script_path, encoding='utf-8', errors='replace', newline='\r\n') as scriptf:
|
||||
# with open(script_path) as scriptf:
|
||||
with open(time_file_path) as timef:
|
||||
timing = getTiming(timef)
|
||||
json = scriptToJSON(scriptf, timing)
|
||||
|
||||
Reference in New Issue
Block a user