Browse Source

lazy update

John ShaggyTwoDope Jenkins 4 years ago
parent
commit
75f2b00b97
12 changed files with 1056 additions and 159 deletions
  1. 18
    0
      cbr2cbz
  2. 81
    0
      dosy2unix_ctrl_L
  3. 81
    0
      dosy2unix_ctrl_Y
  4. 81
    0
      dosy2unix_ctrl_b
  5. 81
    0
      dosy2unix_ctrl_m
  6. 81
    0
      dosy2unix_ctrl_n
  7. 81
    0
      dosy2unix_ctrl_ultra
  8. 81
    0
      dosy2unix_ctrl_upthing
  9. 81
    0
      dosy2unix_ctrl_upthingdouble
  10. 81
    0
      dosy2unix_ctrl_z
  11. 299
    159
      epub
  12. 10
    0
      rename_dot_zip_to_cbz

+ 18
- 0
cbr2cbz View File

@@ -0,0 +1,18 @@
1
+#!/usr/bin/env bash
2
+# AUTHOR:   shaggy
3
+# FILE:     cbr2cbz.sh
4
+# ROLE:     TODO (some explanation)
5
+# CREATED:  2015-04-04 08:36:54
6
+# MODIFIED: 2015-04-04 08:37:00
7
+#bin/bash
8
+
9
+cbr=$1
10
+start_directory=`pwd`
11
+
12
+cbz=`basename "$cbr" .cbr`.cbz
13
+
14
+tempdir=`mktemp -d`
15
+cd "$tempdir"
16
+unrar e -inul "$start_directory/$cbr"
17
+zip -q "$start_directory/$cbz" *
18
+rm -rf "$tempdir"

+ 81
- 0
dosy2unix_ctrl_L View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\15\014' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 81
- 0
dosy2unix_ctrl_Y View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\15\31' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 81
- 0
dosy2unix_ctrl_b View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\15\002' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 81
- 0
dosy2unix_ctrl_m View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\15\015' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 81
- 0
dosy2unix_ctrl_n View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\15\016' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 81
- 0
dosy2unix_ctrl_ultra View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\000-\011\013\014\016-\037\174' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 81
- 0
dosy2unix_ctrl_upthing View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\15\136' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 81
- 0
dosy2unix_ctrl_upthingdouble View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\15\036' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 81
- 0
dosy2unix_ctrl_z View File

@@ -0,0 +1,81 @@
1
+#!/usr/bin/bash
2
+#     #!/usr/bin/tcsh
3
+
4
+# file: dos2unix1
5
+#
6
+# Synopsis:  THIS IS A VARIANT OF dos2unix
7
+#	where you want to replace a dos file by a unix file!
8
+#   	So, you give it only ONE file argument:
9
+#
10
+#		> dos2unix1 filename
11
+#
12
+#	As a result, filename is converted from a dos file
13
+#	into a unix file.
14
+#
15
+#############################################################
16
+# How do you convert a dos file to unix?
17
+#############################################################
18
+# Well, gvim sometimes could do it, but it is sometimes too clever
19
+#	and it hides the extra dos characters from view!  Then you cannot
20
+#	delete these characters. [I am not sure how to turn off this
21
+#	cleverness of gvim]
22
+#
23
+# But do you really care if they don't show up on gvim?
24
+#	Here is one case where it matters: I have two files, foo and bar,
25
+#	that I need to diff.  If one is in unix and other in dos format,
26
+#	then diff does not produce anything sensible!
27
+#
28
+# A web search gave a number of solutions (e.g., use ftp, etc).
29
+# 	Here is one I like, based on the program "tr" which translates
30
+# 	or deletes characters from standard input to standard output!
31
+#	This is available on cygwin!
32
+#
33
+# SYNOPSIS of tr:
34
+#
35
+#       tr [OPTION]... SET1 [SET2]
36
+#
37
+#       -c, --complement
38
+#              first complement SET1
39
+#
40
+#       -d, --delete
41
+#              delete characters in SET1, do not translate
42
+#
43
+#       -s, --squeeze-repeats
44
+#              replace sequence of characters with one
45
+#
46
+#       -t, --truncate-set1
47
+#              first truncate SET1 to length of SET2
48
+#
49
+#       --help display this help and exit
50
+#
51
+#       SETs are specified as strings  of  characters.   Most  represent  them-
52
+#       selves.  Interpreted sequences are:
53
+#
54
+#       \NNN   character with octal value NNN (1 to 3 octal digits)
55
+#
56
+#       \\     backslash
57
+#
58
+#       \a     audible BEL
59
+#
60
+#       \b     backspace
61
+#
62
+#       \f     form feed
63
+#
64
+#   ...etc
65
+#############################################################
66
+# The upshot:
67
+# 	The following line can be used to remove all carriage returns 
68
+# 	and Ctrl-z (^Z) characters from a DOS file by typing:
69
+#
70
+#                > tr -d '\15\32' < dosfile.txt > unixfile.txt
71
+# Here is the automation via shell script:
72
+#
73
+
74
+tr -d '\15\32' < $1 > $1.yaptemp
75
+mv $1.yaptemp $1
76
+
77
+#############################################################
78
+# The downside:
79
+# 	tr cannot be used to convert a document from 
80
+#	Unix format to DOS. 
81
+#############################################################

