Code Monkey home page Code Monkey logo

peracotta's Introduction

P.E.R.A.C.O.T.T.A.

Progetto Esteso Raccolta Automatica Configurazioni hardware Organizzate Tramite Tarallo Autonomamente

Script to gather hardware data and update T.A.R.A.L.L.O. automatically.

How to run

Clone this repo:
git clone https://github.com/weee-open/peracotta
Make a virtual environment in the directory of the repo:
cd peracotta
python3 -m venv venv
Activate it:
source venv/bin/activate
Install the requirements in the virtual environment:
pip install -r requirements.txt
Use it.
When you're done, exit the virtualenv with deactivate or simply close the terminal you were using.

For developers, if requirements change:

  • install the correct version of the requirements (e.g. a new library or a new version of an already installed library)
  • with the virtual environment activated, run pip freeze > requirements.txt

main.sh and main_with_gui.py

These are the scripts you run directly from the terminal. Quite obviously, main_with_gui.py presents a graphical interface, but at the time being, if you just have to copy-paste the JSON output from the terminal into the 'Bulk Add' TARALLO page, main.sh is the one for you.

main.sh

This script basically runs sudo ./generate_files.sh and ./extract_data.py, but it does so in an interactive manner, so you can either pass it the arguments, or it will ask you for them nicely.

Use -h or --help to show this help.
Usage: ./main.sh [-p|--path <optional path to generate files to>] [-c|--cpu | -g|--gpu | -b|--motherboard]

If no argument is given, then this script will interactively guide you to run the PERACOTTA data 
gathering package.

Alternatively, you can choose to pass either the path to the directory where you want the files 
to be generated, the gpu location, or both.
In this case, the script will only become interactive when needed, and it won't ask you anything 
if you pass both the path and the gpu location.

main_with_gui.py

This script is interactive, so you'll just need to run it with ./main_with_gui.py.
The GUI is also available from extract_data.py with the -i or --gui option.

Underlying scripts run by main.sh and main_with_gui.py

generate_files.sh

This will create some txt files with data related to the computer, that will be parsed by launching extract_data.py. The hard work is powered by the many read_X.py scripts, which are the actual parsers.

Install dependencies on Debian-based distributions (Debian, Ubuntu, Xubuntu, etc):
sudo apt install pciutils i2c-tools mesa-utils smartmontools dmidecode
These are the actual programs that generate the files that we parse.

extract_data.py

Note: You can run this script after running sudo ./generate_files.sh, but it's quicker and easier if you just run ./main.sh. No sudo required.

You can pass as the path argument the directory where generate_files.sh dropped its files. By default (i.e. if you don't give any arguments to generate_files.sh) it will output the files in the current directory. Since this may clutter the working directory with txt files, it's best to make a new directory (e.g. mkdir tmp) and pass it to the file generator (e.g. generate_files.sh tmp). You can then pass this path to this script so that it knows where to find the txt files (e.g. ./extract_data.py -g tmp).
This is done automatically by the GUI version.

You can find the usage below, but keep in mind that the two most important arguments are:

  • the path to the txt files (if none given, it will default to the current directory)
  • -g | -c | -b: one of these is required to tell the script where the GPU (or graphics card if it's not integrated) is located
usage: extract_data.py [-h] (-g | -c | -b) [-s | -l | -i] [-v] [path]

Parse the files generated with generate_files.sh and get all the possible info
out of them

positional arguments:
  path               path to directory with txt files generated by
                     generate_files.sh - defaults to current directory

optional arguments:
  -h, --help         show this help message and exit
  -v, --verbose      print some warning messages

GPU Location (one argument required):
  -g, --gpu          computer has dedicated GPU
  -c, --cpu          GPU is integrated inside the CPU
  -b, --motherboard  GPU is integrated inside the motherboard

With or without GUI (one argument optional):
  -s, --short        enabled by default, this is the option you want if you
                     want to copy-paste this output into the TARALLO 'Bulk
                     Add' page
  -l, --long         print longer output
  -i, --gui          launch GUI instead of using the terminal version

parsers

There are many read_something.py scripts: these are used internally by the other scripts. They can also be launched from the command line. They can also be imported as libraries.

data

This is the GUI icon.
Yes, it's a pear emoji. ๐Ÿ

peracotta's People

Contributors

e-caste avatar lvps avatar sofymunari avatar riccardosepe avatar elisaratto avatar nunzio-turco avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.