Skip to content

comicbox.readinglists.cli.comics

The actions on a directory of comics: match a list, and write its arcs.

write-arcs merges the arc into each comic’s tags, never writes a comic with a tag file comicbox could not parse, writes each file once, and checks each write by reading the comic back. Ctrl-C while comics are read stops at once; while they are written it only asks, and the writes under way finish.

add_comic_actions(actions)

Add the actions on a directory of comics to the parser’s subcommands.

Source code in comicbox/readinglists/cli/comics.py
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
def add_comic_actions(actions: Any) -> None:
    """Add the actions on a directory of comics to the parser's subcommands."""
    sub = actions.add_parser(
        "match",
        help="Say which of a list's issues the comics in DIR are, and which are missing.",
        description=(
            "Find each of a list's issues among the comics in DIR: by an issue id,"
            " then by series, year or volume and issue, then by a variant of the"
            " series name. Each comic found is a row, with how it was found."
            " Linked directories are not searched."
        ),
    )
    sub.add_argument("file", type=Path, metavar="FILE", help="The reading list.")
    sub.add_argument(
        "directory", type=Path, metavar="DIR", help="Comics, searched deeply."
    )
    sub = actions.add_parser(
        "write-arcs",
        help="Tag the comics in DIR a list matches with its story arc; a dry run without --apply.",
        description=(
            "Tag each comic in DIR that a list matches with the list's name as a"
            " story arc, numbered by its place in an ordered list. Without --apply"
            " nothing is written: each comic's change is shown. Only comics"
            " matched by id or by series, year or volume and issue are tagged,"
            " unless --variants. A comic that already has the arc with that number"
            " is left alone, as is one with a tag file comicbox cannot read. A"
            " CBR, CBT or CB7 is converted to a CBZ beside it, as comicbox converts"
            " it, and is not written when that CBZ already exists."
        ),
    )
    sub.add_argument(
        "-w",
        "--write",
        action=CSVAction,
        required=True,
        metavar="FORMATS",
        dest="formats",
        help=(
            "The tag formats to write, as comicbox -w takes them: cix, mi,"
            " json... Each must be able to hold the arc. Every other tag file a"
            " comic has is removed, and each comic's line names them, unless keep"
            " is among them: -w keep writes each comic in the formats it has, and"
            " -w cix,keep adds ComicInfo to them."
        ),
    )
    sub.add_argument(
        "--delete-orig",
        action="store_true",
        help=(
            "Delete a CBR, CBT or CB7 once it is converted to a CBZ, as comicbox"
            " --delete-orig does."
        ),
    )
    sub.add_argument(
        "--variants",
        action="store_true",
        help="Also tag the comics found only by a variant of the series name.",
    )
    sub.add_argument(
        "--apply",
        action="store_true",
        help="Write the arcs. Without it, only show what would change.",
    )
    sub.add_argument("file", type=Path, metavar="FILE", help="The reading list.")
    sub.add_argument(
        "directory", type=Path, metavar="DIR", help="Comics, searched deeply."
    )