anifetch-cli 1.0.0__tar.gz → 1.0.2__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.
- {anifetch_cli-1.0.0/src/anifetch_cli.egg-info → anifetch_cli-1.0.2}/PKG-INFO +20 -3
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/README.md +19 -2
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/pyproject.toml +1 -1
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch/cli.py +15 -2
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch/core.py +24 -21
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch/keyreader.py +7 -1
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch/renderer.py +4 -2
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch/utils.py +59 -10
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2/src/anifetch_cli.egg-info}/PKG-INFO +20 -3
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/LICENSE +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/setup.cfg +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch/__init__.py +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch/__main__.py +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch/assets/example.mp4 +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch_cli.egg-info/SOURCES.txt +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch_cli.egg-info/dependency_links.txt +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch_cli.egg-info/entry_points.txt +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch_cli.egg-info/requires.txt +0 -0
- {anifetch_cli-1.0.0 → anifetch_cli-1.0.2}/src/anifetch_cli.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anifetch-cli
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Animated terminal fetch with video and audio support.
|
|
5
5
|
Author-email: Notenlish <notenlish@gmail.com>
|
|
6
6
|
Maintainer: Immelancholy
|
|
@@ -65,7 +65,12 @@ winget install chafa ffmpeg fastfetch
|
|
|
65
65
|
|
|
66
66
|
You can install neofetch too but it is deprecated and not recommended. Run this to install: `winget install neofetch`
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
After installing the necessary dependencies using winget/scoop, install anifetch via pip. You can install it via pipx too.
|
|
69
|
+
|
|
70
|
+
```pip install anifetch-cli```
|
|
71
|
+
|
|
72
|
+
> [!WARNING]
|
|
73
|
+
> **Do not** install `anifetch` on pypi, it is not related with this project. Install `anifetch-cli`.
|
|
69
74
|
|
|
70
75
|
### Installation for MacOS with Homebrew
|
|
71
76
|
|
|
@@ -77,8 +82,12 @@ Run this in the terminal after verifying homebrew is installed:
|
|
|
77
82
|
brew install chafa ffmpeg fastfetch
|
|
78
83
|
```
|
|
79
84
|
|
|
80
|
-
|
|
85
|
+
After installing the necessary dependencies, install anifetch via pip . You can install it via pipx too.
|
|
81
86
|
|
|
87
|
+
```pip install anifetch-cli```
|
|
88
|
+
|
|
89
|
+
> [!WARNING]
|
|
90
|
+
> **Do not** install `anifetch` on pypi, it is not related with this project. Install `anifetch-cli`.
|
|
82
91
|
|
|
83
92
|
### Manual Installation
|
|
84
93
|
|
|
@@ -256,6 +265,12 @@ _Note : by default, the video `example.mp4` can directly be used as an example._
|
|
|
256
265
|
- `--quality`: Changes the output quality of ffmpeg when extracting frames. This doesn't have much effect on the quality or speed from my testing, so you shouldn't need to change this. 2 highest quality, 10 lowest quality.
|
|
257
266
|
- `--loop`: Determines how many times the animation should loop. Default is -1(always loop).
|
|
258
267
|
- `--no-key-exit`: Don't exit anifetch when user presses a key.
|
|
268
|
+
- `-c` / `--config`: Specify a non-default config for Neofetch/Fastfetch.
|
|
269
|
+
- Accepts a path or preset name (e.g. `main`).
|
|
270
|
+
- Neofetch (Linux/macOS): `~/.config/neofetch/main.conf`
|
|
271
|
+
- Fastfetch (Linux/macOS): `~/.config/fastfetch/main.jsonc`
|
|
272
|
+
- Fastfetch (Windows): `%APPDATA%\fastfetch\main.jsonc`
|
|
273
|
+
- See [Customizing Fastfetch/Neofetch](#customizing-fastfetchneofetch-output) for config details.
|
|
259
274
|
|
|
260
275
|
### Cached files:
|
|
261
276
|
|
|
@@ -309,6 +324,8 @@ As it can be seen, Anifetch is quite fast if you cache the animations.
|
|
|
309
324
|
|
|
310
325
|
Make sure to install the dependencies listed on [Prerequisites](#Prerequisites). If ffmpeg throws an error saying `libxm12.so.16: cannot open shared object file: No such file or directory exists` then you must install `libxm12`. Here's an comment showing how to install it for arch: [https://github.com/Notenlish/anifetch/issues/24#issuecomment-2920189918](solution)
|
|
311
326
|
|
|
327
|
+
If weird characters are appearing in your terminal then your terminals font probably can't render some characters. Consider installling [nerdfonts](https://www.nerdfonts.com/).
|
|
328
|
+
|
|
312
329
|
## Notes
|
|
313
330
|
|
|
314
331
|
Anifetch attempts to cache the animation so that it doesn't need to render them again when you run it with the same file. However, if the name of the file is the same, but it's contents has changed, it won't re-render it. In that case, you will need to add `--force-render` as an argument to `anifetch.py` so that it re-renders it. You only have to do this only once when you change the file contents.
|
|
@@ -38,7 +38,12 @@ winget install chafa ffmpeg fastfetch
|
|
|
38
38
|
|
|
39
39
|
You can install neofetch too but it is deprecated and not recommended. Run this to install: `winget install neofetch`
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
After installing the necessary dependencies using winget/scoop, install anifetch via pip. You can install it via pipx too.
|
|
42
|
+
|
|
43
|
+
```pip install anifetch-cli```
|
|
44
|
+
|
|
45
|
+
> [!WARNING]
|
|
46
|
+
> **Do not** install `anifetch` on pypi, it is not related with this project. Install `anifetch-cli`.
|
|
42
47
|
|
|
43
48
|
### Installation for MacOS with Homebrew
|
|
44
49
|
|
|
@@ -50,8 +55,12 @@ Run this in the terminal after verifying homebrew is installed:
|
|
|
50
55
|
brew install chafa ffmpeg fastfetch
|
|
51
56
|
```
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
After installing the necessary dependencies, install anifetch via pip . You can install it via pipx too.
|
|
54
59
|
|
|
60
|
+
```pip install anifetch-cli```
|
|
61
|
+
|
|
62
|
+
> [!WARNING]
|
|
63
|
+
> **Do not** install `anifetch` on pypi, it is not related with this project. Install `anifetch-cli`.
|
|
55
64
|
|
|
56
65
|
### Manual Installation
|
|
57
66
|
|
|
@@ -229,6 +238,12 @@ _Note : by default, the video `example.mp4` can directly be used as an example._
|
|
|
229
238
|
- `--quality`: Changes the output quality of ffmpeg when extracting frames. This doesn't have much effect on the quality or speed from my testing, so you shouldn't need to change this. 2 highest quality, 10 lowest quality.
|
|
230
239
|
- `--loop`: Determines how many times the animation should loop. Default is -1(always loop).
|
|
231
240
|
- `--no-key-exit`: Don't exit anifetch when user presses a key.
|
|
241
|
+
- `-c` / `--config`: Specify a non-default config for Neofetch/Fastfetch.
|
|
242
|
+
- Accepts a path or preset name (e.g. `main`).
|
|
243
|
+
- Neofetch (Linux/macOS): `~/.config/neofetch/main.conf`
|
|
244
|
+
- Fastfetch (Linux/macOS): `~/.config/fastfetch/main.jsonc`
|
|
245
|
+
- Fastfetch (Windows): `%APPDATA%\fastfetch\main.jsonc`
|
|
246
|
+
- See [Customizing Fastfetch/Neofetch](#customizing-fastfetchneofetch-output) for config details.
|
|
232
247
|
|
|
233
248
|
### Cached files:
|
|
234
249
|
|
|
@@ -282,6 +297,8 @@ As it can be seen, Anifetch is quite fast if you cache the animations.
|
|
|
282
297
|
|
|
283
298
|
Make sure to install the dependencies listed on [Prerequisites](#Prerequisites). If ffmpeg throws an error saying `libxm12.so.16: cannot open shared object file: No such file or directory exists` then you must install `libxm12`. Here's an comment showing how to install it for arch: [https://github.com/Notenlish/anifetch/issues/24#issuecomment-2920189918](solution)
|
|
284
299
|
|
|
300
|
+
If weird characters are appearing in your terminal then your terminals font probably can't render some characters. Consider installling [nerdfonts](https://www.nerdfonts.com/).
|
|
301
|
+
|
|
285
302
|
## Notes
|
|
286
303
|
|
|
287
304
|
Anifetch attempts to cache the animation so that it doesn't need to render them again when you run it with the same file. However, if the name of the file is the same, but it's contents has changed, it won't re-render it. In that case, you will need to add `--force-render` as an argument to `anifetch.py` so that it re-renders it. You only have to do this only once when you change the file contents.
|
|
@@ -24,7 +24,7 @@ keywords = [
|
|
|
24
24
|
"fastfetch",
|
|
25
25
|
"anifetch",
|
|
26
26
|
]
|
|
27
|
-
version = "1.0.
|
|
27
|
+
version = "1.0.2"
|
|
28
28
|
description = "Animated terminal fetch with video and audio support."
|
|
29
29
|
# If I put everyone here it messes with the "author" meta section.
|
|
30
30
|
authors = [{ name = "Notenlish", email = "notenlish@gmail.com" }]
|
|
@@ -75,7 +75,6 @@ parser.add_argument(
|
|
|
75
75
|
help="Disabled by default. Anifetch saves the filename to check if the file has changed, if the name is same, it won't render it again. If enabled, the video will be forcefully rendered, whether it has the same name or not. Please note that it only checks for filename, if you changed the framerate then you'll need to force render.",
|
|
76
76
|
)
|
|
77
77
|
parser.add_argument(
|
|
78
|
-
"-C",
|
|
79
78
|
"--center",
|
|
80
79
|
default=False,
|
|
81
80
|
action="store_true",
|
|
@@ -123,7 +122,7 @@ parser.add_argument(
|
|
|
123
122
|
"-nf",
|
|
124
123
|
"--neofetch",
|
|
125
124
|
default=False,
|
|
126
|
-
help="Add this argument if you want to use neofetch instead.",
|
|
125
|
+
help="Add this argument if you want to use neofetch instead. You may need to add --force on some linux distros too.",
|
|
127
126
|
action="store_true",
|
|
128
127
|
)
|
|
129
128
|
parser.add_argument(
|
|
@@ -160,6 +159,7 @@ parser.add_argument(
|
|
|
160
159
|
help="Delete one or more caches by number(s) (as listed with --cache-list)",
|
|
161
160
|
)
|
|
162
161
|
parser.add_argument(
|
|
162
|
+
"-C",
|
|
163
163
|
"--clear",
|
|
164
164
|
required=False,
|
|
165
165
|
action="store_true",
|
|
@@ -174,6 +174,19 @@ parser.add_argument(
|
|
|
174
174
|
action="store_true",
|
|
175
175
|
)
|
|
176
176
|
|
|
177
|
+
parser.add_argument(
|
|
178
|
+
"-c",
|
|
179
|
+
"--config",
|
|
180
|
+
default="",
|
|
181
|
+
help="Specify non-default config file for Neofetch/Fastfetch. Use a path or a preset name.\n"
|
|
182
|
+
"Examples:\n"
|
|
183
|
+
"- Linux/macOS:\n"
|
|
184
|
+
" - Neofetch: 'main' → ~/.config/neofetch/main.conf\n"
|
|
185
|
+
" - Fastfetch: 'main' → ~/.config/fastfetch/main.jsonc\n"
|
|
186
|
+
"- Windows:\n"
|
|
187
|
+
" - Fastfetch: 'main' → %%APPDATA%%\\fastfetch\\main.jsonc",
|
|
188
|
+
)
|
|
189
|
+
|
|
177
190
|
|
|
178
191
|
def parse_args():
|
|
179
192
|
return parser.parse_args()
|
|
@@ -30,15 +30,11 @@ from .utils import (
|
|
|
30
30
|
args_checker,
|
|
31
31
|
threaded_chafa_frame_gen,
|
|
32
32
|
get_fetch_output,
|
|
33
|
-
center_template_to_animation,
|
|
34
33
|
make_template_from_fetch_lines,
|
|
35
|
-
tput_cup,
|
|
36
|
-
get_lowest_y_pos,
|
|
37
|
-
clear_screen,
|
|
38
34
|
clear_screen_soft,
|
|
39
35
|
)
|
|
40
36
|
from typing import Literal
|
|
41
|
-
from concurrent.futures import ThreadPoolExecutor,
|
|
37
|
+
from concurrent.futures import ThreadPoolExecutor, Future
|
|
42
38
|
|
|
43
39
|
GAP = 2
|
|
44
40
|
PAD_LEFT = 4
|
|
@@ -130,6 +126,9 @@ def run_anifetch(args):
|
|
|
130
126
|
sys.exit(0)
|
|
131
127
|
|
|
132
128
|
filename = pathlib.Path(args.filename)
|
|
129
|
+
IS_GIF = False
|
|
130
|
+
if args.filename:
|
|
131
|
+
IS_GIF = True
|
|
133
132
|
|
|
134
133
|
# If the filename is relative, check if it exists in the assets directory.
|
|
135
134
|
if not filename.exists():
|
|
@@ -233,7 +232,7 @@ def run_anifetch(args):
|
|
|
233
232
|
|
|
234
233
|
# Get the fetch output(neofetch/fastfetch)
|
|
235
234
|
fetch_output: list[str] = get_fetch_output(
|
|
236
|
-
not args.neofetch, neofetch_status, args.force
|
|
235
|
+
not args.neofetch, neofetch_status, args.force, args.config
|
|
237
236
|
)
|
|
238
237
|
|
|
239
238
|
# copy fetch_output to fetch_lines
|
|
@@ -271,7 +270,9 @@ def run_anifetch(args):
|
|
|
271
270
|
str(
|
|
272
271
|
min(max(args.quality or 6, 2), 10)
|
|
273
272
|
), # 2-5 high quality, 6-10 lower
|
|
274
|
-
str(CACHE_PATH / "video/%05d.
|
|
273
|
+
str(CACHE_PATH / "video/%05d.png")
|
|
274
|
+
if IS_GIF
|
|
275
|
+
else str(CACHE_PATH / "video/%05d.jpg"),
|
|
275
276
|
],
|
|
276
277
|
stdout=stdout,
|
|
277
278
|
stderr=stderr,
|
|
@@ -313,8 +314,6 @@ def run_anifetch(args):
|
|
|
313
314
|
|
|
314
315
|
cleaned_dict["sound_saved_path"] = args.sound_saved_path
|
|
315
316
|
|
|
316
|
-
cleaned_dict["sound_saved_path"] = args.sound_saved_path
|
|
317
|
-
|
|
318
317
|
print_verbose(should_print_verbose, args.sound_saved_path)
|
|
319
318
|
|
|
320
319
|
# If the new anim frames is shorter than the old one, then in /output there will be both new and old frames.
|
|
@@ -336,10 +335,11 @@ def run_anifetch(args):
|
|
|
336
335
|
max_workers: int = max(1, (os.cpu_count() or 2) - 1)
|
|
337
336
|
max_workers = 1
|
|
338
337
|
|
|
338
|
+
chafa_args: str = args.chafa_arguments.strip()
|
|
339
|
+
chafa_args += (
|
|
340
|
+
" --format symbols" # Fixes https://github.com/Notenlish/anifetch/issues/1
|
|
341
|
+
)
|
|
339
342
|
with ThreadPoolExecutor(max_workers=max_workers) as executor:
|
|
340
|
-
chafa_args: str = args.chafa_arguments.strip()
|
|
341
|
-
chafa_args += " --format symbols" # Fixes https://github.com/Notenlish/anifetch/issues/1
|
|
342
|
-
|
|
343
343
|
for i, f in enumerate(animation_files):
|
|
344
344
|
future = executor.submit(
|
|
345
345
|
threaded_chafa_frame_gen,
|
|
@@ -483,18 +483,21 @@ def run_anifetch(args):
|
|
|
483
483
|
|
|
484
484
|
keyboard = Controller()
|
|
485
485
|
|
|
486
|
-
if
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
486
|
+
# needed because if I only enter one key even though the user pressed a bunch of keys the keys will be entered disorderly(only the a single key is not automatically entered and the other keys are entered)
|
|
487
|
+
# so we store the key, go to line start, enter the first key(that the user pressed) and then go to the end of line.
|
|
488
|
+
# that way even if the user presses a bunch of keys, it will all be in order.
|
|
489
|
+
|
|
490
|
+
# start of line
|
|
491
|
+
keyboard.press(Key.home)
|
|
492
|
+
keyboard.release(Key.home)
|
|
490
493
|
|
|
491
|
-
|
|
494
|
+
keyboard.press(renderer.last_key)
|
|
492
495
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
+
# end of line
|
|
497
|
+
keyboard.press(Key.end)
|
|
498
|
+
keyboard.release(Key.end)
|
|
496
499
|
|
|
497
|
-
|
|
500
|
+
keyboard.release(renderer.last_key)
|
|
498
501
|
|
|
499
502
|
if pathlib.Path(VIDEO_DIR).exists():
|
|
500
503
|
shutil.rmtree(VIDEO_DIR) # no need to keep the video frames.
|
|
@@ -2,6 +2,7 @@ import os
|
|
|
2
2
|
import sys
|
|
3
3
|
import atexit
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
class KeyReader:
|
|
6
7
|
"""
|
|
7
8
|
Cross-platform, non-blocking key reader for terminal animations.
|
|
@@ -9,12 +10,14 @@ class KeyReader:
|
|
|
9
10
|
- macOS/Linux: termios + select
|
|
10
11
|
Restores terminal settings on exit.
|
|
11
12
|
"""
|
|
13
|
+
|
|
12
14
|
def __init__(self):
|
|
13
|
-
self.is_windows =
|
|
15
|
+
self.is_windows = os.name == "nt"
|
|
14
16
|
self._started = False
|
|
15
17
|
|
|
16
18
|
if not self.is_windows:
|
|
17
19
|
import termios
|
|
20
|
+
|
|
18
21
|
self.termios = termios
|
|
19
22
|
self.fd = sys.stdin.fileno()
|
|
20
23
|
self.old_attrs = None
|
|
@@ -26,6 +29,7 @@ class KeyReader:
|
|
|
26
29
|
|
|
27
30
|
if not self.is_windows:
|
|
28
31
|
import tty
|
|
32
|
+
|
|
29
33
|
self.old_attrs = self.termios.tcgetattr(self.fd)
|
|
30
34
|
tty.setcbreak(self.fd) # no-Enter input, but less aggressive than raw
|
|
31
35
|
atexit.register(self.stop)
|
|
@@ -52,6 +56,7 @@ class KeyReader:
|
|
|
52
56
|
|
|
53
57
|
if self.is_windows:
|
|
54
58
|
import msvcrt
|
|
59
|
+
|
|
55
60
|
if not msvcrt.kbhit():
|
|
56
61
|
return None
|
|
57
62
|
ch = msvcrt.getwch()
|
|
@@ -61,6 +66,7 @@ class KeyReader:
|
|
|
61
66
|
return ch
|
|
62
67
|
else:
|
|
63
68
|
import select
|
|
69
|
+
|
|
64
70
|
r, _, _ = select.select([sys.stdin], [], [], 0)
|
|
65
71
|
if not r:
|
|
66
72
|
return None
|
|
@@ -194,7 +194,9 @@ class Renderer:
|
|
|
194
194
|
if self.is_centered:
|
|
195
195
|
# self._some_max_height -1 is needed to properly align it for some reason. Dont question it.
|
|
196
196
|
self.layout["main"]["chafa"].update(
|
|
197
|
-
Align.center(
|
|
197
|
+
Align.center(
|
|
198
|
+
chafa_t, vertical="middle", height=self._some_max_height - 1
|
|
199
|
+
)
|
|
198
200
|
)
|
|
199
201
|
else:
|
|
200
202
|
self.layout["main"]["chafa"].update(chafa_t)
|
|
@@ -266,7 +268,7 @@ class Renderer:
|
|
|
266
268
|
refresh_per_second=20,
|
|
267
269
|
screen=True,
|
|
268
270
|
transient=True, # if false, keep the last frame
|
|
269
|
-
)
|
|
271
|
+
):
|
|
270
272
|
self.draw_loop()
|
|
271
273
|
# enable_autowrap()
|
|
272
274
|
except KeyboardInterrupt:
|
|
@@ -11,8 +11,6 @@ import re
|
|
|
11
11
|
import subprocess
|
|
12
12
|
import os
|
|
13
13
|
import sys
|
|
14
|
-
from importlib.resources import files, as_file
|
|
15
|
-
from importlib.resources.abc import Traversable
|
|
16
14
|
from importlib.metadata import version, PackageNotFoundError
|
|
17
15
|
import shutil
|
|
18
16
|
from copy import deepcopy
|
|
@@ -44,7 +42,6 @@ SYNC_END = ESC + "?2026l"
|
|
|
44
42
|
# Retrieved 2025-12-21, License - CC BY-SA 4.0
|
|
45
43
|
|
|
46
44
|
if os.name == "nt":
|
|
47
|
-
import msvcrt
|
|
48
45
|
import ctypes
|
|
49
46
|
|
|
50
47
|
class _CursorInfo(ctypes.Structure):
|
|
@@ -237,6 +234,7 @@ def strip_ansi(text):
|
|
|
237
234
|
def get_text_length_of_formatted_text(text: str):
|
|
238
235
|
text = strip_ansi(text)
|
|
239
236
|
return len(text)
|
|
237
|
+
# return get_character_width(text)
|
|
240
238
|
|
|
241
239
|
|
|
242
240
|
def get_ext_from_codec(codec):
|
|
@@ -357,16 +355,41 @@ def get_fetch_output(
|
|
|
357
355
|
use_fastfetch: bool,
|
|
358
356
|
neofetch_status: Literal["neofetch", "uninstalled", "wrapper"],
|
|
359
357
|
force_neofetch: bool,
|
|
358
|
+
config_file: str,
|
|
360
359
|
):
|
|
361
360
|
fetch_output: list[str]
|
|
361
|
+
|
|
362
362
|
if not use_fastfetch: # use neofetch
|
|
363
363
|
if (
|
|
364
364
|
neofetch_status == "wrapper" and force_neofetch
|
|
365
365
|
) or neofetch_status == "neofetch":
|
|
366
366
|
# Get Neofetch Output
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
|
|
368
|
+
output: list = ["neofetch", "--off"]
|
|
369
|
+
if config_file:
|
|
370
|
+
if config_file.endswith(
|
|
371
|
+
".conf"
|
|
372
|
+
): # if user input config path directly (~/.config/neofetch/custom.conf or /home/user/custom.conf etc.)
|
|
373
|
+
if not Path(config_file).exists():
|
|
374
|
+
print(
|
|
375
|
+
f"Config file {config_file} not found. Make sure the path is correct.",
|
|
376
|
+
file=sys.stderr,
|
|
377
|
+
)
|
|
378
|
+
sys.exit(1)
|
|
379
|
+
else: # if user input a preset name, look for it in ~/.config/neofetch/{preset_name}.conf
|
|
380
|
+
config_file = str(
|
|
381
|
+
Path.home() / ".config/neofetch" / f"{config_file}.conf"
|
|
382
|
+
)
|
|
383
|
+
if not Path(config_file).exists():
|
|
384
|
+
print(
|
|
385
|
+
f"Config file {config_file} not found. Make sure the preset name is correct and the corresponding config file exists in ~/.config/neofetch/.",
|
|
386
|
+
file=sys.stderr,
|
|
387
|
+
)
|
|
388
|
+
sys.exit(1)
|
|
389
|
+
output += ["--config", config_file]
|
|
390
|
+
# print(output)
|
|
391
|
+
|
|
392
|
+
fetch_output = subprocess.check_output(output, text=True).splitlines()
|
|
370
393
|
|
|
371
394
|
elif neofetch_status == "uninstalled":
|
|
372
395
|
print(
|
|
@@ -381,11 +404,35 @@ def get_fetch_output(
|
|
|
381
404
|
file=sys.stderr,
|
|
382
405
|
)
|
|
383
406
|
sys.exit(1)
|
|
384
|
-
else:
|
|
407
|
+
else: # use fastfetch
|
|
385
408
|
try:
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
409
|
+
output: list = ["fastfetch", "--logo", "none", "--pipe", "false"]
|
|
410
|
+
if config_file:
|
|
411
|
+
if config_file.endswith(
|
|
412
|
+
".jsonc"
|
|
413
|
+
): # if user input config path directly (~/.config/fastfetch/custom.jsonc or /home/user/custom.jsonc)
|
|
414
|
+
if not Path(config_file).exists():
|
|
415
|
+
print(
|
|
416
|
+
f"Config file {config_file} not found. Make sure the path is correct.",
|
|
417
|
+
file=sys.stderr,
|
|
418
|
+
)
|
|
419
|
+
sys.exit(1)
|
|
420
|
+
|
|
421
|
+
# this part is actually optional because fastfetch have built in tools like this but this is for checking valid config
|
|
422
|
+
else: # if user input a preset name, look for it in ~/.config/fastfetch/{preset_name}.jsonc
|
|
423
|
+
config_file = str(
|
|
424
|
+
Path.home() / ".config/fastfetch" / f"{config_file}.jsonc"
|
|
425
|
+
)
|
|
426
|
+
if not Path(config_file).exists():
|
|
427
|
+
print(
|
|
428
|
+
f"Config file {config_file} not found. Make sure the preset name is correct and the corresponding config file exists in ~/.config/fastfetch/.",
|
|
429
|
+
file=sys.stderr,
|
|
430
|
+
)
|
|
431
|
+
sys.exit(1)
|
|
432
|
+
output += ["--config", config_file]
|
|
433
|
+
|
|
434
|
+
fetch_output = subprocess.check_output(output, text=True).splitlines()
|
|
435
|
+
|
|
389
436
|
except FileNotFoundError as e:
|
|
390
437
|
if e.errno == errno.ENOENT:
|
|
391
438
|
print(
|
|
@@ -414,6 +461,7 @@ def make_template_from_fetch_lines(
|
|
|
414
461
|
template: list[str] = "\n".join(fetch_lines)
|
|
415
462
|
# Only do this once instead of for every line.
|
|
416
463
|
template_actual_width = get_text_length_of_formatted_text(fetch_lines[0])
|
|
464
|
+
# template_actual_width = max((get_text_length_of_formatted_text(line) for line in fetch_lines), default=0)
|
|
417
465
|
return (template, template_actual_width)
|
|
418
466
|
|
|
419
467
|
|
|
@@ -484,6 +532,7 @@ def clean_cache_args(cache_args: dict) -> dict:
|
|
|
484
532
|
"center",
|
|
485
533
|
"loop",
|
|
486
534
|
"no_key_exit",
|
|
535
|
+
"config",
|
|
487
536
|
)
|
|
488
537
|
cleaned = deepcopy(cache_args) # need to deepcopy to not modify original dict.
|
|
489
538
|
for key in args_to_remove:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: anifetch-cli
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Animated terminal fetch with video and audio support.
|
|
5
5
|
Author-email: Notenlish <notenlish@gmail.com>
|
|
6
6
|
Maintainer: Immelancholy
|
|
@@ -65,7 +65,12 @@ winget install chafa ffmpeg fastfetch
|
|
|
65
65
|
|
|
66
66
|
You can install neofetch too but it is deprecated and not recommended. Run this to install: `winget install neofetch`
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
After installing the necessary dependencies using winget/scoop, install anifetch via pip. You can install it via pipx too.
|
|
69
|
+
|
|
70
|
+
```pip install anifetch-cli```
|
|
71
|
+
|
|
72
|
+
> [!WARNING]
|
|
73
|
+
> **Do not** install `anifetch` on pypi, it is not related with this project. Install `anifetch-cli`.
|
|
69
74
|
|
|
70
75
|
### Installation for MacOS with Homebrew
|
|
71
76
|
|
|
@@ -77,8 +82,12 @@ Run this in the terminal after verifying homebrew is installed:
|
|
|
77
82
|
brew install chafa ffmpeg fastfetch
|
|
78
83
|
```
|
|
79
84
|
|
|
80
|
-
|
|
85
|
+
After installing the necessary dependencies, install anifetch via pip . You can install it via pipx too.
|
|
81
86
|
|
|
87
|
+
```pip install anifetch-cli```
|
|
88
|
+
|
|
89
|
+
> [!WARNING]
|
|
90
|
+
> **Do not** install `anifetch` on pypi, it is not related with this project. Install `anifetch-cli`.
|
|
82
91
|
|
|
83
92
|
### Manual Installation
|
|
84
93
|
|
|
@@ -256,6 +265,12 @@ _Note : by default, the video `example.mp4` can directly be used as an example._
|
|
|
256
265
|
- `--quality`: Changes the output quality of ffmpeg when extracting frames. This doesn't have much effect on the quality or speed from my testing, so you shouldn't need to change this. 2 highest quality, 10 lowest quality.
|
|
257
266
|
- `--loop`: Determines how many times the animation should loop. Default is -1(always loop).
|
|
258
267
|
- `--no-key-exit`: Don't exit anifetch when user presses a key.
|
|
268
|
+
- `-c` / `--config`: Specify a non-default config for Neofetch/Fastfetch.
|
|
269
|
+
- Accepts a path or preset name (e.g. `main`).
|
|
270
|
+
- Neofetch (Linux/macOS): `~/.config/neofetch/main.conf`
|
|
271
|
+
- Fastfetch (Linux/macOS): `~/.config/fastfetch/main.jsonc`
|
|
272
|
+
- Fastfetch (Windows): `%APPDATA%\fastfetch\main.jsonc`
|
|
273
|
+
- See [Customizing Fastfetch/Neofetch](#customizing-fastfetchneofetch-output) for config details.
|
|
259
274
|
|
|
260
275
|
### Cached files:
|
|
261
276
|
|
|
@@ -309,6 +324,8 @@ As it can be seen, Anifetch is quite fast if you cache the animations.
|
|
|
309
324
|
|
|
310
325
|
Make sure to install the dependencies listed on [Prerequisites](#Prerequisites). If ffmpeg throws an error saying `libxm12.so.16: cannot open shared object file: No such file or directory exists` then you must install `libxm12`. Here's an comment showing how to install it for arch: [https://github.com/Notenlish/anifetch/issues/24#issuecomment-2920189918](solution)
|
|
311
326
|
|
|
327
|
+
If weird characters are appearing in your terminal then your terminals font probably can't render some characters. Consider installling [nerdfonts](https://www.nerdfonts.com/).
|
|
328
|
+
|
|
312
329
|
## Notes
|
|
313
330
|
|
|
314
331
|
Anifetch attempts to cache the animation so that it doesn't need to render them again when you run it with the same file. However, if the name of the file is the same, but it's contents has changed, it won't re-render it. In that case, you will need to add `--force-render` as an argument to `anifetch.py` so that it re-renders it. You only have to do this only once when you change the file contents.
|
|
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
|