+ 299
- 159
epub View File

@@ -1,6 +1,6 @@
1 1
 #!/usr/bin/env python2
2 2
 '''
3
-python/curses epub reader. Requires BeautifulSoup
3
+Python/curses epub reader. Requires BeautifulSoup.
4 4
 
5 5
 Keyboard commands:
6 6
     Esc/q          - quit
@@ -10,16 +10,26 @@ Keyboard commands:
10 10
         Down       - down a line
11 11
         PgUp       - up a page
12 12
         PgDown     - down a page
13
-    Chapter view:
14
-        Up         - up a page
15
-        Down       - down a page
16
-        PgUp       - up a line
17
-        PgDown     - down a line
13
+        Home       - first page
14
+        End        - last page
15
+        [0-9]      - go to chapter
18 16
         i          - open images on page in web browser
17
+        e          - open source files with vim
18
+        h          - show help
19
+    Chapter view:
20
+        PgUp       - up a page
21
+        PgDown     - down a page
22
+        Up         - up a line
23
+        Down       - down a line
24
+        Home       - first page
25
+        End        - last page
19 26
 '''
20 27
 
21 28
 import curses.wrapper, curses.ascii
22 29
 import formatter, htmllib, locale, os, StringIO, re, readline, tempfile, zipfile
30
+import mimetypes
31
+from time import time
32
+from math import log10, floor
23 33
 import base64, webbrowser
24 34
 
25 35
 from BeautifulSoup import BeautifulSoup
@@ -35,6 +45,7 @@ else:
35 45
 locale.setlocale(locale.LC_ALL, 'en_US.utf-8')
36 46
 
37 47
 basedir = ''
48
+parser = None
38 49
 
39 50
 def run(screen, program, *args):
40 51
     curses.nocbreak()
@@ -69,15 +80,21 @@ def open_image(screen, name, s):
69 80
     finally:
70 81
         os.unlink(image_file.name)
71 82
 
72
-def textify(html_snippet, img_size=(80, 45), maxcol=72):
83
+def textify(html_snippet, img_size=(80, 45), maxcol=72, html_file=None):
73 84
     ''' text dump of html '''
74 85
     class Parser(htmllib.HTMLParser):
75 86
         def anchor_end(self):
76 87
             self.anchor = None
77 88
         def handle_image(self, source, alt, ismap, alight, width, height):
78
-            global basedir
89
+            if os.path.isabs(source):
90
+                src = source
91
+            else:
92
+                src = os.path.normpath(
93
+                          os.path.join(os.path.dirname(html_file), source)
94
+                      )
95
+
79 96
             self.handle_data(
80
-                '[img="{0}{1}" "{2}"]'.format(basedir, source, alt)
97
+                '[img="{0}" "{1}"]'.format(src, alt)
81 98
             )
82 99
 
83 100
     class Formatter(formatter.AbstractFormatter):
@@ -102,14 +119,16 @@ def table_of_contents(fl):
102 119
     global basedir
103 120
 
104 121
     # find opf file
