Skip to content

Commit

Permalink
0.20180725
Browse files Browse the repository at this point in the history
fb2xmlfix
  • Loading branch information
zvezdochiot committed Jul 25, 2018
1 parent 6d0b383 commit 7c46bb4
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Console FB2 reader
https://github.com/zvezdochiot/bash-fb2

0.20180725

fb2xmlfix

0.20180717

fb2encode, fb2tozip
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.20180717
0.20180725
3 changes: 2 additions & 1 deletion man/man1/fb2encode.1
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -31,6 +31,7 @@ help
.SH SEE ALSO
fb2totxt,
fb2tozip,
fb2tofix,
grep,
sed,
iconv
Expand Down
3 changes: 2 additions & 1 deletion man/man1/fb2totxt.1
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -33,6 +33,7 @@ help
.SH SEE ALSO
fb2encode,
fb2tozip,
fb2xmlfix,
sed,
file,
less,
Expand Down
3 changes: 2 additions & 1 deletion man/man1/fb2tozip.1
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -31,6 +31,7 @@ help
.SH SEE ALSO
fb2encode,
fb2totxt,
fb2xmlfix,
unzip,
zip

Expand Down
36 changes: 36 additions & 0 deletions man/man1/fb2xmlfix.1
Original file line number Diff line number Diff line change
@@ -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: [email protected]
2 changes: 1 addition & 1 deletion scripts/fb2encode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#Depends: dash, grep, sed, iconv

sname="Fb2Encode"
sversion="0.20180716"
sversion="0.20180725"

echo "$sname $sversion" >&2

Expand Down
2 changes: 1 addition & 1 deletion scripts/fb2totxt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#Depends: dash, sed, file, less, unzip, zcat

sname="Fb2totxt"
sversion="0.20180702"
sversion="0.20180725"

echo "$sname $sversion" >&2

Expand Down
4 changes: 2 additions & 2 deletions scripts/fb2tozip.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
58 changes: 58 additions & 0 deletions scripts/fb2xmlfix.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7c46bb4

Please sign in to comment.