mirror of
https://git.ari.lt/ari.lt/blog.ari.lt.git
synced 2025-02-04 01:29:24 +01:00
update @ Sun Dec 15 16:44:31 EET 2024
Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
parent
8fdf660002
commit
002771908a
3 changed files with 18 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -15,3 +15,4 @@ venv/
|
||||||
/sitemap.xml
|
/sitemap.xml
|
||||||
/robots.txt
|
/robots.txt
|
||||||
/stats/
|
/stats/
|
||||||
|
/licenses.json
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"alt": "A black cat sitting in a box peacefully",
|
"alt": "A black cat sitting in a box peacefully",
|
||||||
"purpose": "To have a cute cat who looks over blog.ari.lt",
|
"purpose": "To have a cute cat who looks over blog.ari.lt",
|
||||||
"title": "Tina in a box (2019-2020, I think)",
|
"title": "Tina in a box (2019-2020, I think)",
|
||||||
"license": "CC-BY-SA",
|
"license": "CC-BY-SA-1.0",
|
||||||
"credit": "Ari Archer",
|
"credit": "Ari Archer",
|
||||||
"ext": "jpeg",
|
"ext": "jpeg",
|
||||||
"mime": "image/jpeg",
|
"mime": "image/jpeg",
|
||||||
|
|
|
@ -439,6 +439,7 @@ STATS_TEMPLATE: typing.Final[str] = (
|
||||||
)
|
)
|
||||||
|
|
||||||
if NCI:
|
if NCI:
|
||||||
|
import requests
|
||||||
import http.server
|
import http.server
|
||||||
|
|
||||||
import magic
|
import magic
|
||||||
|
@ -447,6 +448,7 @@ if NCI:
|
||||||
else:
|
else:
|
||||||
pyfzf: typing.Any = None
|
pyfzf: typing.Any = None
|
||||||
http: typing.Any = None
|
http: typing.Any = None
|
||||||
|
requests: typing.Any = None
|
||||||
magic: typing.Any = None
|
magic: typing.Any = None
|
||||||
Image: typing.Any = None
|
Image: typing.Any = None
|
||||||
|
|
||||||
|
@ -570,7 +572,7 @@ def select_medias(type: typing.Optional[str] = None) -> tuple[str, ...]:
|
||||||
lambda opt: opt.split("|", maxsplit=1)[0].strip(),
|
lambda opt: opt.split("|", maxsplit=1)[0].strip(),
|
||||||
select_multi(
|
select_multi(
|
||||||
tuple(
|
tuple(
|
||||||
f"{mdx} | {mdy['type']}, {mdy['alt']} for {mdy['purpose']} | {mdy['title']}, {mdy['credit']}"
|
f"{mdx} | {mdy['type']}, {mdy['alt']} for {mdy['purpose']} | {mdy['title']}, {mdy['credit']} ({mdy['license']})"
|
||||||
for mdx, mdy in MEDIA_INDEX.items()
|
for mdx, mdy in MEDIA_INDEX.items()
|
||||||
if mdy["type"] == type
|
if mdy["type"] == type
|
||||||
)
|
)
|
||||||
|
@ -1720,6 +1722,17 @@ def media(config: dict[str, typing.Any]) -> int:
|
||||||
|
|
||||||
assert config is config, "Unused"
|
assert config is config, "Unused"
|
||||||
|
|
||||||
|
if os.path.exists("licenses.json"):
|
||||||
|
with open("licenses.json", "r") as fp:
|
||||||
|
licenses: tuple[str, ...] = json.load(fp)
|
||||||
|
else:
|
||||||
|
lnew("fetching SPDX license IDs")
|
||||||
|
|
||||||
|
licenses = tuple(license["licenseId"] for license in requests.get("https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json").json()["licenses"])
|
||||||
|
|
||||||
|
with open("licenses.json", "w") as fp:
|
||||||
|
json.dump(licenses, fp)
|
||||||
|
|
||||||
path: str = iinput("media path")
|
path: str = iinput("media path")
|
||||||
path = os.path.expanduser(path)
|
path = os.path.expanduser(path)
|
||||||
|
|
||||||
|
@ -1728,7 +1741,8 @@ def media(config: dict[str, typing.Any]) -> int:
|
||||||
|
|
||||||
purpose: str = iinput("media purpose")
|
purpose: str = iinput("media purpose")
|
||||||
title: str = iinput("media title")
|
title: str = iinput("media title")
|
||||||
license: str = iinput("media license (SPDX)")
|
license: str = ", ".join(select_multi(licenses))
|
||||||
|
|
||||||
credit: str = iinput("media credit")
|
credit: str = iinput("media credit")
|
||||||
|
|
||||||
# MIME stuff
|
# MIME stuff
|
||||||
|
|
Loading…
Add table
Reference in a new issue