105
-    soup = BeautifulSoup(fl.read('META-INF/container.xml'))
122
+    soup = BeautifulSoup(fl.read('META-INF/container.xml'),
123
+                         convertEntities=BeautifulSoup.HTML_ENTITIES)
106 124
     opf = dict(soup.find('rootfile').attrs)['full-path']
107 125
 
108 126
     basedir = os.path.dirname(opf)
109 127
     if basedir:
110 128
         basedir = '{0}/'.format(basedir)
111 129
 
112
-    soup =  BeautifulSoup(fl.read(opf))
130
+    soup =  BeautifulSoup(fl.read(opf),
131
+                          convertEntities=BeautifulSoup.HTML_ENTITIES)
113 132
 
114 133
     # title
115 134
     yield (soup.find('dc:title').text, None)
@@ -130,14 +149,15 @@ def table_of_contents(fl):
130 149
     z = {}
131 150
     if ncx:
132 151
         # get titles from the toc
133
-        soup =  BeautifulSoup(fl.read(ncx))
152
+        soup =  BeautifulSoup(fl.read(ncx),
153
+                              convertEntities=BeautifulSoup.HTML_ENTITIES)
134 154
 
135 155
         for navpoint in soup('navpoint'):
136 156
             k = navpoint.content.get('src', None)
137 157
             # strip off any anchor text
138 158
             k = k.split('#')[0]
139 159
             if k:
140
-                z[k] = navpoint.navlabel.text
160
+                z['{0}{1}'.format(basedir, k)] = navpoint.navlabel.text
141 161
 
142 162
     # output
143 163
     for section in y:
@@ -160,8 +180,8 @@ def list_chaps(screen, chaps, start, length):
160 180
     return i
161 181
 
162 182
 def check_epub(fl):
163
-    if os.path.isfile(fl) and os.path.splitext(fl)[1].lower() == '.epub':
164
-        return True
183
+    return os.path.isfile(fl) and \
184
+           mimetypes.guess_type(fl)[0] == 'application/epub+zip'
165 185
 
166 186
 def dump_epub(fl, maxcol=float("+inf")):
167 187
     if not check_epub(fl):
@@ -172,198 +192,318 @@ def dump_epub(fl, maxcol=float("+inf")):
172 192
         print title
173 193
         print '-' * len(title)
174 194
         if src:
175
-            soup = BeautifulSoup(fl.read(src))
195
+            soup = BeautifulSoup(fl.read(src),
196
+                                 convertEntities=BeautifulSoup.HTML_ENTITIES)
176 197
             print textify(
177 198
                 unicode(soup.find('body')).encode('utf-8'),
178
-                maxcol=maxcol,
199
+                maxcol = maxcol,
200
+                html_file = src
179 201
             )
180 202
         print '\n'
181 203
 
182
-def curses_epub(screen, fl):
204
+def curses_epub(screen, fl, info=True, maxcol=float("+inf")):
183 205
     if not check_epub(fl):
184 206
         return
185 207
 
186
-    #curses.mousemask(curses.BUTTON1_CLICKED)
187
-
188 208
     fl = zipfile.ZipFile(fl, 'r')
189 209
     chaps = [i for i in table_of_contents(fl)]
190 210
     chaps_pos = [0 for i in chaps]
191 211
     start = 0
192 212
     cursor_row = 0
193 213
 
214
+    n_chaps = len(chaps) - 1
215
+
216
+    cur_chap = None
217
+    cur_text = None
218
+
219
+    if info:
220
+        info_cols = 2
221
+    else:
222
+        info_cols = 0
223
+
224
+    maxy, maxx = screen.getmaxyx()
225
+    if maxcol is not None and maxcol > 0 and maxcol < maxx:
226
+        maxx = maxcol
227
+
194 228
     # toc
195 229
     while True:
