Visual update
This commit is contained in:
parent
35841c9f29
commit
3d22494e48
27
app.py
27
app.py
@ -1,16 +1,30 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import uuid
|
|
||||||
import logging
|
import logging
|
||||||
|
import uuid
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Iterable, Mapping
|
from typing import Iterable, Mapping
|
||||||
|
|
||||||
from flask import Flask, request, render_template, send_file, jsonify
|
from flask import Flask, jsonify, render_template, request, send_file
|
||||||
from icalendar import Calendar, Event, Alarm
|
from icalendar import Alarm, Calendar, Event
|
||||||
from unidecode import unidecode
|
from unidecode import unidecode
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
LV_MONTHS = {
|
||||||
|
1: "jan",
|
||||||
|
2: "feb",
|
||||||
|
3: "mar",
|
||||||
|
4: "apr",
|
||||||
|
5: "mai",
|
||||||
|
6: "jūn",
|
||||||
|
7: "jūl",
|
||||||
|
8: "aug",
|
||||||
|
9: "sep",
|
||||||
|
10: "okt",
|
||||||
|
11: "nov",
|
||||||
|
12: "dec",
|
||||||
|
}
|
||||||
# Source JSON created from http://vvc.gov.lv/export/sites/default/files/paplasinatais_saraksts.pdf
|
# Source JSON created from http://vvc.gov.lv/export/sites/default/files/paplasinatais_saraksts.pdf
|
||||||
|
|
||||||
|
|
||||||
@ -69,7 +83,10 @@ def calendar_search():
|
|||||||
words = {
|
words = {
|
||||||
"text": kind.title(),
|
"text": kind.title(),
|
||||||
"children": [
|
"children": [
|
||||||
{"id": key, "text": value}
|
{
|
||||||
|
"id": key,
|
||||||
|
"text": f"{value} ({key.split('__')[1]}. {LV_MONTHS[int(key.split('__')[0])]}.)",
|
||||||
|
}
|
||||||
for key, value in mapping[kind].items()
|
for key, value in mapping[kind].items()
|
||||||
if unidecode(value.lower(), errors="preserve").startswith(term)
|
if unidecode(value.lower(), errors="preserve").startswith(term)
|
||||||
],
|
],
|
||||||
@ -80,4 +97,4 @@ def calendar_search():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run("0.0.0.0", 5000, True, False)
|
app.run("0.0.0.0", 8000, True, False)
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
Flask==2.0.2
|
Flask==2.2.2
|
||||||
icalendar==4.0.9
|
icalendar==5.0.1
|
||||||
|
unidecode==1.3.6
|
||||||
|
Loading…
x
Reference in New Issue
Block a user