@@ -31,6 +31,11 @@ def makedirs(path):
3131 os .makedirs (os .path .join (path , 'voice' ), exist_ok = True )
3232 os .makedirs (os .path .join (path , 'file' ), exist_ok = True )
3333 os .makedirs (os .path .join (path , 'avatar' ), exist_ok = True )
34+ file = './app/resources/data/file.png'
35+ if not os .path .exists (file ):
36+ resource_dir = getattr (sys , '_MEIPASS' , os .path .abspath (os .path .dirname (__file__ )))
37+ file = os .path .join (resource_dir , 'app' , 'resources' , 'data' ,'file.png' )
38+ shutil .copy (file , path + '/file/file.png' )
3439
3540
3641def escape_js_and_html (input_str ):
@@ -383,7 +388,6 @@ def file(self, doc, message):
383388 if self .output_type == Output .HTML :
384389 link = get_file (bytesExtra , thumb = True , output_path = origin_docx_path + '/file' )
385390 file_name = ''
386- shutil .copy (f"{ os .path .abspath ('.' )} /app/resources/icons/file.png" , origin_docx_path + '/file/file.png' )
387391 file_path = './file/file.png'
388392 if link != "" :
389393 file_name = os .path .basename (link )
@@ -544,16 +548,18 @@ def to_csv(self):
544548 def to_html_ (self ):
545549 origin_docx_path = f"{ os .path .abspath ('.' )} /data/聊天记录/{ self .contact .remark } "
546550 makedirs (origin_docx_path )
551+
547552 if self .contact .is_chatroom :
548553 packagemsg = PackageMsg ()
549554 messages = packagemsg .get_package_message_by_wxid (self .contact .wxid )
550555 else :
551556 messages = msg_db .get_messages (self .contact .wxid )
552557 filename = f"{ os .path .abspath ('.' )} /data/聊天记录/{ self .contact .remark } /{ self .contact .remark } .html"
553- file_path = './app/resources/template.html'
558+ file_path = './app/resources/data/ template.html'
554559 if not os .path .exists (file_path ):
555560 resource_dir = getattr (sys , '_MEIPASS' , os .path .abspath (os .path .dirname (__file__ )))
556- file_path = os .path .join (resource_dir , 'app' , 'resources' , 'template.html' )
561+ file_path = os .path .join (resource_dir , 'app' , 'resources' , 'data' ,'template.html' )
562+
557563 with open (file_path , "r" , encoding = "utf-8" ) as f :
558564 content = f .read ()
559565 html_head , html_end = content .split ('/*注意看这是分割线*/' )
@@ -688,7 +694,8 @@ def run(self):
688694 for message in messages :
689695 str_content = message [7 ]
690696 try :
691- emoji_path = get_emoji (str_content , thumb = True , output_path = origin_docx_path + '/emoji' )
697+ pass
698+ # emoji_path = get_emoji(str_content, thumb=True, output_path=origin_docx_path + '/emoji')
692699 except :
693700 logger .error (traceback .format_exc ())
694701 finally :
0 commit comments