196
-        curses.curs_set(1)
197
-        maxy, maxx = screen.getmaxyx()
230
+        if cur_chap is None:
231
+            curses.curs_set(1)
232
+
233
+            if cursor_row >= maxy:
234
+                cursor_row = maxy - 1
235
+
236
+            len_chaps = list_chaps(screen, chaps, start, maxy)
237
+            screen.move(cursor_row, 0)
238
+        else:
239
+            if cur_text is None:
240
+                if chaps[cur_chap][1]:
241
+                    html = fl.read(chaps[cur_chap][1])
242
+                    soup = BeautifulSoup(html,
243
+                                    convertEntities=BeautifulSoup.HTML_ENTITIES)
244
+                    cur_text = textify(
245
+                        unicode(soup.find('body')).encode('utf-8'),
246
+                        img_size = (maxy, maxx),
247
+                        maxcol = maxx,
248
+                        html_file = chaps[cur_chap][1]
249
+                    ).split('\n')
250
+                else:
251
+                    cur_text = ''
252
+
253
+            images = []
254
+            # Current status info
255
+            # Total number of lines
256
+            n_lines = len(cur_text)
257
+            if info:
258
+                # Title
259
+                title = chaps[cur_chap][0]
260
+                # Total number of pages
261
+                n_pages = n_lines / (maxy - 2) + 1
262
+
263
+                # Truncate title if too long. Add ellipsis at the end
264
+                if len(title) > maxx - 29:
265
+                    title = title[0:maxx - 30] + u'\u2026'.encode('utf-8')
266
+                    spaces = ''
267
+                else:
268
+                    spaces = ''.join([' '] * (maxx - len(title) - 30))
269
+
270
+            screen.clear()
271
+            curses.curs_set(0)
272
+            for i, line in enumerate(cur_text[chaps_pos[cur_chap]:
273
+                                       chaps_pos[cur_chap] + maxy - info_cols]):
274
+                try:
275
+                    screen.addstr(i, 0, line)
276
+                    mch = re.search('\[img="([^"]+)" "([^"]*)"\]', line)
277
+                    if mch:
278
+                        images.append(mch.group(1))
279
+                except:
280
+                    pass
198 281
 
199
-        if cursor_row >= maxy:
200
-            cursor_row = maxy - 1
282
+            if info:
283
+                # Current status info
284
+                # Current (last) line number
285
+                cur_line = min([n_lines,chaps_pos[cur_chap]+maxy-info_cols])
286
+                # Current page
287
+                cur_page = (cur_line - 1) / (maxy - 2) + 1
288
+                # Current position (%)
289
+                cur_pos  = 100 * (float(cur_line) / n_lines)
290
+
291
+                try:
292
+                    screen.addstr(maxy - 1, 0,
293
+                                  '%s (%2d/%2d) %s Page %2d/%2d (%5.1f%%)' % (
294
+                                    title,
295
+                                    cur_chap,
296
+                                    n_chaps,
297
+                                    spaces,
298
+                                    cur_page,
299
+                                    n_pages,
300
+                                    cur_pos))
301
+                except:
302
+                    pass
303
+            screen.refresh()
201 304
 
202
-        len_chaps = list_chaps(screen, chaps, start, maxy)
203
-        screen.move(cursor_row, 0)
204 305
         ch = screen.getch()
205 306
 
206
-        # quit
207
-        if ch == curses.ascii.ESC:
208
-            return
307
+        if cur_chap is None:
308
+            try:
309
+                # Set getch to non-blocking
310
+                screen.nodelay(1)
311
+                # Get int from input
312
+                n = int(chr(ch))
313
+                # Maximim number one can compute with the same number of digits
314
+                # as the number of chapters
315
+                # Ex.: for 80 chapters, max_n = 99
316
+                max_n = int(10 ** floor(log10(n_chaps) + 1) - 1)
317
+
318
+                # Break on non-digit input
319
+                while chr(ch).isdigit():
320
+                    delay = time()
321
+                    ch = -1
322
+                    # Wait for next character for 0.35 seconds
323
+                    while ch == -1 and time() - delay < 0.35:
324
+                        ch = screen.getch()
325
+
326
+                    # If user has input a digit
327
+                    if ch != -1 and chr(ch).isdigit():
328
+                        n = n * 10 + int(chr(ch))
329
+                    # User requested a non-existent chapter, bail
330
+                    if n > n_chaps:
331
+                        break
332
+                    # When we're on the character limit, or no digit was input
333
+                    # go to chapter
334
+                    elif n * 10 > max_n or ch == -1:
335
+                        cur_chap = n
336
+                        cur_text = None
337
+
338
+                        # Position cursor in middle of screen
339
+                        # Adjust start acordingly
340
+                        start = cur_chap - maxy / 2
341
+                        if start > n_chaps - maxy + 1:
342
+                            start = n_chaps - maxy + 1
343
+                        if start < 0:
344
+                            start = 0
345
+
346
+                        cursor_row = cur_chap - start
347
+                        break
348
+            except:
349
+                pass
350
+            finally:
351
+                screen.nodelay(0)
352
+
353
+        # help
209 354
         try:
