Replace glob with winglob.
This commit is contained in:
parent
ebde327cce
commit
324689ea3c
1 changed files with 8 additions and 8 deletions
16
epubfile.py
16
epubfile.py
|
@ -1114,13 +1114,13 @@ class Epub:
|
||||||
# COMMAND LINE TOOLS
|
# COMMAND LINE TOOLS
|
||||||
################################################################################
|
################################################################################
|
||||||
import argparse
|
import argparse
|
||||||
import glob
|
|
||||||
import html
|
import html
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from voussoirkit import betterhelp
|
from voussoirkit import betterhelp
|
||||||
|
from voussoirkit import winglob
|
||||||
|
|
||||||
DOCSTRING = '''
|
DOCSTRING = '''
|
||||||
{addfile}
|
{addfile}
|
||||||
|
@ -1230,7 +1230,7 @@ def addfile_argparse(args):
|
||||||
book = Epub.open(args.epub)
|
book = Epub.open(args.epub)
|
||||||
|
|
||||||
for pattern in args.files:
|
for pattern in args.files:
|
||||||
for file in glob.glob(pattern):
|
for file in winglob.glob(pattern):
|
||||||
print(f'Adding file {file}.')
|
print(f'Adding file {file}.')
|
||||||
file = pathclass.Path(file)
|
file = pathclass.Path(file)
|
||||||
try:
|
try:
|
||||||
|
@ -1285,7 +1285,7 @@ def covercomesfirst(book):
|
||||||
book.rename_file(rename_map)
|
book.rename_file(rename_map)
|
||||||
|
|
||||||
def covercomesfirst_argparse(args):
|
def covercomesfirst_argparse(args):
|
||||||
epubs = [epub for pattern in args.epubs for epub in glob.glob(pattern)]
|
epubs = [epub for pattern in args.epubs for epub in winglob.glob(pattern)]
|
||||||
for epub in epubs:
|
for epub in epubs:
|
||||||
print(epub)
|
print(epub)
|
||||||
book = Epub.open(epub)
|
book = Epub.open(epub)
|
||||||
|
@ -1293,7 +1293,7 @@ def covercomesfirst_argparse(args):
|
||||||
book.save(args.epub)
|
book.save(args.epub)
|
||||||
|
|
||||||
def exec_argparse(args):
|
def exec_argparse(args):
|
||||||
epubs = [epub for pattern in args.epubs for epub in glob.glob(pattern)]
|
epubs = [epub for pattern in args.epubs for epub in winglob.glob(pattern)]
|
||||||
for epub in epubs:
|
for epub in epubs:
|
||||||
print(epub)
|
print(epub)
|
||||||
book = Epub.open(epub)
|
book = Epub.open(epub)
|
||||||
|
@ -1301,7 +1301,7 @@ def exec_argparse(args):
|
||||||
book.save(epub)
|
book.save(epub)
|
||||||
|
|
||||||
def generate_toc_argparse(args):
|
def generate_toc_argparse(args):
|
||||||
epubs = [epub for pattern in args.epubs for epub in glob.glob(pattern)]
|
epubs = [epub for pattern in args.epubs for epub in winglob.glob(pattern)]
|
||||||
books = []
|
books = []
|
||||||
for epub in epubs:
|
for epub in epubs:
|
||||||
book = Epub.open(epub)
|
book = Epub.open(epub)
|
||||||
|
@ -1309,7 +1309,7 @@ def generate_toc_argparse(args):
|
||||||
book.save(epub)
|
book.save(epub)
|
||||||
|
|
||||||
def holdit_argparse(args):
|
def holdit_argparse(args):
|
||||||
epubs = [epub for pattern in args.epubs for epub in glob.glob(pattern)]
|
epubs = [epub for pattern in args.epubs for epub in winglob.glob(pattern)]
|
||||||
books = []
|
books = []
|
||||||
for epub in epubs:
|
for epub in epubs:
|
||||||
book = Epub.open(epub)
|
book = Epub.open(epub)
|
||||||
|
@ -1326,7 +1326,7 @@ def holdit_argparse(args):
|
||||||
def merge(input_filepaths, output_filename, do_headerfile=False, number_headerfile=False):
|
def merge(input_filepaths, output_filename, do_headerfile=False, number_headerfile=False):
|
||||||
book = Epub.new()
|
book = Epub.new()
|
||||||
|
|
||||||
input_filepaths = [pathclass.Path(p) for pattern in input_filepaths for p in glob.glob(pattern)]
|
input_filepaths = [pathclass.Path(p) for pattern in input_filepaths for p in winglob.glob(pattern)]
|
||||||
index_length = len(str(len(input_filepaths)))
|
index_length = len(str(len(input_filepaths)))
|
||||||
rand_prefix = random_string(3, string.digits)
|
rand_prefix = random_string(3, string.digits)
|
||||||
|
|
||||||
|
@ -1396,7 +1396,7 @@ def merge_argparse(args):
|
||||||
)
|
)
|
||||||
|
|
||||||
def normalize_argparse(args):
|
def normalize_argparse(args):
|
||||||
epubs = [epub for pattern in args.epubs for epub in glob.glob(pattern)]
|
epubs = [epub for pattern in args.epubs for epub in winglob.glob(pattern)]
|
||||||
for epub in epubs:
|
for epub in epubs:
|
||||||
print(epub)
|
print(epub)
|
||||||
book = Epub.open(epub)
|
book = Epub.open(epub)
|
||||||
|
|
Loading…
Reference in a new issue