forked from Shinonome/caelestia-cli
wallpaper: fix print command
This commit is contained in:
@@ -32,8 +32,10 @@ def get_colours_for_image(image: Path | str = wallpaper_thumbnail_path, scheme=N
|
|||||||
|
|
||||||
scheme = get_scheme()
|
scheme = get_scheme()
|
||||||
|
|
||||||
|
flavour = scheme.flavour if scheme.flavour in ("default", "alt1", "alt2") else "default"
|
||||||
|
|
||||||
cache_base = scheme_cache_dir / compute_hash(image)
|
cache_base = scheme_cache_dir / compute_hash(image)
|
||||||
cache = (cache_base / scheme.variant / scheme.flavour / scheme.mode).with_suffix(".json")
|
cache = (cache_base / scheme.variant / flavour / scheme.mode).with_suffix(".json")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with cache.open("r") as f:
|
with cache.open("r") as f:
|
||||||
@@ -42,7 +44,7 @@ def get_colours_for_image(image: Path | str = wallpaper_thumbnail_path, scheme=N
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
primaries, colours = get_score_for_image(image, cache_base)
|
primaries, colours = get_score_for_image(image, cache_base)
|
||||||
i = ["default", "alt1", "alt2"].index(scheme.flavour)
|
i = ["default", "alt1", "alt2"].index(flavour)
|
||||||
scheme = gen_scheme(scheme, primaries[i], colours)
|
scheme = gen_scheme(scheme, primaries[i], colours)
|
||||||
|
|
||||||
cache.parent.mkdir(parents=True, exist_ok=True)
|
cache.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|||||||
@@ -91,11 +91,14 @@ def get_colours_for_wall(wall: Path | str, no_smart: bool) -> None:
|
|||||||
scheme = get_scheme()
|
scheme = get_scheme()
|
||||||
cache = wallpapers_cache_dir / compute_hash(wall)
|
cache = wallpapers_cache_dir / compute_hash(wall)
|
||||||
|
|
||||||
if scheme.name == "dynamic" and not no_smart:
|
name = "dynamic"
|
||||||
|
flavour = scheme.flavour if scheme.flavour in ("default", "alt1", "alt2") else "default"
|
||||||
|
|
||||||
|
if not no_smart:
|
||||||
scheme = Scheme(
|
scheme = Scheme(
|
||||||
{
|
{
|
||||||
"name": scheme.name,
|
"name": name,
|
||||||
"flavour": scheme.flavour,
|
"flavour": flavour,
|
||||||
"mode": get_smart_mode(wall, cache),
|
"mode": get_smart_mode(wall, cache),
|
||||||
"variant": scheme.variant,
|
"variant": scheme.variant,
|
||||||
"colours": scheme.colours,
|
"colours": scheme.colours,
|
||||||
@@ -103,8 +106,8 @@ def get_colours_for_wall(wall: Path | str, no_smart: bool) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"name": scheme.name,
|
"name": name,
|
||||||
"flavour": scheme.flavour,
|
"flavour": flavour,
|
||||||
"mode": scheme.mode,
|
"mode": scheme.mode,
|
||||||
"variant": scheme.variant,
|
"variant": scheme.variant,
|
||||||
"colours": get_colours_for_image(get_thumb(wall, cache), scheme),
|
"colours": get_colours_for_image(get_thumb(wall, cache), scheme),
|
||||||
|
|||||||
Reference in New Issue
Block a user