210
-           if chr(ch) == 'q':
211
-               return
212
-        except:
355
+            if chr(ch) == 'h':
356
+                curses.curs_set(0)
357
+                screen.clear()
358
+                for i, line in enumerate(parser.format_help().split('\n')):
359
+                    screen.addstr(i, 0, line)
360
+                screen.refresh()
361
+                screen.getch()
362
+                screen.clear()
363
+
364
+        # quit
365
+            if ch == curses.ascii.ESC or chr(ch) == 'q':
366
+                return
367
+
368
+            if chr(ch) == 'i':
369
+                for img in images:
370
+                    err = open_image(screen, img, fl.read(img))
371
+                    if err:
372
+                        screen.addstr(0, 0, err, curses.A_REVERSE)
373
+
374
+            # edit html
375
+            elif chr(ch) == 'e':
376
+
377
+                tmpfl = tempfile.NamedTemporaryFile(delete=False)
378
+                tmpfl.write(html)
379
+                tmpfl.close()
380
+                run(screen, 'vim', tmpfl.name)
381
+                with open(tmpfl.name) as changed:
382
+                    new_html = changed.read()
383
+                    os.unlink(tmpfl.name)
384
+                    if new_html != html:
385
+                        pass
386
+                        # write to zipfile?
387
+
388
+                # go back to TOC
389
+                screen.clear()
390
+
391
+        except (ValueError, IndexError):
213 392
             pass
214 393
 
215 394
         # up/down line
216 395
         if ch in [curses.KEY_DOWN]:
217
-            if start < len(chaps) - maxy:
218
-                start += 1
219
-                screen.clear()
220
-            elif cursor_row < maxy - 1 and cursor_row < len_chaps:
221
-                cursor_row += 1
396
+            if cur_chap is None:
397
+                if start < len(chaps) - maxy:
398
+                    start += 1
399
+                    screen.clear()
400
+                elif cursor_row < maxy - 1 and cursor_row < len_chaps:
401
+                    cursor_row += 1
402
+            else:
403
+                if chaps_pos[cur_chap] + maxy - info_cols < \
404
+                        n_lines + maxy - info_cols - 1:
405
+                    chaps_pos[cur_chap] += 1
406
+                    screen.clear()
222 407
         elif ch in [curses.KEY_UP]:
223
-            if start > 0:
224
-                start -= 1
225
-                screen.clear()
226
-            elif cursor_row > 0:
227
-                cursor_row -= 1
408
+            if cur_chap is None:
409
+                if start > 0:
410
+                    start -= 1
411
+                    screen.clear()
412
+                elif cursor_row > 0:
413
+                    cursor_row -= 1
414
+            else:
415
+                if chaps_pos[cur_chap] > 0:
416
+                    chaps_pos[cur_chap] -= 1
417
+                    screen.clear()
228 418
 
229 419
         # up/down page
230 420
         elif ch in [curses.KEY_NPAGE]:
231
-            if start + maxy - 1 < len(chaps):
232
-                start += maxy - 1
233
-                if len_chaps < maxy:
234
-                    start = len(chaps) - maxy
421
+            if cur_chap is None:
422
+                if start + maxy - 1 < len(chaps):
423
+                    start += maxy - 1
424
+                    if len_chaps < maxy:
425
+                        start = len(chaps) - maxy
426
+                    screen.clear()
427
+            else:
428
+                if chaps_pos[cur_chap] + maxy - info_cols < n_lines:
429
+                    chaps_pos[cur_chap] += maxy - info_cols
430
+                elif cur_chap < n_chaps:
431
+                    cur_chap += 1
432
+                    cur_text = None
235 433
                 screen.clear()
236 434
         elif ch in [curses.KEY_PPAGE]:
