From df29b094da0f2349f23c28f3f3f98bfe0d056e6e Mon Sep 17 00:00:00 2001 From: gn64_jp Date: Sun, 2 Jun 2013 15:18:06 +0900 Subject: [PATCH] fix perl dependent file for Debian. --- etc_process.sh | 3 +++ index/pdf2xml.py | 5 +++-- www/pdfmanager.pl | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/etc_process.sh b/etc_process.sh index a00f162..df850ca 100644 --- a/etc_process.sh +++ b/etc_process.sh @@ -4,4 +4,7 @@ cp ./conf/libre10.conf /etc/libre10.conf chmod 644 /etc/libre10.conf python ./index/pdf2xml.py chmod -R 777 /var/lib/libre10 +mkdir /tmp/libre10 +chmod -R 777 /tmp/libre10 + diff --git a/index/pdf2xml.py b/index/pdf2xml.py index 8952451..5188877 100644 --- a/index/pdf2xml.py +++ b/index/pdf2xml.py @@ -143,8 +143,9 @@ for st in argvs[1:]: #rd=hashlib.sha224(os.path.splitext(st)[0]).hexdigest() #rd2=hashlib.sha224(os.path.abspath(st)).hexdigest() #rd = base64.b64encode(os.path.abspath(st))[] + filepath=os.path.abspath(st) rd = hashlib.md5() - rd.update(os.path.abspath(st)) + rd.update(filepath) rdl=rd.hexdigest() c = dbcon.cursor() c.execute(u"select count(*),changed from pdffile where id=?",(rdl,)) @@ -159,7 +160,7 @@ for st in argvs[1:]: print rdl print filecount if int(filecount)<1 or changed >0: - PDF2TEXT(st.decode("utf-8"),str(rdl)+".txt",rdl) + PDF2TEXT(filepath.decode("utf-8"),str(rdl)+".txt",rdl) c2 = dbcon.cursor() c2.execute(u"UPDATE pdffile SET changed=0 where id=?",(rdl,)) index_rebuild() diff --git a/www/pdfmanager.pl b/www/pdfmanager.pl index 1f20862..766ff06 100755 --- a/www/pdfmanager.pl +++ b/www/pdfmanager.pl @@ -9,7 +9,7 @@ use DBD::SQLite; use DBI; use Data::Dumper; use Encode 'decode'; -use File::Slurp; +use Perl6::Slurp; use YAML::XS; use URI::Escape; @@ -56,7 +56,7 @@ if ( $mode eq 'partpdf' ) { print "Content-Type: application/pdf\n"; print "Content-Length: $length\n"; print "\n"; - print read_file("$temppath.pdf"); + print slurp("$temppath.pdf"); exit; } elsif ( $mode eq 'showpagediff' ) { -- 2.11.0