Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Enable logging using option -o <log file>.

 * Modify zero padding code.
  • Loading branch information...
commit 1346f6ebcfe420f32f9578979ff547cc57594ab9 1 parent 331fea6
@suksit authored
Showing with 11 additions and 7 deletions.
  1. +11 −7 onemanga
View
18 onemanga
@@ -35,11 +35,11 @@ function progressbar() {
echo "]"
}
-while getopts ":c:dl" op; do
+while getopts ":c:dlo:" op; do
case $op in
c)
CHAPTER=1
- CHAPTER_ARG=$OPTARG
+ CHAPTER_ARG="$OPTARG"
;;
d)
USE_DIR=1
@@ -47,6 +47,9 @@ while getopts ":c:dl" op; do
l)
LATEST=1
;;
+ o)
+ log="$base_dir/$OPTARG"
+ ;;
\?)
echo "unknown option: -$OPTARG" >&2
ERROR=1
@@ -176,15 +179,16 @@ for manga_name in "$@"; do
done
if [[ $chapter -ne 0 && ${#chapter} -lt 3 ]]; then
- for j in `eval echo {${#chapter}..2}`; do
- chapter="0${chapter}"
- done
+ chapter=`echoes "0" ${#chapter} 2`$chapter
fi
cbr_file_name="${manga_name}_${chapter}.cbr"
echo -ne "\r\e[0K`progressbar $i $total` (packing files...)"
- zip -q $cbr_file_name *.jpg && rm -f *.jpg tmp_*
- echo -e "\r\e[0K`progressbar $i $total` ($cbr_file_name)"
+ if zip -q $cbr_file_name *.jpg; then
+ rm -f *.jpg tmp_*
+ echo -e "\r\e[0K`progressbar $i $total` ($cbr_file_name)"
+ [[ -n $log ]] && echo "[`date +%c`] $cbr_file_name" >> $log
+ fi
done
done
Please sign in to comment.
Something went wrong with that request. Please try again.