237
-            if start > 0:
238
-                start -= maxy - 1
239
-                if start < 0:
240
-                    start = 0
435
+            if cur_chap is None:
436
+                if start > 0:
437
+                    start -= maxy - 1
438
+                    if start < 0:
439
+                        start = 0
440
+                    screen.clear()
441
+            else:
442
+                if chaps_pos[cur_chap] > 0:
443
+                    chaps_pos[cur_chap] -= maxy - info_cols
444
+                    if chaps_pos[cur_chap] < 0:
445
+                        chaps_pos[cur_chap] = 0
446
+                elif cur_chap > 0:
447
+                    cur_chap -= 1
448
+                    cur_text = None
241 449
                 screen.clear()
242 450
 
243
-        # to chapter
244
-        elif ch in [curses.ascii.HT, curses.KEY_RIGHT, curses.KEY_LEFT]:
245
-            if chaps[start + cursor_row][1]:
246
-                html = fl.read(chaps[start + cursor_row][1])
247
-                soup = BeautifulSoup(html)
248
-                chap = textify(
249
-                    unicode(soup.find('body')).encode('utf-8'),
250
-                    img_size=screen.getmaxyx(),
251
-                    maxcol=screen.getmaxyx()[1]
252
-                ).split('\n')
451
+        # Position cursor in first chapter / go to first page
452
+        elif ch in [curses.KEY_HOME]:
453
+            if cur_chap is None:
454
+                start = 0
455
+                cursor_row = 0
253 456
             else:
254
-                chap = ''
457
+                chaps_pos[cur_chap] = 0
458
+            screen.clear()
459
+        # Position cursor in last chapter / go to last page
460
+        elif ch in [curses.KEY_END]:
461
+            if cur_chap is None:
462
+                cursor_row = min(n_chaps, maxy)
463
+                start = max(0, n_chaps - cursor_row)
464
+            else:
465
+                chaps_pos[cur_chap] = n_lines - n_lines % (maxy - info_cols)
466
+                cur_text = None
255 467
             screen.clear()
256
-            curses.curs_set(0)
257
-
258
-            # chapter
259
-            while True:
260
-                maxy, maxx = screen.getmaxyx()
261
-                images = []
262
-                for i, line in enumerate(chap[
263
-                    chaps_pos[start + cursor_row]:
264
-                    chaps_pos[start + cursor_row] + maxy
265
-                ]):
266
-                    try:
267
-                        screen.addstr(i, 0, line)
268
-                        mch = re.search('\[img="([^"]+)" "([^"]*)"\]', line)
269
-                        if mch:
270
-                            images.append(mch.group(1))
271
-                    except:
272
-                        pass
273
-                screen.refresh()
274
-                ch = screen.getch()
275
-
276
-                # quit
277
-                if ch == curses.ascii.ESC:
278
-                    return
279
-                try:
280
-                   if chr(ch) == 'q':
281
-                       return
282
-                except:
283
-                    pass
284
-
285
-                # to TOC
286
-                if ch in [curses.ascii.HT, curses.KEY_RIGHT, curses.KEY_LEFT]:
287
-                    screen.clear()
288
-                    break
289
-
290
-                # up/down page
291
-                elif ch in [curses.KEY_DOWN]:
292
-                    if chaps_pos[start + cursor_row] + maxy - 1 < len(chap):
293
-                        chaps_pos[start + cursor_row] += maxy - 1
294
-                        screen.clear()
295
-                elif ch in [curses.KEY_UP]:
296
-                    if chaps_pos[start + cursor_row] > 0:
297
-                        chaps_pos[start + cursor_row] -= maxy - 1
298
-                        if chaps_pos[start + cursor_row] < 0:
299
-                            chaps_pos[start + cursor_row] = 0
300
-                        screen.clear()
301
-
302
-                # up/down line
303
-                elif ch in [curses.KEY_NPAGE]:
304
-                    if chaps_pos[start + cursor_row] + maxy - 1 < len(chap):
305
-                        chaps_pos[start + cursor_row] += 1
306
-                        screen.clear()
307
-                elif ch in [curses.KEY_PPAGE]:
308
-                    if chaps_pos[start + cursor_row] > 0:
309
-                        chaps_pos[start + cursor_row] -= 1
310
-                        screen.clear()
311
-
312
-                #elif ch in [curses.KEY_MOUSE]:
313
-                #    id, x, y, z, bstate = curses.getmouse()
314
-                #    line = screen.instr(y, 0)
315
-                #    mch = re.search('\[img="([^"]+)" "([^"]*)"\]', line)
316
-                #    if mch:
317
-                #            img_fl = mch.group(1)
318 468
 
