Compare commits
2 Commits
797ab70d71
...
548bdcb6a4
Author | SHA1 | Date |
---|---|---|
ktyl | 548bdcb6a4 | |
ktyl | e2a452914e |
|
@ -14,7 +14,7 @@ if len(sys.argv) != 2:
|
||||||
|
|
||||||
base_path = os.path.abspath(sys.argv[1])
|
base_path = os.path.abspath(sys.argv[1])
|
||||||
ready_list_name = "ready.md"
|
ready_list_name = "ready.md"
|
||||||
done_list_name = "all-done.md"
|
completed_lists = ["2023.md", "2022.md", "202x.md"]
|
||||||
|
|
||||||
def get_path(list_name : str) -> str:
|
def get_path(list_name : str) -> str:
|
||||||
return os.path.join(base_path, list_name)
|
return os.path.join(base_path, list_name)
|
||||||
|
@ -55,9 +55,12 @@ class Book:
|
||||||
return books
|
return books
|
||||||
|
|
||||||
|
|
||||||
def print_section(title : str, books : list[str]):
|
def print_title(title : str, books : list[str]):
|
||||||
print(f"# {title} ({len(books)})\n")
|
print(f"# {title} ({len(books)})\n")
|
||||||
|
|
||||||
|
|
||||||
|
def print_section(title : str, books : list[str]):
|
||||||
|
print_title(title, books)
|
||||||
longest_title = max([len(b.title) for b in books])
|
longest_title = max([len(b.title) for b in books])
|
||||||
title_column_width = longest_title + 2
|
title_column_width = longest_title + 2
|
||||||
|
|
||||||
|
@ -67,21 +70,49 @@ def print_section(title : str, books : list[str]):
|
||||||
print(format_str.format(*row))
|
print(format_str.format(*row))
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
||||||
def print_in_progress():
|
def print_in_progress():
|
||||||
books = [b for b in Book.get_list(ready_list_name, False) if b.mark]
|
books = [b for b in Book.get_list(ready_list_name, False) if b.mark]
|
||||||
print_section("in progress", books)
|
print_section("in progress", books)
|
||||||
|
|
||||||
|
|
||||||
def print_completed():
|
def print_completed():
|
||||||
books = Book.get_list(done_list_name)
|
|
||||||
print_section("up for borrowing", books)
|
completed_books = []
|
||||||
|
summaries = []
|
||||||
|
|
||||||
|
for completed_list in completed_lists:
|
||||||
|
books = [b for b in Book.get_list(completed_list)]
|
||||||
|
year = completed_list.split(".")[0]
|
||||||
|
completed_books += books
|
||||||
|
summaries.append(f"{year} - {len(books)}")
|
||||||
|
|
||||||
|
print_title("completed", completed_books)
|
||||||
|
|
||||||
|
for s in summaries:
|
||||||
|
print(s)
|
||||||
|
|
||||||
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
def print_available():
|
||||||
|
books = []
|
||||||
|
for completed_list in completed_lists:
|
||||||
|
books += [b for b in Book.get_list(completed_list) if b.mark]
|
||||||
|
print_section("available", books)
|
||||||
|
|
||||||
|
|
||||||
def print_partial_metadata():
|
def print_partial_metadata():
|
||||||
books = Book.get_list(ready_list_name, False)
|
books = Book.get_list(ready_list_name, False)
|
||||||
books += Book.get_list(done_list_name, False)
|
|
||||||
|
for completed_list in completed_lists:
|
||||||
|
books += Book.get_list(completed_list, False)
|
||||||
|
|
||||||
books = [b for b in books if not b.is_metadata_complete()]
|
books = [b for b in books if not b.is_metadata_complete()]
|
||||||
|
|
||||||
print_section("metadata incomplete", books)
|
print_section("metadata incomplete", books)
|
||||||
|
|
||||||
print_in_progress()
|
print_in_progress()
|
||||||
print_completed()
|
print_completed()
|
||||||
|
print_available()
|
||||||
print_partial_metadata()
|
print_partial_metadata()
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<link rel="stylesheet" href="styles.css" />
|
||||||
|
</head>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="centre">
|
||||||
|
<img id="portrait" src="img/stargazer.png"></img>
|
||||||
|
<div id="text-box"></div>
|
||||||
|
<a id="button" href="#" onclick="advance()">start</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<script src="main.js"></script>
|
After Width: | Height: | Size: 235 KiB |
After Width: | Height: | Size: 169 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 251 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 174 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 255 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 198 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 237 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 149 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 374 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 229 KiB |
After Width: | Height: | Size: 163 KiB |
After Width: | Height: | Size: 173 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 190 KiB |
After Width: | Height: | Size: 170 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 273 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 473 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 196 KiB |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 284 KiB |
After Width: | Height: | Size: 288 KiB |
After Width: | Height: | Size: 186 KiB |
After Width: | Height: | Size: 127 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 482 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 348 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 226 KiB |
After Width: | Height: | Size: 220 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 236 KiB |
After Width: | Height: | Size: 242 KiB |
After Width: | Height: | Size: 290 KiB |
After Width: | Height: | Size: 410 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 177 KiB |
|
@ -0,0 +1,62 @@
|
||||||
|
let idx = 0
|
||||||
|
|
||||||
|
let frames = [
|
||||||
|
"hello! you're just in time!", "img/yay.png", null,
|
||||||
|
"this was starting to get ridiculous.", "img/you-shouldnt-be-doing-that.png", null,
|
||||||
|
"there are books EVERYWWHERE", "img/scared.png", null,
|
||||||
|
"and more keep coming!", "img/oshit.png", null,
|
||||||
|
"we've got to do something about it before the deadline!", "img/determined.png", null,
|
||||||
|
|
||||||
|
"hey, could you sort the books for me?", "img/books-messy.png", "stack books by size",
|
||||||
|
|
||||||
|
"yes, i can you've finished STACKING them,", "img/books-size.png", null,
|
||||||
|
"but that's hardly FINISHED, is it?", "img/books-size.png", null,
|
||||||
|
"i mean sure, if you want to be a pedant about it they're sort of ordered by size,", "img/nonplussed.png", null,
|
||||||
|
"but they're still just piled up in the same place, what's that supposed to change?", "img/coffee.png", null,
|
||||||
|
|
||||||
|
"why don't you try again?", "img/books-size.png", "push stack over",
|
||||||
|
"", "img/books-messy.png", "order books by colour",
|
||||||
|
"", "img/books-colour.png", null,
|
||||||
|
|
||||||
|
"no, colours won't work either.", "img/dreamer0.png", null,
|
||||||
|
"why?", "img/blast.png", null,
|
||||||
|
"simple, i don't do colours.", "img/grin.png", null,
|
||||||
|
"it's nothing personal, they're just not for me, you know?", "img/glad-you-asked.png", "restart"
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
function setText(text) {
|
||||||
|
document.getElementById('text-box').innerHTML = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setImage(path) {
|
||||||
|
document.getElementById('portrait').src = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setButtonText(text) {
|
||||||
|
console.log(text);
|
||||||
|
if (text == null)
|
||||||
|
{
|
||||||
|
text = "next";
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('button').innerHTML = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function advance() {
|
||||||
|
const stride = 3;
|
||||||
|
|
||||||
|
if (idx >= frames.length) {
|
||||||
|
idx = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
let text = frames[idx];
|
||||||
|
let img = frames[idx + 1];
|
||||||
|
let buttonText = frames[idx + 2];
|
||||||
|
|
||||||
|
setText(text);
|
||||||
|
setButtonText(buttonText);
|
||||||
|
setImage(img);
|
||||||
|
|
||||||
|
idx += stride;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
img {
|
||||||
|
max-height: 70vh;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.centre {
|
||||||
|
margin: auto;
|
||||||
|
padding: 0;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#button {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#text-box {
|
||||||
|
width 100%;
|
||||||
|
height: 4em;
|
||||||
|
}
|
||||||
|
|