From a0fafa132e69409474612b846d6919b8646691f8 Mon Sep 17 00:00:00 2001 From: josch Date: Thu, 26 Jun 2014 10:37:09 +0200 Subject: [PATCH] initial commit --- readersplanet-dl.sh | 21 ++++++++++++++ test/find-atlan.py | 13 +++++++++ test/find-centauri.py | 13 +++++++++ ...ind-diegrößtesciencefictionseriederwelt.py | 14 +++++++++ test/find-duplicates.py | 23 +++++++++++++++ test/find-negasphäre.py | 14 +++++++++ test/find-perry.py | 13 +++++++++ test/find-terranova.py | 13 +++++++++ test/script.sh | 11 +++++++ test/script2.sh | 29 +++++++++++++++++++ 10 files changed, 164 insertions(+) create mode 100755 readersplanet-dl.sh create mode 100644 test/find-atlan.py create mode 100644 test/find-centauri.py create mode 100644 test/find-diegrößtesciencefictionseriederwelt.py create mode 100644 test/find-duplicates.py create mode 100644 test/find-negasphäre.py create mode 100644 test/find-perry.py create mode 100644 test/find-terranova.py create mode 100644 test/script.sh create mode 100755 test/script2.sh diff --git a/readersplanet-dl.sh b/readersplanet-dl.sh new file mode 100755 index 0000000..95de097 --- /dev/null +++ b/readersplanet-dl.sh @@ -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 diff --git a/test/find-atlan.py b/test/find-atlan.py new file mode 100644 index 0000000..7674d81 --- /dev/null +++ b/test/find-atlan.py @@ -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) diff --git a/test/find-centauri.py b/test/find-centauri.py new file mode 100644 index 0000000..5d48595 --- /dev/null +++ b/test/find-centauri.py @@ -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) diff --git a/test/find-diegrößtesciencefictionseriederwelt.py b/test/find-diegrößtesciencefictionseriederwelt.py new file mode 100644 index 0000000..01f8091 --- /dev/null +++ b/test/find-diegrößtesciencefictionseriederwelt.py @@ -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) diff --git a/test/find-duplicates.py b/test/find-duplicates.py new file mode 100644 index 0000000..3e12597 --- /dev/null +++ b/test/find-duplicates.py @@ -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 + diff --git a/test/find-negasphäre.py b/test/find-negasphäre.py new file mode 100644 index 0000000..126de27 --- /dev/null +++ b/test/find-negasphäre.py @@ -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) diff --git a/test/find-perry.py b/test/find-perry.py new file mode 100644 index 0000000..3873533 --- /dev/null +++ b/test/find-perry.py @@ -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) diff --git a/test/find-terranova.py b/test/find-terranova.py new file mode 100644 index 0000000..06401de --- /dev/null +++ b/test/find-terranova.py @@ -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) diff --git a/test/script.sh b/test/script.sh new file mode 100644 index 0000000..df78f8e --- /dev/null +++ b/test/script.sh @@ -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 diff --git a/test/script2.sh b/test/script2.sh new file mode 100755 index 0000000..ac73b01 --- /dev/null +++ b/test/script2.sh @@ -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