Skip to content

Commit

Permalink
Updating cli (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
codeperfectplus committed Oct 24, 2022
1 parent ae12612 commit 6822951
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
22 changes: 14 additions & 8 deletions audiobook/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@

from main import BOOK_DIR, AudioBook

if __name__ == "__main__":

def main():
parser = argparse.ArgumentParser(description="AudioBook - listen to any PDF book")
parser.add_argument(
parser.add_argument("-p", "--path", nargs="?", default=None, help="book file path")

group = parser.add_mutually_exclusive_group()
group.add_argument(
"-l", "--library", action="store_true", help="get all books in library"
)
parser.add_argument(
group.add_argument(
"-c",
"--create-json",
action="store_true",
help="create json file from input file",
)
parser.add_argument(
group.add_argument(
"-s",
"--save-audio",
action="store_true",
help="save audio files from input file",
)
parser.add_argument(
"-r", "--read-book", action="store_true", help="read the book from input file"
)
parser.add_argument("path", nargs="?", default=None, help="book file path")
group.add_argument(
"-r", "--read-book", action="store_true", help="read the book from input file")

args = parser.parse_args()

Expand All @@ -45,3 +47,7 @@
else:
ab.get_library()
print("Use `python audiobook -h` to see all valid options")


if __name__ == "__main__":
main()
5 changes: 1 addition & 4 deletions audiobook/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@
BOOK_DIR = os.path.join(expand_usr, "audiobook/library")
os.makedirs(BOOK_DIR, exist_ok=True)

logger = logging.getLogger("PyPDF2")
logger.setLevel(logging.INFO)


class AudioBook:
class AudioBook(object):
"""
AudioBook class
Expand Down

0 comments on commit 6822951

Please sign in to comment.