diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 336a5c9..9c5da7a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[dev] + pip install -e .[dev] - name: Run tests run: | diff --git a/README.md b/README.md index 0045422..162b26b 100644 --- a/README.md +++ b/README.md @@ -1 +1,84 @@ -# meowDFer \ No newline at end of file +# meowDFer +### Extract, Convert, Merge +This is a tool made to simplify the processes mentioned above. + +## How to use + +##### Example commands: + +- `py -m src extract --src s_name --dest d_name` +- `py -m src convert --src s_name --dest d_name` +- `py -m src merge --src s_name --dest d_name --vol v_name.txt` +- `py -m src all --src s_name --dest d_name --vol v_name.txt` +- `py -m src cm --src s_name --dest d_name --vol v_name.txt` + +## `extract` + +Extracts multiple zip files into one folder. + +1. Create a folder in root, put all .zip files inside. +2. In the root of the directory, open the terminal and run: + +```py -m src extract --src s_name --dest d_name``` +- s_name: name of folder with zip files +- d_name: name of folder where files to be extracted in + +3. Folder with d_name will be created in root with extracted zip files + +## `convert` + +Converts folder with images (chapters) into PDFs. Folders with images must contain 'chapter', 'ch.', or 'c' with a number. Decimal number chapters get skipped. + +1. Create a folder containing folders of images with chapter and number in name. Or have the folders from 'extract'. +2. In the root of the directory, open terminal and run: + +```py -m src convert --src s_name --dest d_name``` +- s_name: name of folder with image folders +- d_name: name of folder where chapter PDFs to be extracted in + +3. Folder with d_name will be created in root with PDFs of chapters. + +## `merge` + +Merge many PDF s (chapters) into volumes, using a .txt file. In the .txt file write the upper limit chapter number of a volume separated by a comma. (e.g. "3, 5, 7, 9") + +1. Create a folder containing PDF chapters, or get them from step above. +2. Create a .txt file with comma separated values, which are upper limit chapter numbers. +3. In the root directory, open terminal and run: + +```py -m src merge --src s_name --dest d_name --vols v_name.txt``` +- s_name: name of folder with chapter PDFs +- d_name: name of folder where volumes to be extracted in +- v_name.txt: name of .txt files containing all limit chapter numbers + +4. Folder with d_name will be created in root with volumes. + +## `all` + +This combines all three commands: extract, convert, and merge. They will run one after another. + +1. Create a folder in root, put all .zip files inside. +2. Create a .txt file with comma separated values, which are upper limit chapter numbers. +3. In the root directory, open terminal and run: + +```py -m src all --src s_name --dest d_name --vols v_name.txt``` +- s_name: name of folder with .zip files +- d_name: name of folder where volumes to be extracted in +- v_name.txt: name of .txt files containing all limit chapter numbers + +4. Folder with d_name will be created in root with volumes. + +## `cm` + +This combines two commands: convert, and merge. They will run one after another. + +1. Create a folder containing folders of images with chapter and number in name. Or have the folders from 'extract'. +2. Create a .txt file with comma separated values, which are upper limit chapter numbers. +3. In the root directory, open terminal and run: + +```py -m src cm --src s_name --dest d_name --vols v_name.txt``` +- s_name: name of folder with image folders +- d_name: name of folder where volumes to be extracted in +- v_name.txt: name of .txt files containing all limit chapter numbers + +4. Folder with d_name will be created in root with volumes. \ No newline at end of file diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..02b3648 --- /dev/null +++ b/src/__init__.py @@ -0,0 +1 @@ +all = ["cli"] \ No newline at end of file diff --git a/src/__main__.py b/src/__main__.py new file mode 100644 index 0000000..27d14a7 --- /dev/null +++ b/src/__main__.py @@ -0,0 +1,4 @@ +from .cli import main + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/src/meowDFer.py b/src/cli.py similarity index 94% rename from src/meowDFer.py rename to src/cli.py index df9dcfe..9f5914f 100644 --- a/src/meowDFer.py +++ b/src/cli.py @@ -1,7 +1,12 @@ -import sys import argparse -from commands import convert_command, extract_command, merge_command, all_command, cm_command +from .commands import ( + convert_command, + extract_command, + merge_command, + all_command, + cm_command +) logo = r""" |\ _,,,---,,_ @@ -91,8 +96,4 @@ def main(): cm_command.run(args, name) else: - parser.print_help() - - -if __name__ == "__main__": - main() \ No newline at end of file + parser.print_help() \ No newline at end of file diff --git a/src/commands/__init__.py b/src/commands/__init__.py new file mode 100644 index 0000000..7bb8f82 --- /dev/null +++ b/src/commands/__init__.py @@ -0,0 +1,5 @@ +from .extract_command import * +from .convert_command import * +from .merge_command import * +from .all_command import * +from .cm_command import * \ No newline at end of file diff --git a/src/commands/all_command.py b/src/commands/all_command.py index 4909c3e..f20179e 100644 --- a/src/commands/all_command.py +++ b/src/commands/all_command.py @@ -1,8 +1,8 @@ import tempfile -from utils.extract import extract_zips -from utils.convert import convert_all_to_pdf -from utils.merge import merge_to_volumes +from ..utils.extract import extract_zips +from ..utils.convert import convert_all_to_pdf +from ..utils.merge import merge_to_volumes def run(args, name): src = args.src diff --git a/src/commands/cm_command.py b/src/commands/cm_command.py index 05e925d..98b2a83 100644 --- a/src/commands/cm_command.py +++ b/src/commands/cm_command.py @@ -1,7 +1,7 @@ import tempfile -from utils.convert import convert_all_to_pdf -from utils.merge import merge_to_volumes +from ..utils.convert import convert_all_to_pdf +from ..utils.merge import merge_to_volumes def run(args, name): src = args.src diff --git a/src/commands/convert_command.py b/src/commands/convert_command.py index 7a7cedc..7de20f8 100644 --- a/src/commands/convert_command.py +++ b/src/commands/convert_command.py @@ -1,5 +1,5 @@ -from utils.convert import convert_all_to_pdf +from ..utils.convert import convert_all_to_pdf def run(args, name): src = args.src diff --git a/src/commands/extract_command.py b/src/commands/extract_command.py index ea010da..ca48f29 100644 --- a/src/commands/extract_command.py +++ b/src/commands/extract_command.py @@ -1,5 +1,5 @@ -from utils.extract import extract_zips +from ..utils.extract import extract_zips def run(args): src = args.src diff --git a/src/commands/merge_command.py b/src/commands/merge_command.py index 4e56a8a..8d6867c 100644 --- a/src/commands/merge_command.py +++ b/src/commands/merge_command.py @@ -1,5 +1,5 @@ -from utils.merge import merge_to_volumes +from ..utils.merge import merge_to_volumes def run(args, name): src = args.src