319
-                else:
320
-                    try:
321
-                        if chr(ch) == 'i':
322
-                            for img in images:
323
-                                err = open_image(screen, img, fl.read(img))
324
-                                if err:
325
-                                    screen.addstr(0, 0, err, curses.A_REVERSE)
326
-
327
-                        # edit html
328
-                        elif chr(ch) == 'e':
329
-
330
-                            tmpfl = tempfile.NamedTemporaryFile(delete=False)
331
-                            tmpfl.write(html)
332
-                            tmpfl.close()
333
-                            run(screen, 'vim', tmpfl.name)
334
-                            with open(tmpfl.name) as changed:
335
-                                new_html = changed.read()
336
-                                os.unlink(tmpfl.name)
337
-                                if new_html != html:
338
-                                    pass
339
-                                    # write to zipfile?
340
-
341
-                            # go back to TOC
342
-                            screen.clear()
343
-                            break
344
-
345
-                    except (ValueError, IndexError):
346
-                        pass
469
+        # to chapter
470
+        elif ch in [curses.ascii.HT, curses.KEY_RIGHT, curses.KEY_LEFT]:
471
+            if cur_chap is None and start + cursor_row != 0:
472
+                # Current chapter number
473
+                cur_chap = start + cursor_row
474
+                cur_text = None
475
+            else:
476
+                cur_chap = None
477
+                cur_text = None
478
+                screen.clear()
347 479
 
348 480
 if __name__ == '__main__':
349 481
     import argparse
350 482
 
351 483
     parser = argparse.ArgumentParser(
352
-        formatter_class=argparse.RawDescriptionHelpFormatter,
353
-        description=__doc__,
484
+        formatter_class = argparse.RawDescriptionHelpFormatter,
485
+        description = __doc__,
354 486
     )
355
-    parser.add_argument('-d', '--dump', action='store_true',
356
-                        help='dump EPUB to text')
357
-    parser.add_argument('-c', '--cols', action='store', type=int, default=float("+inf"),
358
-                        help='Number of columns to wrap; default is no wrapping.')
487
+    parser.add_argument('-d', '--dump',
488
+        action  = 'store_true',
489
+        help    = 'dump EPUB to text')
490
+    parser.add_argument('-c', '--cols',
491
+        action  = 'store',
492
+        type    = int,
493
+        default = float("+inf"),
494
+        help    = 'Number of columns to wrap; default is no wrapping.')
495
+    parser.add_argument('-I', '--no-info',
496
+        action  = 'store_true',
497
+        default = False,
498
+        help    = 'Do not display chapter/page info. Defaults to false.')
359 499
     parser.add_argument('EPUB', help='view EPUB')
360
-    args = parser.parse_args()
361 500
 
501
+    args = parser.parse_args()
362 502
     if args.EPUB:
363 503
         if args.dump:
364 504
             dump_epub(args.EPUB, args.cols)
365 505
         else:
366 506
             try:
367
-                curses.wrapper(curses_epub, args.EPUB)
507
+                curses.wrapper(curses_epub,args.EPUB,not args.no_info,args.cols)
368 508
             except KeyboardInterrupt:
369 509
                 pass

+ 10
- 0
rename_dot_zip_to_cbz View File

@@ -0,0 +1,10 @@
1
+# Text File
2
+# AUTHOR:   shaggy
3
+# FILE:     rename_dot_zip_to_cbz
4
+# ROLE:     TODO (some explanation)
5
+# CREATED:  2015-04-04 08:27:34
6
+# MODIFIED: 2015-04-04 08:31:45
7
+#rename all *.txt to *.text
8
+for f in *.zip; do 
9
+    mv -- "$f" "${f%.zip}.cbz"
10
+done

Loading…
Cancel
Save