Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 34 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,27 @@

This is a small tool built with neofetch/fastfetch, ffmpeg and chafa. It allows you to use neofetch or fastfetch while having animations.

## 🛠️ How to Install
## Installation

### Prerequisites
### Automatic Installation

Recommended Python version: 3.12 and later
Recommended Python version: 3.12 and later.

Run this in the terminal.

```bash
curl https://raw.githubusercontent.com/Notenlish/anifetch/refs/heads/main/install.sh | bash
```

After installation, run this to test if anifetch was installed correctly:

```bash
anifetch example.mp4
```

---

### Manual Installation

You need the following tools installed on your system:

Expand All @@ -27,12 +43,6 @@ You need the following tools installed on your system:
- Debian/Ubuntu: `sudo apt install ffmpeg`
- [Other systems – Download](https://www.ffmpeg.org/download.html)

⚠️ Make sure `ffplay` is included in your `ffmpeg` installation (used for optional sound playback).

---

### ✅ Recommended Installation: via `pipx`

🔧 Make sure `pipx` is installed:

```bash
Expand All @@ -51,9 +61,10 @@ You can then run the `anifetch` command **directly in your terminal**.

Since pipx installs packages in an isolated environment, you won't have to worry about dependency conflicts or polluting your global python environment. `anifetch` will behave just like a native cli tool. You can upgrade your installation with `pipx upgrade anifetch`


---

### ❄️ NixOS installation via flakes
### ❄️ Installation for NixOS via flakes

❄️ Add the anifetch repo as a flake input:

Expand Down Expand Up @@ -122,7 +133,7 @@ After you've done these steps, rebuild your system.

---

### 👨‍💻 Developer Installation (for contributors): via `pip` in a virtual environment
### Developer Installation (for contributors):

```bash
git clone https://github.com/Notenlish/anifetch.git
Expand Down Expand Up @@ -153,9 +164,9 @@ inside the anifetch dir after cloning the repo. This creates a python venv you c

## ▶️ How to Use It

You don't need to configure anything for `fastfetch` or `neofetch`. If they already work on your machine, `anifetch` will detect and use them automatically. Please note that one of these must be installed, otherwise anifetch won't work. To use **fastfetch**, you must append `-ff` to the anifetch command.
You don't need to configure anything for `fastfetch` or `neofetch`. If they already work on your machine, `anifetch` will detect and use them automatically. Please note that at least one of these must be installed, otherwise anifetch won't work. To use **fastfetch**, you must append `-ff` to the anifetch command.

Place your video or gif file anywhere (e.g. your project folder). If you give a relative path then you must be in the correct folder. Anifetch is packaged with an `example.mp4` video by default. You can use that to test anifetch.
Simply `cd` to the directory your video file is located in and do `anifetch [relative_path]`. You can also use absolute paths. Anifetch is packaged with an `example.mp4` video by default. You can use that to test anifetch.

Any video file you give to anifetch will be stored in `~/.local/share/anifetch/assets` folder for linux and `C:\\Users\\[Username]\\AppData\\Local\\anifetch\\anifetch\\assets` folder for windows. After running `anifetch` with this video file once, next time use anifetch, you will be able to use that same video file in any location by just using its filename, since the video file has been saved in `/assets`.

Expand All @@ -169,15 +180,17 @@ _Note : by default, the video `example.mp4` can directly be used as an example._

### Optional arguments:

- `-f` / `--file`: path to the video file (the path can be added without the `-f` argument)
- `-s` / `--sound`: optional sound file to play alongside (requires `ffplay`)
- `-s` / `--sound`: Plays sound along with the video. If you provide a sound file, it will use it, otherwise will use ffmpg to extract audio from the video.
- `-r` / `--framerate`: frame rate of playback
- `-W` / `--width`: video width
- `-H` / `--height`: video height (may be automatically fixed with the width)
- `-c` / `--chafa`: extra arguments to pass to `chafa`
- `-C` / `--center`: centers the terminal animation vertically
- `-ff` / `--fast-fetch`: uses `fastfetch` instead of `neofetch` if available
- `-fr` / `--force-render`: Forcefully re-renders the animation while not caring about the cache. Useful if the cache is broken.
- `-fr` / `--force-render`: Forcefully re-renders the animation while not caring about the cache. Useful if the cache is broken or the contents of the video file has changed.
- `-b` / `--benchmark`: For testing, prints how long it took to process.
- `--force`: Add this argument if you want to use neofetch even if it is deprecated on your system.
- `--chroma`: Add this argument to chromakey a hexadecimal color from the video using ffmpeg. Syntax: '--chroma <hex-color>:<similiarity>:<blend>'

### Cached files:

Expand Down Expand Up @@ -218,19 +231,15 @@ As it can be seen, **Anifetch** is quite fast if you cache the animations, espec

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)

## 📝 Notes
## Notes

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.

Also, ffmpeg can generate the the same image for 2 consecutive frames, which may make it appear like it's stuttering. Try changing the framerate if that happens. Or just increase the playback rate.

Seperating video into frames takes some time and can potentially use up a lot of space during caching. After caching is done the video images will be deleted. Also note that you need to set the same framerate as the audio when playing a video. Otherwise video and audio will desync.

If you set animation resolution really big it may not be able to keep up with the audio. I have plans for optimizing the script so this is less of an issues.

Currently only the `symbols` format of chafa is supported, formats like kitty, iterm etc. are not supported. If you try to tell chafa to use iterm, kitty etc. it will just override your format with `symbols` mode.

## 🚧 What's Next
## What's Next

- [x] Add music support

Expand Down Expand Up @@ -264,11 +273,9 @@ Currently only the `symbols` format of chafa is supported, formats like kitty, i

