An open API service indexing awesome lists of open source software.

https://github.com/eoussama/fut-card-generator

Generate custom Fut cards.
https://github.com/eoussama/fut-card-generator

fut-card generator

Last synced: 5 months ago
JSON representation

Generate custom Fut cards.

Awesome Lists containing this project

README

          


Logo

Fut Card Generator


Generate custom Fut cards.





## Index

* [Description](#description)
* [Installation](#installation)
* [From source](#from-source)
* [From binary](#from-binary)
* [From Docker](#from-docker)
* [Development](#development)
* [Build](#build)
* [API](#api)
* [Usage](#usage)
* [Options](#options)
* [Translations](#translations)
* [Editions](#editions)
* [Positions](#positions)
* [Kinds](#kinds)
* [Country Codes](#country-codes)
* [API](#api)
* [Routes](#routes)
* [GET](#get)
* [POST](#post)
* [License](#license)

## Description

Fut Card Generator is a command line tool and library to generate custom Fut cards.

## Installation

### From source

Clone the repository and update the submodules:

```bash
git clone https://github.com/eoussama/fut-card-generator.git
cd fut-card-generator
git submodule update --init --recursive
```

Build the project:

```bash
mkdir build
cd build
cmake ..
cmake --build .
```

There is also a custom script for doing that, [build.sh](scripts/build.sh).

### From binary

Download the latest release from the [releases page](https://github.com/eoussama/fut-card-generator/releases).

### From Docker

#### Development
There is a developement Docker image available, you can use it by executing the [dev.sh](scripts/dev.sh) script.

#### Build
You can also build and run the binary and forward all the arguments to it by executing the [run.sh](scripts/run.sh) script.

#### API
A web API image is also available, you can use it by executing the [api.sh](scripts/api.sh) script.
The container exposes port 5000 and mounts the current directory to `/fut-card-generator`.
The endpoint is available at `http://localhost:5000/generate`.

Or you can pull a pre build image from [Docker Hub](https://hub.docker.com/r/eoussama/fut-card-generator).

## Usage

```bash
fut-card-generator --help
```

### Options

The following are the options available

| Option | Abbreviation | Default | Description |
| --- | --- | --- | --- |
| `--help` | `-h` | N/A | Show help message |
| `--version` | `-v` | N/A | Show version |
| `--name` | `-n` | N/A | Player name |
| `--out` | `-o` | out.png | Output file path |
| `--show` | `-s` | false | Flag whether to preview the card after generation | |
| `--logo` | `-l` | ./assets/logo.png | Path to the logo of the player | |
| `--image` | `-i` | ./assets/image.png | Path to the image of the player | |
| `--translation` | `-t` | [en](#translations) | Transaltion of the text on the card | |
| `--edition` | `-e` | [fifa19](#editions) | Code for the edition of the fut card to generate | |
| `--kind` | `-k` | [common_bronze](#kinds) | Code for the template of the card to generate | |
| `--country` | `-c` | [ma](#country-codes) | Country code of the player | |
| `--position` | `-p` | [all](#positions) | Position of the player on the card | |
| `--pace` | `-pac` | 50 | Pace of the player on the card | |
| `--passing` | `-pas` | 50 | Passing of the player on the card | |
| `--physical` | `-phy` | 50 | Physical of the player on the card | |
| `--shooting` | `-sho` | 50 | Skill of the player on the card | |
| `--dribbling` | `-dri` | 50 | Dribbling of the player on the card | |
| `--defending` | `-def` | 50 | Defense of the player on the card | |

#### Translations

| Code | Language |
| --- | --- |
| en | English |
| fr | French |
| es | Spanish |
| pt | Portuguese |
| it | Italian |
| de | German |

#### Editions

| Code | Edition |
| --- | --- |
| fifa19 | FIFA 19 |

#### Positions

| Code | Position |
| --- | --- |
| gk | Goalkeeper |
| lb | Left Back |
| lwb | Left Wing Back |
| cb | Centre Back |
| rb | Right Back |
| rwb | Right Wing Back |
| lm | Left Midfield |
| cdm | Centre Midfield |
| cm | Centre Midfield |
| cam | Centre Midfield |
| rm | Right Midfield |
| lw | Left Wing |
| rw | Right Wing |
| lf | Left Full Back |
| cf | Centre Full Back |
| rf | Right Full Back |
| st | Striker |
| all | All |

#### Kinds

| Code | Kind | Preview |
| --- | --- | --- |
| common_bronze | Common Bronze | |
| common_silver | Common Silver | |
| common_gold | Common Gold | |
| rare_bronze | Rare Bronze | |
| rare_silver | Rare Silver | |
| rare_gold | Rare Gold | |
| if_bronze | IF Bronze | |
| if_silver | IF Silver | |
| if_gold | IF Gold | |
| fc_bronze | FC Bronze | |
| fc_silver | FC Silver | |
| fc_gold | FC Gold | |
| motm | MOTM | |
| pl_potm | PL POTM | |
| bl_potm | BL POTM | |
| futties | Futties | |
| futtiesw | FuttiesW | |
| toty | Toty | |
| toty_n | Toty N | |
| el | EL | |
| el_motm | EL MOTM | |
| el_live | EL Live | |
| el_sbc | EL SBC | |
| el_tott | EL Tott | |
| common_ucl | Common UCL | |
| rare_ucl | Rare UCL | |
| ucl_motm | UCL MOTM | |
| ucl_live | UCL Live | |
| ucl_sbc | UCL SBC | |
| ucl_tott | UCL Tott | |
| fsr | FSR | |
| fs | FS | |
| fsn | FSN | |
| pp | PP | |
| cb | CB | |
| rb | RB | |
| hero | Hero | |
| aw | AW | |
| fb | FB | |
| headliners | Headliners | |
| cc | CC | |
| sbc | SBC | |
| sbcp | SBCP | |
| legend | Legend | |
| fs1 | FS1 | |
| fs2 | FS2 | |
| fs3 | FS3 | |
| fs4 | FS4 | |
| fs5 | FS5 | |
| fs6 | FS6 | |
| fs7 | FS7 | |
| fs8 | FS8 | |
| fs9 | FS9 | |
| fs10 | FS10 | |
| fs11 | FS11 | |
| otw | OTW | |
| st_patricks | ST PATRICKS | |

#### Country Codes

Check out [countries.json](./assets/nations/countries.json) for a list of all the country codes.

> Note: All parameters should be lowercase, that goes especially for the country codes.

## API

The API can be started by running the Flask script at `api/app.py`.
There is also a docker image available ([Dockerfile.api](docker/Dockerfile.api)), you can use it by executing the [api.sh](scripts/api.sh) script.

The API is available at `http://localhost:5000`.

### Routes

#### [GET] `/`

Returns the API version.

#### [POST] `/generate`

Generates a card.

This route accepts the following parameters:

| Parameter | Description | Type | Default |
| --- | --- | --- | --- |
| `args` | Arguments to pass to the executable | String | N/A |
| `clubLogo` | Club logo image | File | N/A |
| `playerImage` | Player image | File | N/A |

Example:

```bash
curl -X POST \
http://localhost:5000/generate \
-F 'args=-n "Player" -e fifa19 -k ma -p all -pace 50 -pas 50 -phy 50 -sho 50 -dri 50 -def 50' \
-F 'clubLogo=@./assets/clubs/1.png' \
-F 'playerImage=@./assets/defaults/person.png'
```

## License

This project is licensed under the __GNU GENERAL PUBLIC 3.0__ License - see the [LICENSE](LICENSE) file for details.