Skip to content

Watch actual russian army losses from the console or generate as image.

Notifications You must be signed in to change notification settings

AlexRazor1337/losses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

losses.py Stand With Ukraine

losses.py is a Python script that allows to watch an actual data of the russian army losses in the Russo-Ukrainian War.

You can watch the data in the console or generate an image with this. For this you'll need file with a background and file with a font in .ttf format.

For the image making part, you'll have a file config.json created when you use script for creating image for the first time. Detailed description of the file and usage can be found down bellow.

The data comes from the Ministry of Finance website. Script parses, strips and prepares it to be printed as table or written on image.

This script was made as a final project of CS50’s Introduction to Programming with Python.

Demo

Here you can see how the script prints data to the console: demo

If you run the script with image generation mode you'll get something like this: result

How to run

Console stats output:

  1. Install Python 3.
  2. Run pip install -r requirements.txt to install dependencies.
  3. Run python losses.py

Generating image:

  1. Install Python 3.
  2. Run pip install -r requirements.txt to install dependencies.
  3. Run python losses.py -i. This will generate config file.
  4. Edit config.json, specifying resource files and font sizes.
  5. Run python losses.py -i again. This will produce result.jpg file.

Config file example:

{
    "background_path": "./resources/image.jpg",
    "font_path": "./resources/font.ttf",
    "font_size": 24,
    "text_color": "white",
    "header_font_size": 34,
    "header_text": "Протягом 24.02-%s\n орієнтовані втрати противника склали:",
    "header_color": "yellow",
    "tint_amount": 0.35
}

NOTE: header_text must contain %s for the current date.

Also, you can run tests for the script. For this:

  1. Install pytest: pip install pytest
  2. Run pytest test_project.py

Stand With Ukraine