You are not logged in.

#1576 2021-09-14 06:23:07

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,554

Re: Show us your conky

^^Hello, my friend,

this is just for camouflage. For the youth. The old always come later 'on.   lol  cry

Offline

#1577 2021-09-14 12:54:27

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,779

Re: Show us your conky

Ahhhhhhhh  a wise man once said:

Use the 9th, conkystador, use the 9th!


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#1578 2021-09-15 13:51:42

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,554

Re: Show us your conky

unklar wrote:

^^Hello, my friend,

this is just for camouflage. For the youth. The old always come later 'on.   lol  cry

big_smile  Can you still remember

Sector11 wrote:

My conky: S11_WTD.conky

World Time Date & Forecast - CCCC: S11, ragamatrix, Habitual & TeoBigusGeekus

    Habitual wrote the daylight.sh script that gets the daylight/cloud cover image: /media/5/Conky/images/world_1600.jpg
        - in 2010 - it's old, still works.
    I found the a simple weather site in China (Today's Hi/Low, simple condition) and the 'data collection' script was done by Teo: majorcities
    draw-bg.lua does the fake beveled edge.
    conky ${tztime} gets the time for each location
    ${if_match} compares the date of each ${tztime [place] %d} with ${tztime NZ %d} (New Zealand) to display colour for the dates of the two days.
    A whole bunch of ${goto xxx} commands with a few ${voffsets xx} to fine tune things

A few days ago, a user here in the German arch forum posted a phyton script to show the International Space Station ISS on the desktop live (as a "wandering red pixel").
I tested this on Debian/siduction/LXDE and it works(left to check in browser).
iss3.th.png   link

I would like to have this in Conky. Unfortunately I don't know python, because the window doesn't appear in conky, but further on the desk. The background image, what the script fetches, is also not my case. I'm sure you know better ones (see above) smile .

Anyway, this is what I have:  smile
iss.py

#!/usr/bin/python3

import json
import sys
import time

from io import BytesIO
from pathlib import Path
from subprocess import run

import requests

from PIL import Image, ImageDraw


SCREEN_SIZE = 720, 480
REFRESH_TIME = 5
POS_COLOR = 255, 0, 0
WORLD_PNG_URL = (
    'https://eoimages.gsfc.nasa.gov/images/imagerecords/147000/147190/'
    'eo_base_2020_clean_3600x1800.png'
)
ISS_POS_URL = 'http://api.open-notify.org/iss-now.json'


def make_paths():
    home = Path.home()
    cachedir = home / '.cache'
    if cachedir.exists():
        dir_ = cachedir / 'py-iss-bg'
    else:
        dir_ = home / '.py-iss-bg'
    paths = {
        'dir': dir_,
        'world': dir_ / 'world.png',
        'data': dir_ / 'pos.json',
        'stop': dir_ / 'stop',
        'bg_file': home / '.iss.png',
    }
    dir_.mkdir(exist_ok=True)
    return paths


def get_clean_image(path):
    if not path.is_file():
        req = requests.get(WORLD_PNG_URL)
        img = Image.open(BytesIO(req.content))
        req.close()
        img = img.resize(SCREEN_SIZE)
        img.save(str(path))
    else:
        img = Image.open(str(path))
    return img


def get_current_iss_data(save_path=None):
    req = requests.get(ISS_POS_URL)
    data = req.json()
    req.close()
    if save_path is not None:
        with save_path.open('w') as fp:
            json.dump(data, fp, indent=2)
    return data


def draw_position(img, lat, lon, save_path=None):
    width, height = img.size
    x = int(width * (180 + lon) / 360)
    y = int(height * (90 - lat) / 180)
    draw = ImageDraw.Draw(img)
    draw.rectangle([(x, y), (x+3, y+3)], fill=POS_COLOR, outline=POS_COLOR)
    if save_path is not None:
        img.save(str(save_path), 'PNG')
    else:
        img.save(sys.stdout, 'PNG')


def set_background(img_path):
    # Command to change wallpaper for cinnamon
    # cmd = ['gsettings', 'set', 'org.cinnamon.desktop.background',
    #        'picture-uri', f'file://{img_path}']
    cmd = ['pcmanfm', '-w', str(img_path)]
    run(cmd)


def main():
    paths = make_paths()
    timestamp = 0
    while True:
        if paths['stop'].exists():
            paths['stop'].unlink()
            break
        start = time.monotonic()
        data = get_current_iss_data(paths['data'])
        if data['timestamp'] > timestamp:
            timestamp = data['timestamp']
            lat = float(data['iss_position']['latitude'])
            lon = float(data['iss_position']['longitude'])
            clean_image = get_clean_image(paths['world'])
            draw_position(clean_image, lat, lon, paths['bg_file'])
            set_background(paths['bg_file'])
        sleep_time = start + REFRESH_TIME - time.monotonic()
        if sleep_time > 0:
            time.sleep(sleep_time)


if __name__ == '__main__':
    main()

whitie_test-conky9

# test-conky auf der Basis des Python-Script von @Withie
# https://forum.archlinux.de/d/34146-iss-in-echtzeit-auf-dem-bildschirmhintergrund/4
# und den Daten von @Habitual, Sector11, @ragamatrix, @TeoBigusGeekus
# @unklar 2021-09-

    background yes

    cpu_avg_samples 2
    net_avg_samples 2
    
    default_color ffffff
    default_outline_color 000000
    default_shade_color 000000
    color0 ffffff #white
    color1 144556 #dark blue
    color2 33b0dc #hellblue
    color3 ff8c00 #dark orange
    color4 00ffff #cain
    color5 c0c0c0 #silver
    color6 808080 #gray
    
    double_buffer yes
    no_buffers yes

#border_width 1
#draw_borders no
#draw_graph_borders yes
#draw_outline no
#draw_shades no
#extra_newline no

    use_xft yes
    xftfont monofur:size=10
    xftalpha 1
    override_utf8_locale yes
    uppercase no
    use_spacer none
    
    alignment top_left
    gap_x 40
    gap_y 40
    minimum_size 720 480
    maximum_width 720
    
    own_window yes
    own_window_class Conky
    own_window_type normal
    own_window_transparent no
    own_window_hints skip_taskbar,skip_pager,below
    own_window_argb_visual yes
#own_window_argb_value 180
#own_window_colour 144556
    own_window_title ISS-TEST

    show_graph_range no
    show_graph_scale no
    stippled_borders 0
    update_interval 1

#default drawing
    draw_shades no
    draw_outline no
    draw_borders no
    draw_graph_borders yes



TEXT
${execi 86400 $HOME/bin/daylight.sh}\
${execi 86400 $HOME/worldmap/iss.py}\
${image $HOME/.iss.png -s 720x480 -p 0,0}

glasses 10

--https://forum.archlinux.de/d/34146-iss-in-echtzeit-auf-dem-bildschirmhintergrund/4
--whitie_test10 @unklar 2021-09-
--.....

conky.config = {
    background = true,

    cpu_avg_samples = 2,
    net_avg_samples = 2,

    default_color = '#ffffff',
    default_outline_color = '#000000',
    default_shade_color = '#000000',
    color0 = '#ffffff',--#white
    color1 = '#144556',--#dark blue
    color2 = '#33b0dc',--#hellblue
    color3 = '#ff8c00',--#dark orange
    color4 = '#00ffff',--#cain
    color5 = '#c0c0c0',--#silver
    color6 = '#808080',--#gray

    double_buffer = true,
    no_buffers = true,

--border_width = 1,
--draw_borders = false,
--draw_graph_borders = true,
--draw_outline = false,
--draw_shades = false,
--extra_newline = false,

    use_xft = true,
    font = 'monofur:size=10',
    uppercase = false,
    use_spacer = 'none',

    alignment = 'top_left',
    gap_x = 40,
    gap_y = 40,
    minimum_height = 480,
    minimum_width = 720,

    out_to_console = false,
    out_to_ncurses = false,
    out_to_stderr = false,
    out_to_x = true,

    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'normal',
    own_window_transparent = false, --true,
    own_window_hints = 'skip_taskbar,skip_pager',
    own_window_argb_visual = true,
--own_window_argb_value = 180,
    own_window_colour = '#144556',
    own_window_title = 'ISS-TEST',

    show_graph_range = false,
    show_graph_scale = false,
    stippled_borders = 0,
    update_interval = 1.0,
--if_up_strictness = 'address',

    -- default drawing
    draw_shades = false,
    draw_outline = false,
    draw_borders = false,
    draw_graph_borders = true,
--default_bar_width = 150, default_bar_height = 5,
--default_graph_width = 150, default_graph_height = 12,
--default_gauge_width = 20, default_gauge_height = 20,


}

conky.text = [[
${execi 86400 $HOME/bin/daylight.sh}\
${execi 86400 $HOME/worldmap/iss.py}\
${image $HOME/.iss.png -s 720x480 -p 0,0}
]];

it is expected:
jq
python (in Debian python3)
python-requests (in Debian python3-requests)
pcmanfm (does it have to be this file manager?)


This would give "the old" with the "young" again a puzzle  lol  , whereby, who knows python (where is xaos52 - The Good Doctor - ?) .   hmm

Offline

#1579 2021-09-15 16:10:06

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,779

Re: Show us your conky

unklar wrote:
unklar wrote:

^^Hello, my friend,

this is just for camouflage. For the youth. The old always come later 'on.   lol  cry

big_smile  Can you still remember

Sector11 wrote:

My conky: S11_WTD.conky

World Time Date & Forecast - CCCC: S11, ragamatrix, Habitual & TeoBigusGeekus

OH yea I remember that well.

Now it isn't W(eather)T(ime)D(ate) any more as a few of those scripts went up in smoke when the sites they grabbed into from changed. Today, S11_WTD.conky, is an empty shell of what it use to be..

And for me:
python is a snake
java means coffee and
C+ is a school grade that makes parent frown in a bad way.


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#1580 2021-09-17 11:16:33

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,554

Re: Show us your conky

^Got a little further...  Unfortunately not yet in the Conky, but always new instances of the image viewer.   sad

iss5.th.png

#!/usr/bin/python3

import json
import sys
import time

from io import BytesIO
from pathlib import Path
from subprocess import run

import requests

from PIL import Image, ImageDraw


SCREEN_SIZE = 800, 444
REFRESH_TIME = 5
POS_COLOR = 255, 0, 0
WORLD_PNG_URL = (
    'http://static.die.net/earth/mercator/800.jpg'
    '800_800x444.jpg'
)
ISS_POS_URL = 'http://api.open-notify.org/iss-now.json'


def make_paths():
    home = Path.home()
    cachedir = home / '.cache'
    if cachedir.exists():
        dir_ = cachedir / 'py-iss-bg'
    else:
        dir_ = home / '.py-iss-bg'
    paths = {
        'dir': dir_,
        'world': dir_ / '800.jpg',
        'data': dir_ / 'pos.json',
        'stop': dir_ / 'stop',
        'bg_file': home / '800.png',
    }
    dir_.mkdir(exist_ok=True)
    return paths


def get_clean_image(path):
    if not path.is_file():
        req = requests.get(WORLD_PNG_URL)
        img = Image.open(BytesIO(req.content))
        req.close()
        img = img.resize(SCREEN_SIZE)
        img.save(str(path))
    else:
        img = Image.open(str(path))
    return img


def get_current_iss_data(save_path=None):
    req = requests.get(ISS_POS_URL)
    data = req.json()
    req.close()
    if save_path is not None:
        with save_path.open('w') as fp:
            json.dump(data, fp, indent=2)
    return data


def draw_position(img, lat, lon, save_path=None):
    width, height = img.size
    x = int(width * (180 + lon) / 360)
    y = int(height * (90 - lat) / 180)
    draw = ImageDraw.Draw(img)
    draw.rectangle([(x, y), (x+3, y+3)], fill=POS_COLOR, outline=POS_COLOR)
    if save_path is not None:
        img.save(str(save_path), 'PNG')
    else:
        img.save(sys.stdout, 'PNG')


def set_background(img_path):
    # Command to change wallpaper for cinnamon
    # cmd = ['gsettings', 'set', 'org.cinnamon.desktop.background',
    #        'picture-uri', f'file://{img_path}']
    cmd = ['pcmanfm', '--desktop-off', str(img_path)]
    run(cmd)


def main():
    paths = make_paths()
    timestamp = 0
    while True:
        if paths['stop'].exists():
            paths['stop'].unlink()
            break
        start = time.monotonic()
        data = get_current_iss_data(paths['data'])
        if data['timestamp'] > timestamp:
            timestamp = data['timestamp']
            lat = float(data['iss_position']['latitude'])
            lon = float(data['iss_position']['longitude'])
            clean_image = get_clean_image(paths['world'])
            draw_position(clean_image, lat, lon, paths['bg_file'])
            set_background(paths['bg_file'])
        sleep_time = start + REFRESH_TIME - time.monotonic()
        if sleep_time > 0:
            time.sleep(sleep_time)


if __name__ == '__main__':
    main()

Offline

#1581 2021-09-17 15:07:19

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,779

Re: Show us your conky

The chinese site that I grabbed the temps from, with Teo's expert help, has revamped their site.
It's not all on one page any more.  sad

This is the revamped site:
https://www.hko.gov.hk/en/wxinfo/worldwx/wwi.htm

The script that gets the image, still works BUT the image saved is world_1600.jpg is a text file ???

~/bin/daylight.sh

#!/bin/bash

rm -f /media/5/Conky/images/world_1600.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_640.jpg http://static.die.net/earth/mercator/640.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_800.jpg http://static.die.net/earth/mercator/800.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_1024.jpg http://static.die.net/earth/mercator/1024.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_1280.jpg http://static.die.net/earth/mercator/1280.jpg
#wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_1600.jpg http://static.die.net/earth/mercator/1600.jpg

wget -U Mozilla/5.0 --quiet -r -O /media/5/Conky/images/world_1600.jpg http://static.die.net/earth/mercator/1600.jpg
# or # wget -U Mozilla/5.0 http://static.die.net/earth/mercator/640.jpg
## kill -HUP `ps axu | grep conky | grep daylight | grep -v grep | awk '{print $2}'` >/dev/null 2>&1
# killall -HUP conky

http://static.die.net/earth/mercator/1600.jpg

sad


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#1582 2021-09-18 07:55:53

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,554

Re: Show us your conky

Hello, my friend.

I have no difficulties here with 1600.jpg and the others. The trick is, you have to remove everything in the browser line from the question mark ? after the first call and do the call again. wink

Probably the cancer of the Internet "Cloudfare" is involved in the first call and falsified.

Offline

#1583 2021-09-18 15:59:44

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,779

Re: Show us your conky

hahahaha  And right there "Probably the cancer of the Internet "Cloudfare" is involved in the first call and falsified." I am confuzzed and understand that this is beyond my programming skill set.

confuzzed: My wife, Anne, may she rest in peace, use to say confuzzed instead of confused.  She came from Cape Breton in Canada and they tesnd to talk a little funny but are like Newfoundlanders just the friendliest of people. big_smile


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#1584 2021-09-25 19:08:12

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,554

Re: Show us your conky

Offline

#1585 2021-09-25 21:27:18

Martin
Member
From: Stockholm, Sweden
Registered: 2015-10-01
Posts: 573
Website

Re: Show us your conky

Nice.

Entropy?

/Martin


"Problems worthy of attack
prove their worth by hitting back."
Piet Hein

Offline

#1586 Yesterday 07:55:52

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 1,554

Re: Show us your conky

Martin wrote:

Nice.

Entropy?

/Martin

Entropy:${goto 100}${entropy_avail} / ${entropy_poolsize} - ${entropy_perc}%

All here and here.   smile

Offline

Board footer

Powered by FluxBB