diff --git a/Badge.py b/Badge.py
new file mode 100644
index 0000000..a5e5439
--- /dev/null
+++ b/Badge.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+
+from simpleicons.all import icons
+from urllib.parse import urlencode
+from colour import Color
+
+"""
+04/06/2022
+"""
+
+__file__ = 'Badge.py'
+__author__ = 'Lucas Vbr'
+__version__ = '0.1'
+
+
+class Badge:
+ def __init__(self, badgeName: str):
+ self.name = badgeName
+ self.url = ""
+ self.color = 0
+
+ self.buildUrl()
+
+ def get_color(self):
+ return self.color
+
+ def buildUrl(self):
+ BASE_URL = "https://img.shields.io/static/v1"
+ LOGO_COLOR = "white"
+
+ icon = icons.get(self.name)
+
+ params = {
+ "label": "",
+ "message": icon.title,
+ "color": f"#{icon.hex}",
+ "logo": icon.slug,
+ "logoColor": LOGO_COLOR
+ }
+ urlParams = urlencode(params)
+
+ self.url = f"{BASE_URL}?{urlParams}"
+ self.color = Color(params["color"]).hsl
+
+
+def getBadgeColor(badge: Badge) -> float:
+ return badge.color[0]
diff --git a/FileUtils.py b/FileUtils.py
new file mode 100644
index 0000000..eddd169
--- /dev/null
+++ b/FileUtils.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+"""
+04/06/2022
+"""
+
+import json
+
+__file__ = 'FileUtils.py'
+__author__ = 'Lucas Vbr'
+__version__ = '0.1'
+
+
+def getJsonData(fileName: str) -> str:
+ with open(fileName) as file:
+ data = json.load(file)
+ return data
+
+
+def setFileData(fileName: str, content: str):
+ with open(fileName, "w", encoding="utf8") as file:
+ file.write(content)
diff --git a/README.md b/README.md
index a7afcaf..a8b68fe 100644
--- a/README.md
+++ b/README.md
@@ -1,80 +1,51 @@
-
+# Hello there !

-# Hi

