add: parser, new metrics
This commit is contained in:
parent
aa2bd4b5f8
commit
c5bc686aca
|
@ -18,18 +18,18 @@ conky.config = {
|
|||
cpu_avg_samples = 2,
|
||||
default_color = 'white',
|
||||
default_outline_color = 'white',
|
||||
default_shade_color = 'white',
|
||||
default_shade_color = 'black',
|
||||
double_buffer = true,
|
||||
draw_borders = false,
|
||||
draw_graph_borders = false,
|
||||
draw_outline = false,
|
||||
draw_shades = false,
|
||||
draw_shades = yes,
|
||||
extra_newline = false,
|
||||
font = 'DejaVu Serif:size=18',
|
||||
gap_x = 15,
|
||||
font = 'Nimbus Mono PS:size=20',
|
||||
gap_x = 8,
|
||||
gap_y = 15,
|
||||
minimum_height = 5,
|
||||
minimum_width = 5,
|
||||
minimum_width = 650,
|
||||
net_avg_samples = 2,
|
||||
no_buffers = true,
|
||||
out_to_console = false,
|
||||
|
@ -41,7 +41,7 @@ conky.config = {
|
|||
own_window_class = 'Conky',
|
||||
own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager',
|
||||
own_window_type = 'desktop',
|
||||
own_window_argb_value = 112,
|
||||
own_window_argb_value = 0,
|
||||
show_graph_range = false,
|
||||
show_graph_scale = false,
|
||||
stippled_borders = 0,
|
||||
|
@ -52,7 +52,11 @@ conky.config = {
|
|||
}
|
||||
|
||||
conky.text = [[
|
||||
${alignc}${color orange}Weather
|
||||
${alignc}${voffset 15}${color grey}Current
|
||||
${color grey}${exec cat /home/citrullux/example}
|
||||
${font Nimbus Mono PS:size=32}${time %A}${font}
|
||||
${voffset 10}${font Nimbus Mono PS:size=32}${time %B %d}${font}${font Nimbus Mono PS:style=bold:size=80}${voffset -48}${alignr}${time %H:%M}${font}
|
||||
$hr
|
||||
${color DDFFFF}${font Nimbus Mono PS:size=32}Weather${color}${font}
|
||||
${voffset 15}${color DDFFFF}Current: ${color grey}${exec cat /home/citrullux/example}
|
||||
${voffset 15}${color DDFFFF}Today: ${color grey}${exec cat /home/citrullux/example}
|
||||
${voffset 15}${color DDFFFF}This week: ${color grey}${exec cat /home/citrullux/example}
|
||||
]]
|
|
@ -3,11 +3,12 @@ Description=Service for conky configuration
|
|||
After=conky.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Type=simple
|
||||
WorkingDirectory=/home/citrullux/ModernOSLabs/src
|
||||
ExecStart=/usr/bin/python3 /home/citrullux/ModernOSLabs/src/main.py -f
|
||||
Restart=on-failure
|
||||
RestartSec=30
|
||||
ExecStartPre=/usr/bin/sleep 5
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
18
src/parser.py
Normal file
18
src/parser.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import json
|
||||
import urllib.request
|
||||
|
||||
|
||||
def parse_weather() -> None:
|
||||
current = {}
|
||||
forecast = {}
|
||||
data = {}
|
||||
response = urllib.request.urlopen("http://127.0.0.1:7841", timeout=10).read()
|
||||
data = json.loads(response)
|
||||
for params in data["current"]:
|
||||
value = data["current"][params]
|
||||
unit = data["current_units"][params]
|
||||
current[params] = str(value) + " " + str(unit)
|
||||
print(current)
|
||||
|
||||
|
||||
parse_weather()
|
|
@ -8,9 +8,9 @@ def weather_handler(date: str) -> dict:
|
|||
# Request variables
|
||||
api_link = "https://api.open-meteo.com/v1/forecast?"
|
||||
coordinates = [48.712, 44.514]
|
||||
weather_values = "temperature_2m,relative_humidity_2m,rain,snowfall,weather_code,wind_speed_10m,wind_direction_10m"
|
||||
weather_values = "temperature_2m,precipitation_probability,relative_humidity_2m,rain,snowfall,weather_code,wind_speed_10m,wind_direction_10m"
|
||||
timezone = "Europe/Moscow"
|
||||
days = "3"
|
||||
days = "7"
|
||||
url = (
|
||||
api_link
|
||||
+ "latitude="
|
||||
|
|
Loading…
Reference in New Issue
Block a user