Hacking

Developer guide to the codebase

Cache directory structure

$ cd ~/.local/share/koneko
$ tree -d  # (Edited: .koneko and history are files not directories)
.
├── cache                         # ├── KONEKODIR   ├── 2232374                   # │   ├── Artist pixiv ID                             ├── Mode 1 and 2      ├── 1                     # │   │   ├── Page 1                                  │   ├── Mode 1      ├── 2                     # │   │   ├── Page 2                                  │   ├── Mode 1      └── individual            # │   │   └── Posts with a single image               │   └── Mode 2          └── 76695217          # │   │       └── ID of posts with multiple images    │       ├── Mode 2              └── illustrelated # │   │       └── Related images mode                 │       └── Mode 1.5                  └── 1         # │   │           └── Page 1                          │           └── Mode 1.5   ├── following                 # │   ├── Following users mode                        ├── Mode 3      └── *your_id*             # │   │   └── Your pixiv ID                           │          ├── 1                 # │   │       ├── Page 1                              │             └── .koneko       # │   │       │   └── Stores number of artists info   │          └── 2                 # │   │       └── Page 2                              │              └── .koneko       # │   │           └── Stores number of artists info   │   ├── illustfollow              # │   ├── Illust follow mode                          ├── Mode 5      ├── 1                     # │   │   ├── Page 1                                  │      └── 2                     # │   │   └── Page 2                                  │   ├── recommended               # │   ├── Illust recommended mode                     ├── Mode 6      └── 1                     # │   │   └── Page 1   ├── search                    # │   ├── Search users mode                           ├── Mode 4      └── gomzi                 # │   │   └── Search string          └── 1                 # │   │       └── Page 1   ├── history                   # │   ├── History file, for frequent "mode"   ├── testgallery               # │   ├── (Internal/debugging use)   └── testuser                  # │   └── (Internal/debugging use)
└── pics                          # └── Images for main and info screen

UML diagrams

Flowchart of modes and their connections

Flowchart UML

Flowchart as a finite state machine

api UML

Simplified UML diagram of the classes

api.py

api UML

download.py

download UML

Image Adjuster in assistants.py

image adjuster UML

lscat.py and data.py

lscat and data UML

main.py to prompt.py

main to prompt UML

main.py to ui.py

main to ui UML

ui.py

ui UML

UI class methods

ui methods UML

Actor-ish models of ui classes

ui.AbstractUI

AbstractUI UML

ui.User classes (extending AbstractUI)

User UML

ui.Image

Image UML

Dependencies

There are two dependencies that aren’t necessary: returns and placeholder (both on the right edge). Code can always be rewritten to remove those two dependencies. That said, they don’t introduce their own dependency tree, so only a total of three dependencies are added. Compared to the core dependencies (pixivpy, pixcat, and blessed), that’s insignificant.

dep tree
$ pipdeptree -v
2.0.0b1
$ pipdeptree --graph-output png -p koneko > dependencies.png