, I'm LucasVbr
-### A passionate developer from France
+I'm Lucà s, a passionate developer from Rodez, France.
+
Currently, the weather is: **+23 °C**, **Thunderstorm in vicinity, hail with thunderstorm**
-
-
- | Quote of the day |
-
-
-
-
- "Watch the little things; a small leak will sink a great ship."
- by Benjamin Franklin
- |
-
-
-
-
-
-
-
-
-
-- 🔠I'm currently working on a new version of my portfolio
-- 🌱 I'm currently learning **Symfony**
-- 📫 How to reach me **vabre.lucas.pro@gmail.com**
-- 💻 Here is my portfolio
+### I code with
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-## Connect With Me:
-
-
-
-
-
+### Where to find me
+[](https://github.com/LucasVbr)
+[](https://www.linkedin.com/in/lucasvbr)
+[](https://www.freecodecamp.org/LucasVbr)
+---
-
-## Languages and Tools:
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+This README is generated every day.
+Last refresh: **Saturday 04 June 22, 22:25**
+
+
+

-
-
-
-
-
-
-
+*inspired by [Thomas Guibert](https://github.com/thmsgbrt)*
-
-
-
-
-
-
-
-
-
-

-

-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/data.json b/data.json
deleted file mode 100644
index 6c979a3..0000000
--- a/data.json
+++ /dev/null
@@ -1,281 +0,0 @@
-{
- "hi": {
- "src": "https://raw.githubusercontent.com/iampavangandhi/iampavangandhi/master/gifs/Hi.gif",
- "alt": "\uD83D\uDC4B",
- "width": "50px"
- },
- "badges": [
- {
- "src": "https://komarev.com/ghpvc/?username=lucasvbr&label=Profile%20views&color=0e75b6&style=flat",
- "alt": "Profile Views"
- },
- {
- "src": "https://img.shields.io/freecodecamp/points/lucasvbr?label=FreeCodeCamp%20points",
- "alt": "FreeCodeCamp Points"
- }
- ],
- "about": [
- [
- {
- "type": "icon",
- "content": "\uD83D\uDD2D"
- },
- {
- "type": "text",
- "content": "I'm currently working on"
- },
- {
- "type": "a",
- "href": "https://github.com/LucasVbr/Portfolio",
- "content": "a new version of my portfolio"
- }
- ],
- [
- {
- "type": "icon",
- "content": "\uD83C\uDF31"
- },
- {
- "type": "text",
- "content": "I'm currently learning"
- },
- {
- "type": "text",
- "isBold": true,
- "content": "Symfony"
- }
- ],
- [
- {
- "type": "icon",
- "content": "\uD83D\uDCEB"
- },
- {
- "type": "text",
- "content": "How to reach me"
- },
- {
- "type": "text",
- "isBold": true,
- "content": "vabre.lucas.pro@gmail.com"
- }
- ],
- [
- {
- "type": "icon",
- "content": "\uD83D\uDCBB"
- },
- {
- "type": "text",
- "content": "Here is"
- },
- {
- "type": "a",
- "href": "https://lucasvbr.github.io/Portfolio",
- "content": "my portfolio"
- }
- ]
- ],
- "connectWithMe": [
- {
- "href": "https://codepen.io/LucasVbr",
- "src": "https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/codepen.svg",
- "alt": "CodePen",
- "width": "35px"
- },
- {
- "href": "https://www.linkedin.com/in/lucasvbr",
- "src": "https://raw.githubusercontent.com/rahuldkjain/github-profile-readme-generator/master/src/images/icons/Social/linked-in-alt.svg",
- "alt": "Linkedin",
- "width": "35px"
- },
- {
- "href": "https://www.root-me.org/LucasVbr?lang=fr",
- "src": "https://www.root-me.org/IMG/logo/siteon0.svg",
- "alt": "RootMe",
- "width": "35px"
- },
- {
- "href": "https://pydefis.callicode.fr/user/mhof/LucasVbr/bba98551173e6b21",
- "src": "https://pydefis.callicode.fr/static/callicode-vsm.png",
- "alt": "PyDefis",
- "width": "35px"
- },
- {
- "href": "https://www.freecodecamp.org/LucasVbr",
- "src": "https://d33wubrfki0l68.cloudfront.net/bbfa33a202e8612d49b6c1ed05c1fdd8e4001566/bbdd1/img/fcc_secondary_small.svg",
- "alt": "FreeCodeCamp",
- "width": "35px"
- }
- ],
- "languagesAndTools": [
- [
- {
- "href": "https://www.w3.org/html/",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/html5/html5-original-wordmark.svg",
- "alt": "HTML5",
- "width": "35px"
- },
- {
- "href": "https://www.w3schools.com/css/",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/css3/css3-original-wordmark.svg",
- "alt": "CSS3",
- "width": "35px"
- },
- {
- "href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/javascript/javascript-original.svg",
- "alt": "Javascript",
- "width": "35px"
- },
- {
- "href": "https://pugjs.org",
- "src": "https://cdn.worldvectorlogo.com/logos/pug.svg",
- "alt": "pug",
- "width": "35px"
- },
- {
- "href": "https://sass-lang.com",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/sass/sass-original.svg",
- "alt": "SASS",
- "width": "35px"
- },
- {
- "href": "https://www.typescriptlang.org/",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/typescript/typescript-original.svg",
- "alt": "Typescript",
- "width": "35px"
- },
- {
- "href": "https://www.php.net",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/php/php-original.svg",
- "alt": "PHP",
- "width": "35px"
- },
- {
- "href": "https://www.java.com",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/java/java-original.svg",
- "alt": "Java",
- "width": "35px"
- },
- {
- "href": "https://www.cprogramming.com/",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/c/c-original.svg",
- "alt": "C",
- "width": "35px"
- },
- {
- "href": "https://www.python.org",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/python/python-original.svg",
- "alt": "Python",
- "width": "35px"
- },
- {
- "href": "https://www.gnu.org/software/bash/",
- "src": "https://www.vectorlogo.zone/logos/gnu_bash/gnu_bash-icon.svg",
- "alt": "Bash",
- "width": "35px"
- }
- ],
- [
- {
- "href": "https://getbootstrap.com",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/bootstrap/bootstrap-plain-wordmark.svg",
- "alt": "Bootstrap",
- "width": "35px"
- },
- {
- "href": "https://bulma.io/",
- "src": "https://raw.githubusercontent.com/gilbarbara/logos/804dc257b59e144eaca5bc6ffd16949752c6f789/logos/bulma.svg",
- "alt": "Bulma",
- "width": "35px"
- },
- {
- "href": "https://symfony.com",
- "src": "https://cdn.jsdelivr.net/gh/devicons/devicon/icons/symfony/symfony-original.svg",
- "alt": "Symfony",
- "width": "35px"
- },
- {
- "href": "https://angular.io",
- "src": "https://angular.io/assets/images/logos/angular/angular.svg",
- "alt": "Angular",
- "width": "35px"
- }
- ],
- [
- {
- "href": "https://www.figma.com/",
- "src": "https://www.vectorlogo.zone/logos/figma/figma-icon.svg",
- "alt": "Figma",
- "width": "35px"
- },
- {
- "href": "https://git-scm.com/",
- "src": "https://www.vectorlogo.zone/logos/git-scm/git-scm-icon.svg",
- "alt": "Git",
- "width": "35px"
- },
- {
- "href": "https://mariadb.org/",
- "src": "https://www.vectorlogo.zone/logos/mariadb/mariadb-icon.svg",
- "alt": "MariaDB",
- "width": "35px"
- },
- {
- "href": "https://www.microsoft.com/en-us/sql-server",
- "src": "https://www.svgrepo.com/show/303229/microsoft-sql-server-logo.svg",
- "alt": "SqlServer",
- "width": "35px"
- },
- {
- "href": "https://www.mysql.com/",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/mysql/mysql-original-wordmark.svg",
- "alt": "MySql",
- "width": "35px"
- },
- {
- "href": "https://www.postgresql.org",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/postgresql/postgresql-original-wordmark.svg",
- "alt": "PostgreSql",
- "width": "35px"
- },
- {
- "href": "https://www.sqlite.org/",
- "src": "https://www.vectorlogo.zone/logos/sqlite/sqlite-icon.svg",
- "alt": "sqlite",
- "width": "35px"
- }
- ],
- [
- {
- "href": "https://developer.android.com",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/android/android-original-wordmark.svg",
- "alt": "Android",
- "width": "35px"
- },
- {
- "href": "https://www.linux.org/",
- "src": "https://raw.githubusercontent.com/devicons/devicon/master/icons/linux/linux-original.svg",
- "alt": "Linux",
- "width": "35px"
- },
- {
- "href": "https://developer.microsoft.com/fr-fr/windows/",
- "src": "https://raw.githubusercontent.com/devicons/devicon/1119b9f84c0290e0f0b38982099a2bd027a48bf1/icons/windows8/windows8-original.svg",
- "alt": "Windows",
- "width": "35px"
- }
- ]
- ],
- "stats": [
- {
- "src": "https://github-readme-stats.vercel.app/api?username=lucasvbr&show_icons=true&locale=en",
- "alt": "githubStats"
- },
- {
- "src": "https://github-readme-stats.vercel.app/api/top-langs?username=lucasvbr&show_icons=true&locale=en&layout=compact",
- "alt": "mostUsedLanguages"
- }
- ]
-}
diff --git a/img/Hi.gif b/img/Hi.gif
new file mode 100644
index 0000000..721db8d
Binary files /dev/null and b/img/Hi.gif differ
diff --git a/main.py b/main.py
index 496eb5e..81f9a05 100644
--- a/main.py
+++ b/main.py
@@ -3,29 +3,46 @@
__author__ = "LucasVbr"
__version__ = "3.0.0"
-from flask import render_template
import requests
+from flask import render_template
import flask
-import json
+from Badge import *
+from FileUtils import *
+from datetime import datetime
TEMPLATE_FILE = "index.md.jinja"
-DATA_FILE = "data.json"
+DATA_FILE = "data.old.json"
+TOOLS_DATA = "tools.json"
OUTPUT_FILE = "README.md"
app = flask.Flask('my app')
if __name__ == "__main__":
# Get Data from JSON
- with open(DATA_FILE) as file:
- data = json.load(file)
+ data = getJsonData(DATA_FILE)
- # Get random quote
- quote = requests.get("https://api.quotable.io/random")
+ toolsData = getJsonData(TOOLS_DATA)
+ tools = [Badge(toolName) for toolName in toolsData]
+
+ tools.sort(key=getBadgeColor) # Sort by color
+
+ request = requests.get("https://goweather.herokuapp.com/weather/rodez")
+
+ weather_status = request.status_code
+ weather = request.json()
+
+ today = datetime.today().strftime("%A %d %B %y, %H:%M")
# Build from template and data
with app.app_context():
- rendered = render_template(TEMPLATE_FILE, data=data, quote=quote.json())
+ rendered = render_template(
+ TEMPLATE_FILE,
+ # data=data,
+ tools=tools,
+ weather_status=weather_status,
+ weather=weather,
+ today=today
+ )
# Generate Markdown file
- with open(OUTPUT_FILE, "w", encoding="utf8") as file:
- file.write(rendered)
+ setFileData(OUTPUT_FILE, rendered)
diff --git a/requirements.txt b/requirements.txt
index 30692b7..e61f7cd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,4 @@
-flask
-requests
+flask~=2.1.2
+requests~=2.27.1
+simpleicons~=6.23.0
+colour~=0.1.5
\ No newline at end of file
diff --git a/templates/index.md.jinja b/templates/index.md.jinja
index c3157af..7aed6f4 100644
--- a/templates/index.md.jinja
+++ b/templates/index.md.jinja
@@ -1,20 +1,28 @@
-{%- from './macros/image.md.jinja' import img -%}
-{%- from './macros/link.md.jinja' import a -%}
+# Hello there !
-
-{%- include './sections/header.md.jinja' with context %}
+I'm Lucà s, a passionate developer from Rodez, France.
+{% if weather_status == 200 %}
Currently, the weather is: **{{ weather.temperature }}**, **{{ weather.description }}**{% endif %}
-
-{% include './sections/badges.md.jinja' with context %}
+### I code with
+{% for image in tools -%}
+ 
+{% endfor %}
-
-{% include './sections/about.md.jinja' with context %}
+### Where to find me
+[](https://github.com/LucasVbr)
+[](https://www.linkedin.com/in/lucasvbr)
+[](https://www.freecodecamp.org/LucasVbr)
-
-{% include './sections/connect-with-me.md.jinja' with context %}
+---
-
-{% include './sections/languages-and-tools.md.jinja' with context %}
+
-
-{% include './sections/stats.md.jinja' with context %}
+This README is generated every day.
+Last refresh: **{{ today }}**
+
+
+

+
+*inspired by [Thomas Guibert](https://github.com/thmsgbrt)*
+
+
\ No newline at end of file
diff --git a/templates/macros/image.md.jinja b/templates/macros/image.md.jinja
deleted file mode 100644
index 65d61fa..0000000
--- a/templates/macros/image.md.jinja
+++ /dev/null
@@ -1,3 +0,0 @@
-{% macro img(src, alt='image', width='') -%}
-
-{%- endmacro %}
\ No newline at end of file
diff --git a/templates/macros/link.md.jinja b/templates/macros/link.md.jinja
deleted file mode 100644
index a403834..0000000
--- a/templates/macros/link.md.jinja
+++ /dev/null
@@ -1,3 +0,0 @@
-{% macro a(href, content) -%}
- {{ content }}
-{%- endmacro %}
\ No newline at end of file
diff --git a/templates/sections/about.md.jinja b/templates/sections/about.md.jinja
deleted file mode 100644
index 8160079..0000000
--- a/templates/sections/about.md.jinja
+++ /dev/null
@@ -1,15 +0,0 @@
-{% for element in data.about -%}
--
- {%- for part in element -%}
- {{ " " }}
- {%- if part.type == "icon" or part.type == "text" -%}
- {%- if part.isBold -%}**{%- endif -%}
- {{ part.content }}
- {%- if part.isBold -%}**{%- endif -%}
- {%- elif part.type == "a" -%}
- {{ a(part.href, part.content) }}
- {%- else -%}
- {{"Error: No type found"}}
- {%- endif -%}
- {%- endfor %}
-{% endfor %}
\ No newline at end of file
diff --git a/templates/sections/badges.md.jinja b/templates/sections/badges.md.jinja
deleted file mode 100644
index e258868..0000000
--- a/templates/sections/badges.md.jinja
+++ /dev/null
@@ -1,3 +0,0 @@
-{% for badge in data.badges -%}
- {{ img(badge.src, badge.alt) + " " }}
-{%- endfor %}
\ No newline at end of file
diff --git a/templates/sections/connect-with-me.md.jinja b/templates/sections/connect-with-me.md.jinja
deleted file mode 100644
index bb36a68..0000000
--- a/templates/sections/connect-with-me.md.jinja
+++ /dev/null
@@ -1,4 +0,0 @@
-## Connect With Me:
-{% for image in data.connectWithMe -%}
- {{ a(image.href, img(image.src, image.alt, image.width)) }}
-{% endfor %}
\ No newline at end of file
diff --git a/templates/sections/header.md.jinja b/templates/sections/header.md.jinja
deleted file mode 100644
index 1c641ad..0000000
--- a/templates/sections/header.md.jinja
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-# Hi {{ img(data.hi.src, data.hi.alt, data.hi.width) }}, I'm LucasVbr
-### A passionate developer from France
-
-
-
- | Quote of the day |
-
-
-
-
- "{{ quote.content }}"
- by {{ quote.author }}
- |
-
-
-
-
diff --git a/templates/sections/languages-and-tools.md.jinja b/templates/sections/languages-and-tools.md.jinja
deleted file mode 100644
index 461850b..0000000
--- a/templates/sections/languages-and-tools.md.jinja
+++ /dev/null
@@ -1,6 +0,0 @@
-## Languages and Tools:
-{% for images in data.languagesAndTools -%}
-{% for image in images -%}
- {{ a(image.href, img(image.src, image.alt, image.width)) }}
-{% endfor %}
-{% endfor -%}
\ No newline at end of file
diff --git a/templates/sections/stats.md.jinja b/templates/sections/stats.md.jinja
deleted file mode 100644
index 90199a3..0000000
--- a/templates/sections/stats.md.jinja
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-{% for image in data.stats -%}
- {{ img(image.src, image.alt)}}
-{% endfor %}
-
-
\ No newline at end of file
diff --git a/tools.json b/tools.json
new file mode 100644
index 0000000..dcb436a
--- /dev/null
+++ b/tools.json
@@ -0,0 +1,27 @@
+[
+ "HTML5",
+ "CSS3",
+ "JavaScript",
+ "Pug",
+ "Sass",
+ "TypeScript",
+ "PHP",
+ "Java",
+ "C",
+ "Python",
+ "GNU Bash",
+ "Bootstrap",
+ "Bulma",
+ "Symfony",
+ "Angular",
+ "Figma",
+ "Git",
+ "MariaDB",
+ "Microsoft SQL Server",
+ "MySQL",
+ "PostgreSQL",
+ "SQLite",
+ "Android",
+ "Linux",
+ "Windows"
+]
\ No newline at end of file