dever 6 年之前
父節點
當前提交
f60d54d16f
共有 2 個文件被更改,包括 7 次插入9 次删除
  1. 2 2
      admin/page/site.py
  2. 5 7
      service/convert.py

+ 2 - 2
admin/page/site.py

@@ -64,8 +64,8 @@ class convert_path(Load):
 			,width = '600'
 			,height = '600'
 			,search = (('label-1','cdate-time-start','cdate-time-end','site_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'选择站点',u'文件名'))
-			,thead = (u'所属站点', u'文件名', u'访问路径', u'状态', u'更新时间')
-			,tbody = ('site', 'name', 'url', 'status', 'cdate')
+			,thead = (u'文件id',u'所属站点', u'文件名', u'访问路径', u'状态', u'更新时间')
+			,tbody = ('id','site', 'name', 'url', 'status', 'cdate')
 			,state = True
 		)
 		self.data['common']['search_site_id-select-'] = self.service('common').list('site')

+ 5 - 7
service/convert.py

@@ -4,8 +4,6 @@ from datetime import *
 import uuid
 import os
 import os.path
-import requests
-import shutil
 
 class Convert(object):
 
@@ -98,6 +96,7 @@ class Convert(object):
 
 	def download(self, file, local):
 		if 'http' in file:
+			import requests
 			r = requests.get(file, stream=True)
 			with open(local, 'wb') as up:
 				for chunk in r.iter_content(chunk_size=1024):
@@ -105,6 +104,7 @@ class Convert(object):
 						up.write(chunk)
 
 		else:
+			import shutil
 			shutil.copyfile(file, local)
 
 		if File.exists(local):
@@ -116,7 +116,7 @@ class Convert(object):
 		convert = convert + 'libreoffice  --invisible --convert-to pdf ' + info['local']
 		convert = convert + ' && '
 		convert = convert + 'pdf2htmlEX --zoom 1.3 --no-drm 1 --split-pages 1 '
-		convert = convert + '--embed-css 1  --embed-javascript 0 --embed-image 0 --embed-font 1 '
+		convert = convert + '--embed-css 1  --embed-javascript 0 --embed-image 0 --embed-font 1 --process-outline 0 '
 		convert = convert + '--embed-external-font 0 --dest-dir '+info['path']+' --page-filename %d.page ' + info['pdf']
 
 		return convert
@@ -145,19 +145,17 @@ class Convert(object):
 			model.id = id
 			update = {}
 			update['status'] = 2
-			#model.update(update)
+			model.update(update)
 
 			if not File.exists(info['local']):
 				self.download(info['file'], info['local'])
 
 			if not File.exists(info['html']):
 				handle = self.command(info)
-				print handle
-				return
 				Shell.popen(handle)
 				if File.exists(info['html']):
 
-					self.string_switch(info['html'], "taste", "tasting")
+					#self.string_switch(info['html'], "taste", "tasting")
 					# 获取有多少页
 					page = self.total(info['path'])
 					model.id = id