add scripts

This commit is contained in:
Andrey Kuvshinov
2020-04-23 14:42:01 +03:00
parent 749a0b316f
commit 9dbe78fae1
5 changed files with 37 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
<?php
ini_set('display_errors','off');
ini_set('display_errors','on');
error_reporting(E_ALL);
if (isset($_SERVER['HTTP_HOST']))
@@ -12,6 +12,7 @@ else
define('SITEPATH', dirname(__FILE__));
define('PDFDIR', '/vhosts/anpdf/app/pub/files/pdf/');
define('API', 'http://api.argumenti.ru/');
db_config('argumentiru', 'mysql:host=mysql;dbname=argumentiru', 'newser', 'Chjk90yuiREY');
db_config('reader', 'mysql:host=mysql;dbname=argumentiru', 'reader', 'ghjyjkUIOhg56Fh');

View File

@@ -8,5 +8,5 @@ require 'routes/price.php';
_kuri();
function index_kuri(){
return anpromo_kuri(1);
return text_kuri(1);
}

View File

@@ -72,6 +72,20 @@ function read_kuri($hash, $page = 1, $scale = 1.5, $promo = false){
include ('anpdf2.phtml');
}
function text_kuri(){
$id = 659286;
$news = file_get_contents(API.'id/'.$id);
print_r($news);
//view( 'views/antext.phtml',['news'=> $news] );
}

Binary file not shown.

19
scripts/splitpdf.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
WORKDIR=~/arlemp/vhosts/anpdf/app/pub/files
PDFDIR=$WORKDIR/pdf
OUTDIR=$WORKDIR/pages
cd $PDFDIR
for file in *.pdf;
do
name="${file%.pdf}"
PGEDIR="$OUTDIR/$name"
if [ ! -d "$PGEDIR" ]; then
mkdir -p $PGEDIR
docker run --name pdftk -it --rm --user $(id -u):$(id -g) -v "$WORKDIR:/workdir$WORKDIR" -w "/workdir$WORKDIR" masterforweb/pdftk pdftk "pdf/$file" burst output "pages/${name}/${name}-%02d.pdf";
fi
done