vega-cli 0.1.3__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {vega_cli-0.1.3 → vega_cli-0.1.4}/PKG-INFO +1 -1
- {vega_cli-0.1.3 → vega_cli-0.1.4}/pyproject.toml +1 -1
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/display.py +1 -1
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/images.py +28 -14
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli.egg-info/PKG-INFO +1 -1
- {vega_cli-0.1.3 → vega_cli-0.1.4}/README.md +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/setup.cfg +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/__init__.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/__main__.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/cli.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/config.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/downloader.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/history.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/html.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/interactive.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/player.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/__init__.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/ani_dream.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/anikoto.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/animesalt.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/animesub.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/animeworld.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/auto_embed.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/castle.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/cncverse.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/__init__.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/aes.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/aniskip.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/base_url.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/cinemeta.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/errors.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/__init__.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/abbasy.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/buzzheavier.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/cinejoy.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/gdflix.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/gofile.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/hubcloud.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/movy.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/st111477.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/transferit.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/vegadrive.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/vidstuck.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/zcloud.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/extractors/zypter.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/headers.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/http.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/net_mirror.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/theintrodb.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/common/unpack.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/disney_mirror.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/dramacool.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/drive.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/durbin_live.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/eon_movies.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/extraflix.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/four_khdhub.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/goku_hd.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/hdhub4u.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/internet_archive.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/kartoons.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/kartoons2.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/katmovies.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/kick_ass_anime.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/kiss_kh.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/live_tg_tv.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/lux_movies.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/mod.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/movie_box_web.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/movielinkdb.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/movies4u.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/moviezwap.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/mxplayer.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/netflix_mirror.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/one_cinevood.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/prime_mirror.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/rareanimes.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/registry.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/showbox.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/topmovies.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/torrentio.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/uhd.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/vega.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/youtube.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/providers/zeefliz.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/search_all.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/store.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli/utils.py +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli.egg-info/SOURCES.txt +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli.egg-info/dependency_links.txt +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli.egg-info/entry_points.txt +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli.egg-info/requires.txt +0 -0
- {vega_cli-0.1.3 → vega_cli-0.1.4}/vega_cli.egg-info/top_level.txt +0 -0
|
@@ -240,7 +240,7 @@ def print_meta(info: dict[str, Any], *, show_image: bool = True) -> None:
|
|
|
240
240
|
if show_image:
|
|
241
241
|
poster_url = info.get("poster") or info.get("image") or ""
|
|
242
242
|
if poster_url:
|
|
243
|
-
render_image_url(poster_url, width=
|
|
243
|
+
render_image_url(poster_url, width=64, height=32)
|
|
244
244
|
console.print(
|
|
245
245
|
Panel(
|
|
246
246
|
f"[bold]{info.get('title', '')}[/bold] ({info.get('type', '')})\n"
|
|
@@ -1,40 +1,52 @@
|
|
|
1
|
-
"""Cross-platform terminal image renderer (Kitty, iTerm2/WezTerm, and 24-bit half-block fallback)."""
|
|
1
|
+
"""Cross-platform terminal image renderer (Kitty, iTerm2/WezTerm/Warp, and 24-bit half-block fallback)."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import base64
|
|
6
6
|
import io
|
|
7
7
|
import os
|
|
8
|
+
import shutil
|
|
8
9
|
import sys
|
|
9
10
|
from typing import Any
|
|
10
11
|
|
|
11
12
|
import requests
|
|
12
|
-
from PIL import Image
|
|
13
|
+
from PIL import Image, ImageEnhance
|
|
13
14
|
|
|
14
15
|
from .config import DEFAULT_HEADERS
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
def _detect_protocol() -> str:
|
|
18
19
|
"""Detect the best supported image protocol for the current terminal."""
|
|
20
|
+
override = os.environ.get("VEGA_IMAGE_PROTOCOL", "").strip().lower()
|
|
21
|
+
if override in ("kitty", "iterm2", "halfblock"):
|
|
22
|
+
return override
|
|
23
|
+
|
|
19
24
|
term_program = os.environ.get("TERM_PROGRAM", "")
|
|
20
25
|
term = os.environ.get("TERM", "")
|
|
21
26
|
lc_terminal = os.environ.get("LC_TERMINAL", "")
|
|
22
27
|
|
|
23
|
-
if
|
|
28
|
+
if (
|
|
29
|
+
os.environ.get("KITTY_WINDOW_ID")
|
|
30
|
+
or "kitty" in term.lower()
|
|
31
|
+
or term_program.lower() == "ghostty"
|
|
32
|
+
):
|
|
24
33
|
return "kitty"
|
|
25
|
-
if
|
|
34
|
+
if (
|
|
35
|
+
term_program in ("iTerm.app", "WezTerm", "WarpTerminal", "mintty")
|
|
36
|
+
or lc_terminal == "iTerm2"
|
|
37
|
+
):
|
|
26
38
|
return "iterm2"
|
|
27
39
|
return "halfblock"
|
|
28
40
|
|
|
29
41
|
|
|
30
|
-
def _emit_iterm2(raw_bytes: bytes, cols: int =
|
|
42
|
+
def _emit_iterm2(raw_bytes: bytes, cols: int = 44) -> None:
|
|
31
43
|
b64 = base64.b64encode(raw_bytes).decode("ascii")
|
|
32
44
|
seq = f"\x1b]1337;File=inline=1;width={cols};preserveAspectRatio=1:{b64}\x07\n"
|
|
33
45
|
sys.stdout.write(seq)
|
|
34
46
|
sys.stdout.flush()
|
|
35
47
|
|
|
36
48
|
|
|
37
|
-
def _emit_kitty(img: Image.Image, cols: int =
|
|
49
|
+
def _emit_kitty(img: Image.Image, cols: int = 44) -> None:
|
|
38
50
|
buf = io.BytesIO()
|
|
39
51
|
img.convert("RGBA").save(buf, format="PNG")
|
|
40
52
|
b64 = base64.b64encode(buf.getvalue()).decode("ascii")
|
|
@@ -50,15 +62,16 @@ def _emit_kitty(img: Image.Image, cols: int = 30) -> None:
|
|
|
50
62
|
sys.stdout.flush()
|
|
51
63
|
|
|
52
64
|
|
|
53
|
-
def render_halfblock(img: Image.Image, max_width: int =
|
|
54
|
-
"""Render a PIL Image as 24-bit ANSI Unicode half-block art (cross-platform)."""
|
|
65
|
+
def render_halfblock(img: Image.Image, max_width: int = 64, max_height: int = 32) -> str:
|
|
66
|
+
"""Render a PIL Image as crisp 24-bit ANSI Unicode half-block art (cross-platform)."""
|
|
55
67
|
rgb = img.convert("RGB")
|
|
56
68
|
w, h = rgb.size
|
|
57
69
|
if w <= 0 or h <= 0:
|
|
58
70
|
return ""
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
term_cols = shutil.get_terminal_size((80, 24)).columns
|
|
73
|
+
capped_w = max(16, min(max_width, term_cols - 2, w))
|
|
74
|
+
target_w = capped_w
|
|
62
75
|
target_h = max(2, int(round((h / w) * target_w)))
|
|
63
76
|
if target_h > max_height * 2:
|
|
64
77
|
target_h = max_height * 2
|
|
@@ -67,6 +80,7 @@ def render_halfblock(img: Image.Image, max_width: int = 44, max_height: int = 24
|
|
|
67
80
|
target_h += 1
|
|
68
81
|
|
|
69
82
|
resized = rgb.resize((target_w, target_h), Image.Resampling.LANCZOS)
|
|
83
|
+
resized = ImageEnhance.Sharpness(resized).enhance(1.35)
|
|
70
84
|
pixels: Any = resized.load()
|
|
71
85
|
lines: list[str] = []
|
|
72
86
|
for y in range(0, target_h, 2):
|
|
@@ -83,8 +97,8 @@ def render_halfblock(img: Image.Image, max_width: int = 44, max_height: int = 24
|
|
|
83
97
|
def render_image_url(
|
|
84
98
|
url: str,
|
|
85
99
|
*,
|
|
86
|
-
width: int =
|
|
87
|
-
height: int =
|
|
100
|
+
width: int = 64,
|
|
101
|
+
height: int = 32,
|
|
88
102
|
timeout: float = 5.0,
|
|
89
103
|
) -> bool:
|
|
90
104
|
"""Fetch an image URL and render it in the terminal. Returns True on success."""
|
|
@@ -106,10 +120,10 @@ def render_image_url(
|
|
|
106
120
|
|
|
107
121
|
proto = _detect_protocol()
|
|
108
122
|
if proto == "iterm2":
|
|
109
|
-
_emit_iterm2(raw, cols=width)
|
|
123
|
+
_emit_iterm2(raw, cols=min(width, 44))
|
|
110
124
|
return True
|
|
111
125
|
if proto == "kitty":
|
|
112
|
-
_emit_kitty(img, cols=width)
|
|
126
|
+
_emit_kitty(img, cols=min(width, 44))
|
|
113
127
|
return True
|
|
114
128
|
|
|
115
129
|
art = render_halfblock(img, max_width=width, max_height=height)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|