From 7c46bb4b636e2d2fa5518ab5f447c43c6ebdbcf3 Mon Sep 17 00:00:00 2001 From: zvezdochiot Date: Wed, 25 Jul 2018 17:50:10 +0300 Subject: [PATCH] 0.20180725 fb2xmlfix --- CHANGELOG | 4 +++ VERSION | 2 +- man/man1/fb2encode.1 | 3 ++- man/man1/fb2totxt.1 | 3 ++- man/man1/fb2tozip.1 | 3 ++- man/man1/fb2xmlfix.1 | 36 +++++++++++++++++++++++++++ scripts/fb2encode.sh | 2 +- scripts/fb2totxt.sh | 2 +- scripts/fb2tozip.sh | 4 +-- scripts/fb2xmlfix.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++ 10 files changed, 109 insertions(+), 8 deletions(-) create mode 100644 man/man1/fb2xmlfix.1 create mode 100755 scripts/fb2xmlfix.sh diff --git a/CHANGELOG b/CHANGELOG index c0e3eb9..f79b7d8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ Console FB2 reader https://github.com/zvezdochiot/bash-fb2 +0.20180725 + + fb2xmlfix + 0.20180717 fb2encode, fb2tozip diff --git a/VERSION b/VERSION index a5ef47b..bc85b61 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.20180717 +0.20180725 diff --git a/man/man1/fb2encode.1 b/man/man1/fb2encode.1 index 92dfd37..1b2f904 100644 --- a/man/man1/fb2encode.1 +++ b/man/man1/fb2encode.1 @@ -1,4 +1,4 @@ -.TH "FB2totxt User Manual" 0.20180717 "17 Jul 2018" "User documentation" +.TH "FB2totxt User Manual" 0.20180725 "25 Jul 2018" "User documentation" .SH NAME fb2encode @@ -31,6 +31,7 @@ help .SH SEE ALSO fb2totxt, fb2tozip, + fb2tofix, grep, sed, iconv diff --git a/man/man1/fb2totxt.1 b/man/man1/fb2totxt.1 index fa76f6e..2c7af5e 100644 --- a/man/man1/fb2totxt.1 +++ b/man/man1/fb2totxt.1 @@ -1,4 +1,4 @@ -.TH "FB2totxt User Manual" 0.20180717 "17 Jul 2018" "User documentation" +.TH "FB2totxt User Manual" 0.20180725 "25 Jul 2018" "User documentation" .SH NAME fb2totxt @@ -33,6 +33,7 @@ help .SH SEE ALSO fb2encode, fb2tozip, + fb2xmlfix, sed, file, less, diff --git a/man/man1/fb2tozip.1 b/man/man1/fb2tozip.1 index 26874c0..8aa4bef 100644 --- a/man/man1/fb2tozip.1 +++ b/man/man1/fb2tozip.1 @@ -1,4 +1,4 @@ -.TH "FB2totxt User Manual" 0.20180717 "17 Jul 2018" "User documentation" +.TH "FB2totxt User Manual" 0.20180725 "25 Jul 2018" "User documentation" .SH NAME fb2tozip @@ -31,6 +31,7 @@ help .SH SEE ALSO fb2encode, fb2totxt, + fb2xmlfix, unzip, zip diff --git a/man/man1/fb2xmlfix.1 b/man/man1/fb2xmlfix.1 new file mode 100644 index 0000000..4ac23e7 --- /dev/null +++ b/man/man1/fb2xmlfix.1 @@ -0,0 +1,36 @@ +.TH "FB2totxt User Manual" 0.20180725 "25 Jul 2018" "User documentation" + +.SH NAME +fb2xmlfix + +.SH DESCRIPTION +Bash-script for console FB2 fix + +.SH SYNOPSIS +fb2xmlfix [options] book.fb2 + +.SH OPTIONS +.TP +-o str +name fix book (default = source.fb2) +.TP +-h +help + +.SH EXAMPLE + fb2xmlfix youbook.fb2 + fb2xmlfix -o youbook-fix.fb2 youbook.fb2 + +.SH COPYRIGHT + Copyright 2018 zvezdochiot. + All rights reserved. + +.SH SEE ALSO + fb2encode, + fb2totxt, + fb2tozip, + xmlstarlet + +.SH CONTACTS + Website: https://github.com/zvezdochiot/bash-fb2 + Email: zvezdochiot@users.sourceforge.net diff --git a/scripts/fb2encode.sh b/scripts/fb2encode.sh index 793ad5a..98dab30 100755 --- a/scripts/fb2encode.sh +++ b/scripts/fb2encode.sh @@ -4,7 +4,7 @@ #Depends: dash, grep, sed, iconv sname="Fb2Encode" -sversion="0.20180716" +sversion="0.20180725" echo "$sname $sversion" >&2 diff --git a/scripts/fb2totxt.sh b/scripts/fb2totxt.sh index d0aebe4..86b82d7 100755 --- a/scripts/fb2totxt.sh +++ b/scripts/fb2totxt.sh @@ -4,7 +4,7 @@ #Depends: dash, sed, file, less, unzip, zcat sname="Fb2totxt" -sversion="0.20180702" +sversion="0.20180725" echo "$sname $sversion" >&2 diff --git a/scripts/fb2tozip.sh b/scripts/fb2tozip.sh index c4d1b8c..6a23e97 100755 --- a/scripts/fb2tozip.sh +++ b/scripts/fb2tozip.sh @@ -1,10 +1,10 @@ #!/bin/bash #fb2tozip.sh -#Depends: dash, 7z +#Depends: dash, zip, unzip sname="Fb2toZip" -sversion="0.20180716" +sversion="0.20180725" echo "$sname $sversion" >&2 diff --git a/scripts/fb2xmlfix.sh b/scripts/fb2xmlfix.sh new file mode 100755 index 0000000..a1cb257 --- /dev/null +++ b/scripts/fb2xmlfix.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +#fb2encode.sh +#Depends: dash, xmlstarlet + +sname="Fb2XMLFix" +sversion="0.20180725" + +echo "$sname $sversion" >&2 + +tnocomp="" +tcomp="xmlstarlet" +[ ! "$(command -v $tcomp)" ] && tnocomp="$tnocomp $tcomp" +if [ "+$tnocomp" != "+" ] +then + echo "Not found:${tnocomp}!" >&2 + echo "" >&2 + exit 1 +fi + +fhlp="false" +while getopts ":o:h" opt +do + case $opt in + o) dst="$OPTARG" + ;; + h) fhlp="true" + ;; + *) echo "Unknown option -$OPTARG" >&2 + exit 1 + ;; + esac +done +shift "$(($OPTIND - 1))" +src="$1"; + +if [ "x$src" = "x" -o "x$fhlp" = "xtrue" ] +then + echo "Usage:" + echo "$0 [options] book.fb2" + echo "Options:" + echo " -o name.fb2 name fix book (default = source file)" + echo " -h help" + exit 0 +fi + +if [ "x$dst" = "x" ] +then + dst="$src" +fi + +if [ -f "$src" ] +then + xmlstarlet fo -R -Q "$src" > "$src.verify.xml" + mv -fv "$src.verify.xml" "$dst" +else + echo "$src not fb2 file!" >&2 +fi