Commit 4733180f authored by cxy's avatar cxy

bugfix for import excel

parent 60f70e01
cap.png

34.8 KB

{
"user_name":"盲文出版社",
"dd_url_prefix":"https://oapi.dingtalk.com/robot/send?access_token=a7e6b223bc0a6e4b5e3f64b1570d0c884db0d833592f5e84b020c2896130d659",
"secret":"SEC252452789bc17cfb1e6c973f837426fa0f9fd50c8793239c070e9d3c021d8109"
}
\ No newline at end of file
...@@ -9,35 +9,44 @@ import base64 ...@@ -9,35 +9,44 @@ import base64
import hashlib import hashlib
import urllib.parse import urllib.parse
user_name = "盲文出版社" with open("./ding_notify.conf", "r", encoding="utf-8") as f:
dd_url_prefix = "https://oapi.dingtalk.com/robot/send?access_token=a7e6b223bc0a6e4b5e3f64b1570d0c884db0d833592f5e84b020c2896130d659" json_obj = json.load(f)
# dd_url_prefix = "https://oapi.dingtalk.com/robot/send?access_token=12a5e64b24e7345fed2415c5c2f9101180763e327b21727cd35fdaa3fb274e74" # user_name = "盲文出版社"
secret = 'SEC252452789bc17cfb1e6c973f837426fa0f9fd50c8793239c070e9d3c021d8109' # dd_url_prefix = "https://oapi.dingtalk.com/robot/send?access_token=a7e6b223bc0a6e4b5e3f64b1570d0c884db0d833592f5e84b020c2896130d659"
# secret = "SECb5d68b27bd2e4694667d36c0f91336f3641b3287b945906a83997353f961d415" # # dd_url_prefix = "https://oapi.dingtalk.com/robot/send?access_token=12a5e64b24e7345fed2415c5c2f9101180763e327b21727cd35fdaa3fb274e74"
# secret = 'SEC252452789bc17cfb1e6c973f837426fa0f9fd50c8793239c070e9d3c021d8109'
# # secret = "SECb5d68b27bd2e4694667d36c0f91336f3641b3287b945906a83997353f961d415"
user_name = json_obj["user_name"]
dd_url_prefix = json_obj["dd_url_prefix"]
secret = json_obj["secret"]
def notify(err): def notify(err):
timestamp = str(round(time.time() * 1000)) try:
secret_enc = secret.encode('utf-8') timestamp = str(round(time.time() * 1000))
string_to_sign = '{}\n{}'.format(timestamp, secret) secret_enc = secret.encode('utf-8')
string_to_sign_enc = string_to_sign.encode('utf-8') string_to_sign = '{}\n{}'.format(timestamp, secret)
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest() string_to_sign_enc = string_to_sign.encode('utf-8')
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code)) hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
print(timestamp) sign = urllib.parse.quote_plus(base64.b64encode(hmac_code))
print(sign) print(timestamp)
dd_url = dd_url_prefix + "&timestamp=" + timestamp + "&sign=" + sign print(sign)
h = {"Content-Type": "application/json"} dd_url = dd_url_prefix + "&timestamp=" + timestamp + "&sign=" + sign
d = { h = {"Content-Type": "application/json"}
"msgtype": "markdown", d = {
"markdown": { "msgtype": "markdown",
"title": "msg", "markdown": {
"text": "| 用户名称:%s \n" % (user_name) + "title": "msg",
"\n" + "text": "| 用户名称:%s \n" % (user_name) +
"| 异常时间:%s \n" % (time.strftime('%Y:%m:%d %H:%M:%S', time.localtime(int(time.time())))) + "\n" +
"\n" + "| 异常时间:%s \n" % (time.strftime('%Y:%m:%d %H:%M:%S', time.localtime(int(time.time())))) +
"| 异常信息:%s \n" % (err) "\n" +
"| 异常信息:%s \n" % (err)
}
} }
} r = requests.post(dd_url, json.dumps(d), headers=h)
r = requests.post(dd_url, json.dumps(d), headers=h) print(r.status_code)
print(r.status_code) print(r.text)
print(r.text) except Exception as e:
\ No newline at end of file print("ding notify err")
print(e)
\ No newline at end of file
...@@ -93,7 +93,7 @@ def read_xlsx(file_path): ...@@ -93,7 +93,7 @@ def read_xlsx(file_path):
new_element = Element(start_time, end_time, subtitle, suggest, aside, speed) new_element = Element(start_time, end_time, subtitle, suggest, aside, speed)
new_element.print_self() new_element.print_self()
elements.append(new_element) elements.append(new_element)
# checkLength(elements) checkLength(elements)
print("element size:") print("element size:")
print(len(elements)) print(len(elements))
return elements return elements
......
...@@ -759,7 +759,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -759,7 +759,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.all_threads.append(t) self.all_threads.append(t)
for t in self.threads: for t in self.threads:
t.start() try:
t.start()
except Exception as e:
print(e)
print("===子线程已经开启 in detect ===") print("===子线程已经开启 in detect ===")
self.statusbarLabel.setText(" 准备检测:") self.statusbarLabel.setText(" 准备检测:")
...@@ -1696,20 +1699,24 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -1696,20 +1699,24 @@ class MainWindow(QMainWindow, Ui_MainWindow):
"""撤销之前对表格内容的修改操作 """撤销之前对表格内容的修改操作
""" """
self.can_write_history = False try:
self.user_editing_aside = True self.can_write_history = False
record = self.projectContext.history_pop() self.user_editing_aside = True
print('[undo_slot] record=%s' % (record.to_string())) record = self.projectContext.history_pop()
item = QTableWidgetItem(record.old_str) print('[undo_slot] record=%s' % (record.to_string()))
row = int(record.row) item = QTableWidgetItem(record.old_str)
# self.projectContext.aside_list[row].aside = record.old_str row = int(record.row)
# self.pb_tableWidget.setItem( # self.projectContext.aside_list[row].aside = record.old_str
# row, constant.Aside.AsideColumnNumber, item) # self.pb_tableWidget.setItem(
# row, constant.Aside.AsideColumnNumber, item)
self.projectContext.all_elements[row].aside = record.old_str
self.all_tableWidget.setItem( self.projectContext.all_elements[row].aside = record.old_str
row, constant.Content.AsideColumnNumber, item) self.all_tableWidget.setItem(
self.action_redo.setEnabled(True) row, constant.Content.AsideColumnNumber, item)
self.action_redo.setEnabled(True)
except Exception as e:
print("undo slot err")
print(e)
def redo_slot(self): def redo_slot(self):
"""重做之前撤销的对表格内容的修改操作 """重做之前撤销的对表格内容的修改操作
......
...@@ -32,7 +32,10 @@ class ExportProcessor(QWidget): ...@@ -32,7 +32,10 @@ class ExportProcessor(QWidget):
self.threads.append(t) self.threads.append(t)
for t in self.threads: for t in self.threads:
t.start() try:
t.start()
except Exception as e:
print(e)
print("===子线程已经开启 in export===") print("===子线程已经开启 in export===")
......
{"video_path": null, "excel_path": null, "detection_info": {"detected": false, "nd_process": 0.0, "last_time": 0.0, "caption_boundings": [], "has_subtitle": true}, "speaker_info": {"speaker_type": "\u79d1\u5927\u8baf\u98de", "speaker_id": "\u6653\u8fb0\uff0c\u5973\uff0c\u5e74\u8f7b\u4eba", "speaker_speed": "1.00(4\u5b57/\u79d2)"}} {"video_path": null, "excel_path": null, "detection_info": {"detected": false, "nd_process": 0.0, "last_time": 0.0, "caption_boundings": [], "has_subtitle": true}, "speaker_info": {"speaker_type": "\u6d59\u5927\u5185\u90e8tts", "speaker_id": "eagle\uff0c\u5973\uff0c\u5e74\u8f7b\u4eba", "speaker_speed": "1.00(4\u5b57/\u79d2)"}}
\ No newline at end of file \ No newline at end of file
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
], ],
"speaker_zju_details": [{ "speaker_zju_details": [{
"id": 0, "id": 0,
"name": "test", "name": "eagle",
"language": "中文(普通话,简体)", "language": "中文(普通话,简体)",
"age_group": "年轻人", "age_group": "年轻人",
"gender": "女", "gender": "女",
......
...@@ -20,7 +20,7 @@ a = Analysis( ...@@ -20,7 +20,7 @@ a = Analysis(
['start.py'], ['start.py'],
pathex=[], pathex=[],
binaries=[], binaries=[],
datas=[('vits_chinese','vits_chinese')] + [('res','res'),('./deploy.bat','.'),('LAVFilters64','LAVFilters64'),('LAVFilters32','LAVFilters32')] + pkgPaths, datas=[('vits_chinese','vits_chinese')] + [('res','res'),('./deploy.bat','.'),('./ding_notify.conf','.'),('LAVFilters64','LAVFilters64'),('LAVFilters32','LAVFilters32')] + pkgPaths,
hiddenimports=['filecmp'], hiddenimports=['filecmp'],
hookspath=[], hookspath=[],
hooksconfig={}, hooksconfig={},
......
...@@ -132,7 +132,7 @@ def check_sheet_content(book_path: str) -> bool: ...@@ -132,7 +132,7 @@ def check_sheet_content(book_path: str) -> bool:
bool: True(用户输入的表符合预期) or False(用户输入的表格式不正确,很可能输入错误) bool: True(用户输入的表符合预期) or False(用户输入的表格式不正确,很可能输入错误)
""" """
sheet_heads = get_sheetHead(book_path) sheet_heads = get_sheetHead(book_path)
need_heads = ['起始时间', '终止时间', '字幕', '建议', '解说脚本'] need_heads = ['起始时间', '终止时间', '字幕', '建议旁白字数', '解说脚本']
if len(sheet_heads) == 0: if len(sheet_heads) == 0:
return False return False
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment