Command line animations based on the state of the system

Overview

shell-emotions

Command line animations based on the state of the system for Linux or Windows 10

The ascii animations were created using a modified version of Joedang's converter

Requirements

Linux

  • Python 2 or 3
  • psutil
  • Bash or Fish

Windows 10

  • Python 3
  • psutil
  • pythonnet | (Optional)
  • OpenHardwareMonitorLib.dll | Note: OpenHardwareMonitor REQUIRES Administrator Access (Optional)
  • Powershell

Workflow for getting the ascii frames

Manual Method

Termimum Method

  • Download modified Termimation
  • Locate gif you want to convert to ascii frames named
  • Run -> ./termimation ./

Adding Animations

  • Create ascii frames using above workflow or
  • Move ascii frames named 0-N to ./assets/frames/
  • Add conditional in state_update() in lib.threading that sets state = emotions[""].id

Configuration

Configurable Parameters in ./conf/cfg.py:

  • frames_path | This is the path of the frames folder where individual folders for each emotion is kept (Default "./assets/frames/")
  • state | This is the starting state of the program (Default 0)
  • welcome_time | Time (sec) for welcome message (Default 1)
  • frame_time | The time before printing next frame (Default 0.2)
  • util_refresh | Time inbetween utilization stat refreshes (Default 5)
  • cpu_lvl_1 | Boundary for low CPU usage (Default 10)
  • cpu_lvl_2 | Boundary for medium CPU usage (Default 30)
  • cpu_lvl_3 | Boundary for high CPU usage (Default 90)
  • cpu_temp_lvl_1 | Boundary for high CPU temperature (Default 80)
  • cpu_temp_lvl_2 | Boundary for very high CPU temperature (Default 90)
  • cpu_temp_lvl_3 | Boundary for CPU throttling temperature (Default 105)
  • cpu_temp_sensor | Sensor to pull CPU Temps from (Default "coretemp")
  • cpu_temp_sensor_win32 | Sensor to pull CPU temps in win32 from (Default "CPU Package")
  • cpu_temp_default | Default fallback CPU temperature (Default 0)
  • mem_bound | Boundary for high memory usage (Default 50)

clean.sh

Use clean.sh file for cleaning undesired characters from the ascii frames

main.py

Functions

shutdown(signum, frame):

The shutdown function handles clean shutdown of the program with "Shutting down..." printout.

main():

The main function deals with signal handling and starts both state update and emote threads.

threading.py

Functions

state_update(thread_name):

The state update thread is a daemon that queries system stats through psutil and updates global state.

emote(thread_name):

The emote thread is a daemon that runs the correct animation based on state continuously.

animation.py

Classes

class Animation:

The Animation class has the properties name, id, file_path, and frames. It will fill frames list upon initialization using input file_path and name.

win32_temp.py

Functions

init_open_hwd_mon():

This function initializes OpenHardwareMonitor by loading OpenHardwareMonitorLib.dll and returning the handle.

get_cpu_pkg_temp(handle)

This function returns cpu package temperature from OpenHardwareMonitor.

Issues
  • Refactored Code

    Refactored Code

    Removed some duplicated code and used print instead of os.system() (because its faster and cleaner). I also made the file executeable and added the python header so you can do ./main.py to start it

    opened by mrbesen 4
  • Added Animation class

    Added Animation class

    I've refactored the code for animations in my fork of the project. The program now uses the class "animation.py" in the folder "lib" which has the properties name id file_path and frames.

    The constructor of the Animation class imports all ascii frames from ./assets/frames/<name>. In ./assets/frames/<name> the ascii text frames are numbered from 0-N (The animation can be of variable length and the constructor will handle it just fine).

    In the main method, all animation objects are attached as values to an emotion dictionary that uses <name> as the key.

    To add new emotions you just have to create a folder in assets named <name> and add that <name> to the global emotion_names list. Then just add all the frames (named 0-N) into the folder you just created.

    opened by avanishsubbiah 4
  • removed .DS_Store

    removed .DS_Store

    removed .DS_Store and added a .gitignore

    opened by mrbesen 1
  • clean.sh optimized

    clean.sh optimized

    I just made all that pipeing into one sed command. The old one could have even created some obscure problems, because it was reading and writing the file at the same time. With this new command this can not happen, because sed knows what it does.

    opened by mrbesen 1
  • Color Animations generated from Termimum added, with updated Docs

    Color Animations generated from Termimum added, with updated Docs

    Heyo, I added color animations generated from the modified fork of Termimum I made, and updated the docs to include credit to Joedang. Lemme know what you think of the new animations!

    Ex (Awake animation): eyes_example

    opened by avanishsubbiah 1
  • Request to merge version with 3 states and 2 threads

    Request to merge version with 3 states and 2 threads

    This version of the main.py file has three different states: asleep, waking up, and fully awake. It switches between these states in a thread running emote() based on utilization stats collected and updated by a second thread running check_usage().

    I plan on replacing the check_usage() function to a state_update() function that synchronously updates state after updating usage stats so that the emote() function does not have as many timing conflicts, and there can be less global variables.

    opened by avanishsubbiah 0
  • Cleaned up threading conflicts and added proper shutdown along with Rage emotion addition and Docs update

    Cleaned up threading conflicts and added proper shutdown along with Rage emotion addition and Docs update

    State modification has been moved into the check_usage(thread_name) function (Now renamed to state_update(thread_name)), which allows for less conflicts where emote would try to read cpu_percent while it was being updated by the check_usage thread. Additionally, going forward as more stats are added they won't have to be global variables shared with emote(thread_name). Instead, the only global variable shared with emote(thread_name) will be state.

    Additionally, before SIGINT would have to be sent twice with two presses of Ctrl-C in order to close both threads with an exception print out. A main function was added to start both threads as daemons and allow for signal handling of SIGINT and SIGTERM to provide a clean exit with a "Shutting Down..." print out instead.

    A rage emotion was added with a modification to the original awake animation to include a vein bulge symbol, and this emotion will appear when cpu_percent is greater than 90%.

    The Docs were updated to included procedure for adding new emotion animations, requirements, main.py function documentation, and a switch from the static image to a GIF that shows the awake eyes animation as an example.

    opened by avanishsubbiah 0
  • Introduce refactored code back into main branch

    Introduce refactored code back into main branch

    After adding color animations, refactored code for the animation storage and addition, features for temperature detection and memory usage collection, etc. The refactored branch needs to be merged back to main (They are getting too distant from each other at this point).

    opened by avanishsubbiah 0
  • Moved play method to Animation class and cleaned imports

    Moved play method to Animation class and cleaned imports

    Updated Animation class to include play method to remove the key passing to a separate method from before

    opened by avanishsubbiah 0
  • Switched emotions[key] reference to val

    Switched emotions[key] reference to val

    Just did a quick fix to clean up the weird emotions[key] reference in emote when val is already what is needed.

    opened by avanishsubbiah 0
  • Refactor branch

    Refactor branch

    @avanishsubbiah I will create another branch named refactor, in that branch i will create a subdirectory called "lib" and organize the code into objects. I will add argparse to manage command line arguments. You can keep working on the main branch but keep in mind that later on you will have to commit your new changes to the refactor branch too. So we can merge refactor with main.

    enhancement 
    opened by malav097 2
  • License needs to be added

    License needs to be added

    I'm not too familiar with licensing, but I just realized after looking at the termination repository that we need to add a license file to this repo. Maybe GPL 3.0?

    opened by avanishsubbiah 0
  • Need cropped images or specifications to reproduce ascii art

    Need cropped images or specifications to reproduce ascii art

    Following the workflow outlined in the documentation, using the images provided, results in images of different sizing than the original ascii art images provided. If the art was generated via cropped images the images in assets need to be updated to those cropped images. Or if a certain sizing was used that would be useful to know.

    opened by avanishsubbiah 3
  • Generate frames for other types of emotions using the workflow described in the readme

    Generate frames for other types of emotions using the workflow described in the readme

    I am thinking on the best approach to link the animation with the system status (CPU load average, memory and storage). At first we would need at least 3 animations to correlate with 3 different system metric thresholds (maybe happy, normal and sad) any ideas are welcome.

    help wanted good first issue 
    opened by malav097 4
Owner
Simon Malave
I like to walk in the thin line between infrastructure and code.
Simon Malave
Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

Python Fire Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. Python Fire is a s

Google 20.4k Nov 23, 2021
Python composable command line interface toolkit

$ click_ Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It's the "Comm

The Pallets Projects 11.6k Nov 24, 2021
Library for building powerful interactive command line applications in Python

Python Prompt Toolkit prompt_toolkit is a library for building powerful interactive command line applications in Python. Read the documentation on rea

prompt-toolkit 7.4k Dec 2, 2021
Cleo allows you to create beautiful and testable command-line interfaces.

Cleo Create beautiful and testable command-line interfaces. Cleo is mostly a higher level wrapper for CliKit, so a lot of the components and utilities

Sébastien Eustace 776 Nov 26, 2021
Color text streams with a polished command line interface

colout(1) -- Color Up Arbitrary Command Output Synopsis colout [-h] [-r RESOURCE] colout [-g] [-c] [-l min,max] [-a] [-t] [-T DIR] [-P DIR] [-d COLORM

nojhan 1.1k Nov 24, 2021
Pythonic command line arguments parser, that will make you smile

docopt creates beautiful command-line interfaces Video introduction to docopt: PyCon UK 2012: Create *beautiful* command-line interfaces with Python N

null 7.5k Nov 25, 2021
Python Command-line Application Tools

Clint: Python Command-line Interface Tools Clint is a module filled with a set of awesome tools for developing commandline applications. C ommand L in

Kenneth Reitz Archive 61 Nov 24, 2021
Corgy allows you to create a command line interface in Python, without worrying about boilerplate code

corgy Elegant command line parsing for Python. Corgy allows you to create a command line interface in Python, without worrying about boilerplate code.

Jayanth Koushik 4 Nov 21, 2021
prompt_toolkit is a library for building powerful interactive command line applications in Python.

Python Prompt Toolkit prompt_toolkit is a library for building powerful interactive command line applications in Python. Read the documentation on rea

prompt-toolkit 7.4k Dec 2, 2021
sane is a command runner made simple.

sane is a command runner made simple.

Miguel M. 14 Jul 24, 2021
Typer, build great CLIs. Easy to code. Based on Python type hints.

Typer, build great CLIs. Easy to code. Based on Python type hints. Documentation: https://typer.tiangolo.com Source Code: https://github.com/tiangolo/

Sebastián Ramírez 6.7k Dec 1, 2021
CalcuPy 📚 Create console-based calculators in a few lines of code.

CalcuPy ?? Create console-based calculators in a few lines of code. ?? Installation pip install calcupy ?? Usage from calcupy import Calculator calc

Dylan Tintenfich 6 Sep 26, 2021
A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Stream your favorite shows straight from the command line.

A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Installation pip install -r requirements.txt It use

Jonardon Hazarika 14 Nov 18, 2021
Create animations for the optimization trajectory of neural nets

Animating the Optimization Trajectory of Neural Nets loss-landscape-anim lets you create animated optimization path in a 2D slice of the loss landscap

Logan Yang 65 Nov 1, 2021
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations

ASCIIMATICS Asciimatics is a package to help people create full-screen text UIs (from interactive forms to ASCII animations) on any platform. It is li

null 2.9k Nov 24, 2021
A new kind of Progress Bar, with real time throughput, eta and very cool animations!

alive-progress :) A new kind of Progress Bar, with real-time throughput, eta and very cool animations! Ever found yourself in a remote ssh session, do

Rogério Sampaio de Almeida 2.9k Nov 26, 2021
Animations made using manim-ce

ManimCE Animations Animations made using manim-ce The code turned out to be a bit complicated than expected.. It can be greatly simplified, will work

sparshg 10 Nov 16, 2021
A new kind of Progress Bar, with real time throughput, eta and very cool animations!

A new kind of Progress Bar, with real time throughput, eta and very cool animations!

Rogério Sampaio de Almeida 2.9k Dec 1, 2021
A program that can download animations from myself website

MYD A program that can download animations from myself website 一個可以用來下載Myself網站上動漫的程式 Quick Start [無GUI版本] 確定電腦內包含 ffmpeg 並設為環境變數 (Environment Variabl

Patrick_star 1 Nov 7, 2021
Addon for Blender 2.8+ that automatically creates NLA tracks for all animations. Useful for GLTF export.

PushDownAll An addon for Blender 2.8+ that runs Push Down on all animations, creating NLA tracks for each. This is useful if you have an object with m

Cory Petkovsek 2 Nov 29, 2021
A cd command that learns - easily navigate directories from the command line

NAME autojump - a faster way to navigate your filesystem DESCRIPTION autojump is a faster way to navigate your filesystem. It works by maintaining a d

William Ting 13.2k Dec 1, 2021
AML Command Transfer. A lightweight tool to transfer any command line to Azure Machine Learning Services

AML Command Transfer (ACT) ACT is a lightweight tool to transfer any command from the local machine to AML or ITP, both of which are Azure Machine Lea

Microsoft 5 Dec 2, 2021
Turn (almost) any Python command line program into a full GUI application with one line

Gooey Turn (almost) any Python 2 or 3 Console Program into a GUI application with one line Support this project Table of Contents Gooey Table of conte

Chris 15.1k Dec 2, 2021
Ocular is a state-of-the-art historical OCR system.

Ocular Ocular is a state-of-the-art historical OCR system. Its primary features are: Unsupervised learning of unknown fonts: requires only document im

null 216 Nov 9, 2021
A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax

1.0 Release See here for details about breaking changes with the upcoming 1.0 release: https://github.com/taverntesting/tavern/issues/495 Easier API t

null 828 Nov 24, 2021
JAKYM, Just Another Konsole YouTube-Music. A command line based Youtube music player written in Python with spotify and youtube playlist support

Just Another Konsole YouTube-Music Overview I wanted to create this application so that I could use the command line to play music easily. I often pla

Mayank Jha 64 Nov 19, 2021
📼Command line tool based on youtube-dl to easily download selected channels from your subscriptions.

youtube-cdl Command line tool based on youtube-dl to easily download selected channels from your subscriptions. This tool is very handy if you want to

Anatoly 66 Nov 8, 2021
Text based command line webcam photobooth app

Skunkbooth Why See it in action Usage Installation Run Media location Contributing Install Poetry Clone the repo Activate poetry shell Install dev dep

David Yang 39 Nov 3, 2021
A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli.

ABOUT A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Installation pip install -r requirements.txt It use

Janardon Hazarika 14 Nov 18, 2021