initial commit

This commit is contained in:
josch 2014-06-26 10:37:09 +02:00
commit a0fafa132e
10 changed files with 164 additions and 0 deletions

21
readersplanet-dl.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
VAR=1511
while true; do
echo "$VAR"
curl --cookie "osCsid=8a497efe811cfd788283cb087ebd195d" "http://www.readerserver.de/download.php?aboload=true&id=$VAR" > $VAR.pdf
if [ `file --brief --mime-type $VAR.pdf` != "application/pdf" ]; then
echo "no pdf"
#exit
fi
VAR=$(($VAR+1))
done
#osCsid=Host: .www.readerserver.de
#Name: osCsid
#Value: 8a497efe811cfd788283cb087ebd195d
#Path: /
#Secure: No
#Expires: At the end of the session

13
test/find-atlan.py Normal file
View file

@ -0,0 +1,13 @@
#!/bin/env python
import os
for root, dirs, files in os.walk('txt'):
for filename in files:
oldpath = os.path.join(root, filename)
f = open(oldpath)
firstline = f.readline()
f.close()
if firstline.startswith("ATLAN") or firstline.startswith("\fATLAN"):
newpath = os.path.join("atlan", filename)
os.rename(oldpath, newpath)

13
test/find-centauri.py Normal file
View file

@ -0,0 +1,13 @@
#!/bin/env python
import os
for root, dirs, files in os.walk('txt'):
for filename in files:
oldpath = os.path.join(root, filename)
f = open(oldpath)
firstline = f.readline()
f.close()
if firstline.startswith("\fCentauri-Zyklus"):
newpath = os.path.join("centauri", filename)
os.rename(oldpath, newpath)

View file

@ -0,0 +1,14 @@
#!/bin/env python
# -*- coding: utf-8 -*-
import os
for root, dirs, files in os.walk('txt'):
for filename in files:
oldpath = os.path.join(root, filename)
f = open(oldpath)
firstline = f.readline()
f.close()
if firstline.startswith("\fD I E G R Ö S S T E S C I E N C E - F I C T I O N - S E R I E D E R W E L T"):
newpath = os.path.join("diegrößtesciencefictionseriederwelt2", filename)
os.rename(oldpath, newpath)

23
test/find-duplicates.py Normal file
View file

@ -0,0 +1,23 @@
#/bin/env python
from hashlib import md5
import os
# remove duplicates
filedict = dict()
for root, dirs, files in os.walk('.'):
for f in files:
path = os.path.join(root, f)
fo = open(path)
content = fo.read()
fo.close()
h = md5(content).hexdigest()
if filedict.get(h, None):
os.remove(path)
else:
filedict[h] = path
print filedict

14
test/find-negasphäre.py Normal file
View file

@ -0,0 +1,14 @@
#!/bin/env python
# -*- coding: utf-8 -*-
import os
for root, dirs, files in os.walk('txt'):
for filename in files:
oldpath = os.path.join(root, filename)
f = open(oldpath)
firstline = f.readline()
f.close()
if firstline.startswith("\fN e g a s p h ä r e"):
newpath = os.path.join("negasphäre", filename)
os.rename(oldpath, newpath)

13
test/find-perry.py Normal file
View file

@ -0,0 +1,13 @@
#!/bin/env python
import os
for root, dirs, files in os.walk('txt'):
for filename in files:
oldpath = os.path.join(root, filename)
f = open(oldpath)
firstline = f.readline()
f.close()
if firstline.startswith("\fNr. "):
newpath = os.path.join("perry", filename)
os.rename(oldpath, newpath)

13
test/find-terranova.py Normal file
View file

@ -0,0 +1,13 @@
#!/bin/env python
import os
for root, dirs, files in os.walk('txt'):
for filename in files:
oldpath = os.path.join(root, filename)
f = open(oldpath)
firstline = f.readline()
f.close()
if firstline.startswith("\fT E R R A N O V A"):
newpath = os.path.join("terranova", filename)
os.rename(oldpath, newpath)

11
test/script.sh Normal file
View file

@ -0,0 +1,11 @@
# for older ebooks:
# pdftoppm -f 4 -l 4 -r 220 -x 164 -y 242 -W 1490 -H 2166 -png pdf/528.pdf foo
pdftoppm -f 3 -r 190 -x 164 -y 278 -W 1490 -H 2130 -png pdf/528.pdf foo
mogrify -gamma 0.25 -resize 600x800! +dither -type Grayscale -colors 8 foo-*.png
pdftoppm -f 1 -l 1 -r 300 -png pdf/528.pdf foo
mogrify -resize 600x800 -type Grayscale foo-01.png
pdftoppm -f 2 -l 2 -r 300 -x 164 -y 278 -W 1490 -H 2130 -png pdf/528.pdf foo
mogrify -resize 600x800 -type Grayscale foo-02.png

29
test/script2.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
#time gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf 064\ -\ Clark\ Darlton\ -\ Perry\ Rhodan\ -\ 64\ -\ Im\ Zeit-Gefängnis.pdf
#root@192.168.111.1:/media/sd/PerryRhodan/Perry\\\ Rhodan\\\ -\\\ Romanzyklus\\\ -\\\ 0050-0099\\\ -\\\ Atlan\\\ und\\\ Arkon/
[ $# = 2 ] || { echo "usage: $0 input.pdf output.pdf"; exit 1; }
INPUT=$1
OUTPUT=$2
LEFT=0
TOP=-30
RIGHT=0
BOTTOM=-20
PART1=`mktemp`
PART2=`mktemp`
PART3=`mktemp`
PART4=`mktemp`
PART5=`mktemp`
pdftk $INPUT cat 1-3 output $PART1
pdfcrop $PART1 $PART3
pdftk $INPUT cat 4-end output $PART2
pdfcrop --margins "$LEFT $TOP $RIGHT $BOTTOM" --clip $PART2 $PART4
pdftk $PART3 $PART4 cat output $PART5
pdfcrop $PART5 "$OUTPUT"
rm $PART1 $PART2 $PART3 $PART4 $PART5