lundi 18 mars 2019

#zip2cbz #rar2cbr #cbz2zip #cbr2rar #pdf

CBxThumbnails(lister) plugin for total commander

Plugins / Thunar-thumbnailers

$ sudo aptitude install unar unzip zip

Transformation d'archives en Comic Books :

cd /d %~dp0
ren *.zip *.cbz
ren *.rar *.cbr

Transformation de Comic books en archives :

cd /d %~dp0
ren *.cbz *.zip
ren *.cbr *.rar

ou éditer le fichier 'cbr2cbz.sh'

#!/bin/bash
# Author: Alon Ivtsan
# License: GPL3+

for FILE in *{.cbr,.CBR}
do
[ -e "$FILE" ] || continue
echo Converting $FILE to cbz format.
DIR="${FILE%.*}"
mkdir "$DIR";
unar ./"$FILE" -o "$DIR";
zip -r "$DIR".cbz "$DIR";
rm -r "$DIR";
#Remove or comment out this line if you want to keep cbr files
#rm "$FILE";
echo Conversion of $FILE successful!
done 
---

for dir in `ls`; do zip $dir $dir/*; mv $dir*zip $dir.cbz; done

---
#!/bin/bash
find toplevel/comics -type d -not -empty -print0 | while IFS= read -r -d '' dir; do
if find "$dir" -maxdepth 1 -type f | read f; then
zip toplevel/cbz/"$(basename "$dir").cbz" "$dir"/*
fi
done

Convertir une liste de répertoires manga en archives de bandes dessinées

Supposons que vous ayez une liste de répertoires manga, c’est-à-dire des dossiers avec des images dont le nom est un numéro. Bien que des applications telles que MComix puissent lire de tels répertoires sans aucun problème, vous pourriez avoir envie de créer une archive de bandes dessinées appropriée à l'aide de ces images. Voici ce que je fais pour convertir ces répertoires en fichiers cbz.


1. Tout d'abord, je crée des fichiers zip séparés pour chaque répertoire de manga à l'aide du script suivant (disons zip.sh).

for dir in *
do
 base=$(basename "$dir")
 echo zip -j "${base}.zip" "$dir/*" >> zipcmd.sh 
done

Ce script crée un fichier appelé « zipcmd.sh » qui répertorie les commandes zip pour chaque fichier sur une ligne distincte. J'ouvre ce fichier et supprime la dernière ligne (c'est une anomalie qui tente de convertir zip.sh en fichier zip). Ensuite, je lance ce fichier pour créer les fichiers zip nécessaires.

$ sh zipcmd.sh 
Il crée des fichiers zip avec des images copiées à la racine du fichier zip.

2. Ensuite, je renomme tous les fichiers zip en .cbz en utilisant la commande suivante

$ rename .zip .cbz *.zip

3. Je peux maintenant déplacer tous les fichiers cbz (archives de bandes dessinées) dans un répertoire distinct, afin de pouvoir nettoyer les répertoires intermédiaires que j'ai utilisés pour créer le fichier cbz.

$ mkdir mycbz
$ mv * .cbz mycbz 

Vous pouvez utiliser MComix ou votre application de lecture de bande dessinée préférée pour lire les archives.

Autres :

Editer un fichier 'mass-rename' en le rendant éxécutable :
#!/bin/bash
cd "$1"
for f in *.$2; do 
mv -- "$f" "${f%.$2}.$3"
done
Utilisation :
mass-rename   
Exemple :
mass-rename ~/bureau/webcomics zip cbz

---

Script 'cbr2cbz.bat' pour Window$ 32bits :

"%programfiles(x86)%\WinRAR\WinRAR.exe" cv -y -afzip "*.cbr" 
ren *.zip *.cbz 
md old 
move *.cbr old 

---

Javascript :

---

Comment créer des documents portables avec CBZ et DjVu

---
---

Convertir un PDF en Comic Book :

Editer un fichier 'pdf2cbz.sh' :
#!/bin/sh
#
# pdf2cbr.sh: Converts PDF files to CBZ (comic books)
# Parameters: ideally only the PDF filename ( as $1 )
# Requires "ImageMagick Convert", ZIP and PDFTK
# Ver 0.2
# Original By TaTooKa, Kindle CBZ by MrEHQE 2012 
# http://blog.tatooka.com.ar

echo "Creating PDF directory..."
mkdir $1_pages
cd $1_pages
echo "Splitting PDF file into individual PDFs... (This might take a while)"
pdftk ../$1 burst
# Removing PDFTK report
if [ -e doc_data.txt ]
then
rm -f doc_data.txt
fi
PAGE_COUNT=`ls | wc -l`
echo "$PAGE_COUNT PDFs generated."
echo "Converting each PDF page to JPG..."
for file in *.pdf
do
convert $file $file.jpg
mogrify -resize 800  -type grayscale -depth 4 -ordered-dither o16x16 -monitor -quality 75 *.jpg
rm -f $file
echo "page done"
done
# remove ".pdf" from filenames
for file in *.jpg
do
mv $file ${file%pdf.*}jpg
done
echo "Creating ZIP file..."
zip $1.zip *.jpg
echo "Renaming ZIP to CBR format..."
mv $1.zip ../$1.cbz
echo "Removing used directory and remaining garbage..."
cd ..
rm -Rf $1_pages
if [ -e $1.cbz ]
then
echo "File $1.cbz generated."
fi
echo "All Done !"

Le rendre exécutable :
$ sudo chmod +x pdf2cbz.sh
Utilisation :

./pdf2cbz.sh destination.pdf

Editer un fichier 'pdf2cbzdir.sh' :
#!/bin/sh
for f in *.pdf
do ./pdf2cbz.sh "$f"
done
Le rendre exécutable :
sudo chmod +x pdf2cbzdir.sh

---
Editer un fichier 'cbr3cbz-rar-to-zip-conversion.sh' :

#!/bin/bash
#Source: http://comicrack.cyolito.com/forum/13-scripts/30013-cbr3cbz-rar-to-zip-conversion-for-linux
echo "Converting CBRs to CBZs"

# Set the "field separator" to something other than spaces/newlines" so that spaces
# in the file names don't mess things up. I'm using the pipe symbol ("|") as it is very
# unlikely to appear in a file name.
IFS="|"

# Set working directory where to create the temp dir. The user you are using must have permission
# to write into this directory.
# For performance reasons I'm using ram disk (/dev/shm/) in Ubuntu server.
WORKDIR="/dev/shm/"

# Set name for the temp dir. This directory will be created under WORDDIR
TEMPDIR="cbr2cbz"

# The script should be invoked as "cbr2cbz {directory}", where "{directory}" is the
# top-level directory to be searched. Just to be paranoid, if no directory is specified,
# then default to the current working directory ("."). Let's put the name of the
# directory into a shell variable called SOURCEDIR.
# Note: "$1" = "The first command line argument"
if test -z "$1"; then
SOURCEDIR=`pwd`
else
SOURCEDIR="$1"
fi

echo "Working from directory $SOURCEDIR"

# We need an empty directory to work in, so we'll create a temp directory here
cd "$WORKDIR"
mkdir "$TEMPDIR"
# and step into it
cd "$TEMPDIR"

# Now, execute a loop, based on a "find" command in the specified directory. The
# "-printf "$p|" will cause the file names to be separated by the pipe symbol, rather than
# the default newline. Note the backtics ("`") (the key above the tab key on US
# keyboards).
for CBRFILE in `find "$SOURCEDIR" -name "*.cbr" -printf "%p|while read line; do

# Now for the actual work. First, extract the base file name (without the extension)
# using the "basename" command. Warning: more backtics.
BASENAME=`basename $CBRFILE ".cbr"`

# And the directory path for that file, so we know where to put the finished ".cbz"
# file.
DIRNAME=`dirname $CBRFILE`

# Now, build the "new" file name,
NEWNAME="$BASENAME.cbz"

# We use RAR file's name to create folder for unpacked files
echo "Processing $CBRFILE"
mkdir "$BASENAME"
# and unpack the rar file into it
7z x "$CBRFILE" -O"$BASENAME"
cd "$BASENAME"

# Lets ensure the permissions allow us to pack everything
sudo chmod 777 -R ./*

# Put all the extracted files into new ".cbz" file
7z a -tzip -mx=9 "$NEWNAME" *

# And move it to the directory where we found the original ".cbr" file
mv "$NEWNAME" $DIRNAME/"$NEWNAME"

# Finally, "cd" back to the original working directory, and delete the temp directory
# created earlier.
cd ..
rm -r "$BASENAME"

# Delete the RAR file also
rm "$CBRFILE"

done

# At the end we cleanup by removing the temp folder from ram disk
cd ..
echo "Conversion Done"
rm -r "$TEMPDIR"
Le rendre exécutable :
sudo chmod +x cbr3cbz-rar-to-zip-conversion.sh

---


comicthumb - Thumbnailer for cbz, cbr and cbt archives.

comicthumb FILE THUMBNAIL [SIZE]
comicthumb creates thumbnails for x-cbz, x-cbr and x-cbt files.  It is usually registered in gconf (if available) and is then used automatically by some file managers (e.g. Nautilus or Thunar).

---

CbxManager : script Python de conversion d’images en CBZ


---


Aucun commentaire:

Enregistrer un commentaire