[DEV] book cropping
This commit is contained in:
parent
db98da63f4
commit
34cc5b1dd8
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
export DISPLAY=:0
|
export DISPLAY=:0
|
||||||
feh --randomize --bg-fill /home/edupin/.config/awesome/background/* >> /home/edupin/aaaaaaaa_last_update_wallpaper.txt
|
feh --randomize --bg-fill /home/edupin/.config/awesome/background/* >> /home/edupin/aaaaaaaa_last_update_wallpaper.txt
|
||||||
|
#feh --randomize --bg-fill /home/heero/.config/awesome/background/*
|
||||||
|
|
||||||
# crontab -e
|
# crontab -e
|
||||||
# ou edn /var/spool/cron/edupin
|
# ou edn /var/spool/cron/edupin
|
||||||
|
33
.bin/book_1_remove_black_border.sh
Executable file
33
.bin/book_1_remove_black_border.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# user input
|
||||||
|
MAXLEN=1200
|
||||||
|
DESTINATION_DIR="WorkInProgress"
|
||||||
|
|
||||||
|
nb_elem=0
|
||||||
|
for i in *.JPG; do
|
||||||
|
nb_elem=`expr $nb_elem + 1`
|
||||||
|
done
|
||||||
|
echo "number of element: $nb_elem"
|
||||||
|
|
||||||
|
idelem=0
|
||||||
|
idcover=0
|
||||||
|
zero=0
|
||||||
|
|
||||||
|
[ -d $DESTINATION_DIR ] || mkdir $DESTINATION_DIR
|
||||||
|
for iii in *.JPG; do
|
||||||
|
echo "element $iii"
|
||||||
|
if [ -e $iii ] ; then
|
||||||
|
if [ $idcover -eq $zero ] ; then
|
||||||
|
idcover=1
|
||||||
|
echo "#egami-cutter file (" $idelem "/" $nb_elem "): " $iii " ==> " $DESTINATION_DIR/cover.png
|
||||||
|
egami-cutter -i=$iii -o=$DESTINATION_DIR/cover.png
|
||||||
|
else
|
||||||
|
idelem=`expr $idelem + 1`
|
||||||
|
echo "#egami-cutter file (" $idelem "/" $nb_elem "): " $iii " ==> " $DESTINATION_DIR/page_$idelem.png
|
||||||
|
egami-cutter -i=$iii -o=$DESTINATION_DIR/page_$idelem.png
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
34
.bin/book_2_rotate_right.sh
Executable file
34
.bin/book_2_rotate_right.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# user input
|
||||||
|
MAXLEN=1200
|
||||||
|
SOURCE_DIR="WorkInProgress"
|
||||||
|
DESTINATION_DIR="WorkInProgress_2"
|
||||||
|
|
||||||
|
nb_elem=0
|
||||||
|
for i in $SOURCE_DIR/*.png; do
|
||||||
|
nb_elem=`expr $nb_elem + 1`
|
||||||
|
done
|
||||||
|
|
||||||
|
idelem=0
|
||||||
|
|
||||||
|
if [ -d $SOURCE_DIR ] ; then
|
||||||
|
echo "WIP exist ==> continue"
|
||||||
|
else
|
||||||
|
echo "WIP does not exist ==> break"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -d $DESTINATION_DIR ] || mkdir $DESTINATION_DIR
|
||||||
|
|
||||||
|
cd $SOURCE_DIR
|
||||||
|
for iii in *.png; do
|
||||||
|
if [ -e $iii ] ; then
|
||||||
|
idelem=`expr $idelem + 1`
|
||||||
|
echo "#rotate file (" $idelem "/" $nb_elem "): " $SOURCE_DIR/$iii " ==> " $DESTINATION_DIR/$iii
|
||||||
|
convert $iii -rotate 90 ../$DESTINATION_DIR/$iii
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
34
.bin/book_3_reduce_size.sh
Executable file
34
.bin/book_3_reduce_size.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# user input
|
||||||
|
MAXLEN=1700
|
||||||
|
SOURCE_DIR="WorkInProgress_2"
|
||||||
|
DESTINATION_DIR="WorkInProgress_3"
|
||||||
|
|
||||||
|
nb_elem=0
|
||||||
|
for i in $SOURCE_DIR/*png; do
|
||||||
|
nb_elem=`expr $nb_elem + 1`
|
||||||
|
done
|
||||||
|
|
||||||
|
idelem=0
|
||||||
|
|
||||||
|
if [ -d $SOURCE_DIR ] ; then
|
||||||
|
echo "WIP exist ==> continue"
|
||||||
|
else
|
||||||
|
echo "WIP does not exist ==> break"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -d $DESTINATION_DIR ] || mkdir $DESTINATION_DIR
|
||||||
|
|
||||||
|
cd $SOURCE_DIR
|
||||||
|
for iii in *.png; do
|
||||||
|
if [ -e $iii ] ; then
|
||||||
|
idelem=`expr $idelem + 1`
|
||||||
|
echo "#resize file (" $idelem "/" $nb_elem "): " $SOURCE_DIR/$iii " ==> " $DESTINATION_DIR/${iii::-4}.jpg
|
||||||
|
convert $iii -resize ${MAXLEN}x${MAXLEN} ../$DESTINATION_DIR/${iii::-4}.jpg
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
34
.bin/book_4_correct_brigthness.sh
Executable file
34
.bin/book_4_correct_brigthness.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# user input
|
||||||
|
MAXLEN=1700
|
||||||
|
SOURCE_DIR="WorkInProgress_3"
|
||||||
|
DESTINATION_DIR="WorkInProgress_4"
|
||||||
|
|
||||||
|
nb_elem=0
|
||||||
|
for i in $SOURCE_DIR/*jpg; do
|
||||||
|
nb_elem=`expr $nb_elem + 1`
|
||||||
|
done
|
||||||
|
|
||||||
|
idelem=0
|
||||||
|
|
||||||
|
if [ -d $SOURCE_DIR ] ; then
|
||||||
|
echo "WIP exist ==> continue"
|
||||||
|
else
|
||||||
|
echo "WIP does not exist ==> break"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -d $DESTINATION_DIR ] || mkdir $DESTINATION_DIR
|
||||||
|
|
||||||
|
cd $SOURCE_DIR
|
||||||
|
for iii in *.jpg; do
|
||||||
|
if [ -e $iii ] ; then
|
||||||
|
idelem=`expr $idelem + 1`
|
||||||
|
echo "#brightness file (" $idelem "/" $nb_elem "): " $SOURCE_DIR/$iii " ==> " $DESTINATION_DIR/$iii
|
||||||
|
convert $iii -brightness-contrast 30x45 ../$DESTINATION_DIR/$iii
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
15
.bin/downloadEpub.sh
Executable file
15
.bin/downloadEpub.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Download all epub of www.feedbooks.com/book/xxx.epub"
|
||||||
|
#for iii in {0..5000}
|
||||||
|
#do
|
||||||
|
# echo "* File : "$iii
|
||||||
|
# #wget --content-disposition -t 1 --timeout=5 www.feedbooks.com/book/$iii.epub
|
||||||
|
#done
|
||||||
|
|
||||||
|
for iii in {2961..0}
|
||||||
|
do
|
||||||
|
echo "* File : "$iii
|
||||||
|
wget --content-disposition -t 1 --timeout=5 www.ebooksgratuits.com/newsendbook.php?id=$iii\&format=epub
|
||||||
|
done
|
||||||
|
|
64
.bin/renameGroup.py
Executable file
64
.bin/renameGroup.py
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
import os
|
||||||
|
import fnmatch
|
||||||
|
import glob
|
||||||
|
|
||||||
|
print("Start rename group ...")
|
||||||
|
|
||||||
|
def extract_id(value):
|
||||||
|
id = ""
|
||||||
|
for elem in value:
|
||||||
|
if elem == '0' \
|
||||||
|
or elem == '1' \
|
||||||
|
or elem == '2' \
|
||||||
|
or elem == '3' \
|
||||||
|
or elem == '4' \
|
||||||
|
or elem == '5' \
|
||||||
|
or elem == '6' \
|
||||||
|
or elem == '7' \
|
||||||
|
or elem == '8' \
|
||||||
|
or elem == '9':
|
||||||
|
id += elem
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
return int(id)
|
||||||
|
base_name = "Trollhunters.S01E"
|
||||||
|
out_name = "Troll hunters-s01-e"
|
||||||
|
files = glob.glob(base_name + "*")
|
||||||
|
max = 0
|
||||||
|
for file in files:
|
||||||
|
id = extract_id(file[len(base_name):])
|
||||||
|
if id > max:
|
||||||
|
max = id
|
||||||
|
|
||||||
|
print("number of Element: " + str(max))
|
||||||
|
|
||||||
|
nb_char = 1
|
||||||
|
if max>99999:
|
||||||
|
nb_char = 6
|
||||||
|
elif max>9999:
|
||||||
|
nb_char = 5
|
||||||
|
elif max>999:
|
||||||
|
nb_char = 4
|
||||||
|
elif max>99:
|
||||||
|
nb_char = 3
|
||||||
|
elif max>9:
|
||||||
|
nb_char = 2
|
||||||
|
|
||||||
|
def get_id(id):
|
||||||
|
val = str(id)
|
||||||
|
while len(val)<nb_char:
|
||||||
|
val = "0" + val
|
||||||
|
return val
|
||||||
|
|
||||||
|
for file in files:
|
||||||
|
#print("file: " + file)
|
||||||
|
id = extract_id(file[len(base_name):])
|
||||||
|
#print(" id " + get_id(id))
|
||||||
|
outfile = out_name + get_id(id) + "-.mkv"
|
||||||
|
#exit(-1)
|
||||||
|
if file != outfile:
|
||||||
|
print("rename " + file + " ==> " + outfile)
|
||||||
|
os.rename(file, outfile)
|
||||||
|
|
||||||
|
exit(0)
|
Loading…
x
Reference in New Issue
Block a user