- [ ] Update the animated logo on the readme so that its resolution is smaller + each individual symbol is bigger.

- [ ] Create an installer bash script to provide an easy installation option for people.

- [ ] Add an option to generate an mp4 with the terminal rendered animation(for putting it as a desktop background)
- [x] Create an installer bash script to provide an easy installation option for people.

## 💻 Dev commands
## Dev commands

Devs can use additional tools in the `tools` folder in order to test new features from Anifetch.

Expand All @@ -278,7 +285,7 @@ Neofetch: [Neofetch](https://github.com/dylanaraps/neofetch)

I got the base neofetch config from here, spesifically the Bejkon 2 config file: [Neofetch Themes by Chick2D](https://github.com/Chick2D/neofetch-themes)

I'd like to thank Pewdiepie for creating his Linux video. I got the inspiration for this tool from his video. [Video](https://m.youtube.com/watch?v=pVI_smLgTY0&t=878s&pp=ygUJcGV3ZGllcGll)
I got the inspiration for Anifetch from Pewdiepie's Linux video. [Video](https://m.youtube.com/watch?v=pVI_smLgTY0&t=878s&pp=ygUJcGV3ZGllcGll)

## Star History

Expand Down
87 changes: 87 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash

. /etc/os-release

echo "Detected OS ID: $ID"
echo "Detected OS ID_LIKE: $ID_LIKE"

install_anifetch() {
echo "Installing anifetch..."

if pipx upgrade anifetch &> /dev/null; then
echo "anifetch upgraded successfully (or was already at the latest version from GitHub)."
else
echo "anifetch not found or upgrade failed. Performing initial installation from GitHub..."
pipx install git+https://github.com/Notenlish/anifetch.git
echo "anifetch installed successfully."
fi
echo "anifetch installation/upgrade process completed."
}

if [[ "$ID" == "debian" || "$ID" == "ubuntu" || "$ID" == "linuxmint" || "$ID_LIKE" =~ "debian" || "$ID_LIKE" =~ "ubuntu" ]]; then
echo "Detected Debian/Ubuntu-based distribution. Using apt."
sudo apt update
sudo apt install -y bc chafa ffmpeg python3-pip git
sudo apt install -y pipx
# what is -y
pipx ensurepath
install_anifetch

elif [[ "$ID" == "arch" || "$ID" == "manjaro" || "$ID_LIKE" =~ "arch" ]]; then
echo "Detected Arch-based distribution. Using pacman."
sudo pacman -Sy --noconfirm bc chafa ffmpeg python-pip git
sudo pacman -Sy --noconfirm python-pipx
# what is -Sy and --noconfirm
pipx ensurepath
install_anifetch

elif [[ "$ID" == "fedora" || "$ID" == "rhel" || "$ID" == "centos" || "$ID" == "rocky" || "$ID" == "almalinux" || "$ID_LIKE" =~ "fedora" || "$ID_LIKE" =~ "rhel" ]]; then
echo "Detected Fedora/RHEL-based distribution. Using dnf."
sudo dnf install -y bc chafa ffmpeg python3-pip git
sudo dnf install -y neofetch
sudo dnf install -y fastfetch
sudo dnf install -y pipx
# what is -y
pipx ensurepath
install_anifetch

elif [[ "$ID" == "opensuse" || "$ID_LIKE" =~ "suse" ]]; then
echo "Detected openSUSE-based distribution. Using zypper."
sudo zypper --non-interactive install bc chafa ffmpeg python3-pip git
sudo zypper --non-interactive install python3-pipx
# what is -y
pipx ensurepath
install_anifetch

# Generic Linux fallback
else
echo "Detected other Linux distribution ($ID). Attempting to install common packages."
echo "Please ensure you have a package manager like apt, pacman, or dnf installed."
echo "Trying to install bc, chafa, ffmpeg, and pipx. This might require manual intervention."

# Attempt to install common tools, assuming one of the package managers might be present
if command -v apt &> /dev/null; then
sudo apt update
sudo apt install -y bc chafa ffmpeg python3-pip git
sudo apt install -y pipx
elif command -v pacman &> /dev/null; then
sudo pacman -Sy --noconfirm bc chafa ffmpeg git python-pip
sudo pacman -Sy --noconfirm python-pipx
elif command -v dnf &> /dev/null; then
sudo dnf install -y bc chafa ffmpeg python3-pip git
sudo dnf install -y neofetch
sudo dnf install -y fastfetch
sudo dnf install -y pipx
elif command -v zypper &> /dev/null; then
sudo zypper --non-interactive install bc chafa ffmpeg python3-pip git
sudo zypper --non-interactive install python3-pipx
else
echo "No common package manager found. Please install bc, chafa, ffmpeg, git, and pipx manually."
echo "You might need to install Python 3 and pip first."
fi

pipx ensurepath
install_anifetch
fi

echo "Installation script finished."
5 changes: 4 additions & 1 deletion src/anifetch/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def run_anifetch(args):

args.sound_flag_given = check_sound_flag_given(sys.argv)
args.chroma_flag_given = args.chroma is not None
neofetch_status = get_neofetch_status()

neofetch_status = "uninstalled"
if not args.fast_fetch:
neofetch_status = get_neofetch_status()

BASE_PATH = get_data_path()

Expand Down
5 changes: 2 additions & 3 deletions src/anifetch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ def get_neofetch_status(): # will still save the rendered chafa in cache in any
["neofetch", "--version"], capture_output=True, text=True
)
output = result.stdout + result.stderr
if (
"fastfetch" in output.lower()
): # if the output contains "fastfetch", return wrapper
# if the output contains "fastfetch", return wrapper
if "fastfetch" in output.lower():
return "wrapper"
else:
return "neofetch" # neofetch works
Expand Down