Posta il tuo .conkyrc & png ""Leggete in 1°Pagina conkyForecast""

Il ritrovo della comunità dove confrontarsi e discutere sulle notizie dal mondo dell'informatica, di Ubuntu e di tutto quello che la riguarda, novità, pettegolezzi e quant'altro.
Avatar utente
alecive
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1886
Iscrizione: venerdì 12 dicembre 2008, 14:09
Desktop: gnome-shell o unity
Distribuzione: Ubuntu 12.04
Località: Sestri Levante
Contatti:

Re: Posta il tuo .conkyrc & png

Messaggio da alecive »

E' un sì, è un sì! :D

Codice: Seleziona tutto

alecive@antigone:~$ conkyForecast --help
Usage: conkyForecast.py [options]

Options:
  -h, --help            show this help message and exit
  -l CODE, --location=CODE
                        location code for weather data [default: UKXX0103],Use
                        the following url to determine your location code by
                        city name:
                        http://xoap.weather.com/search/search?where=Norwich
  -d DATATYPE, --datatype=DATATYPE
                        [default: HT] The data type options are: DW (Day of
                        Week), WF (Weather Font output), WI (Weather Icon
                        Path), LT (Forecast:Low Temp,Current:Feels Like Temp),
                        HT (Forecast:High Temp,Current:Current Temp), CC
                        (Current Conditions), CT (Conditions Text), PC
                        (Precipitation Chance), HM (Humidity), VI
                        (Visibility), WD (Wind Direction), WA (Wind Angle - in
                        degrees), WS (Wind Speed), WG (Wind Gusts), BF
                        (Bearing Font), BI (Bearing Icon Path), BS (Bearing
                        font with Speed), CN (City Name), CO (Country), OB
                        (Observatory), SR (SunRise), SS (SunSet), DL
                        (DayLight), MP (Moon Phase), MF (Moon Font), MI (Moon
                        Icon Path), BR (Barometer Reading), BD (Barometer
                        Description), UI (UV Index), UT (UV Text), DP (Dew
                        Point), WM (weather map fetch and image path
                        returned),  LU (Last Update at weather.com), LF (Last
                        Fetch from weather.com). Not applicable at command
                        line when using templates.
  -s NUMBER, --startday=NUMBER
                        define the starting day number, if omitted current
                        conditions are output. Not applicable at command line
                        when using templates.
  -e NUMBER, --endday=NUMBER
                        define the ending day number, if omitted only starting
                        day data is output. Not applicable at command line
                        when using templates.
  -S NUMBER, --spaces=NUMBER
                        [default: 1] Define the number of spaces between
                        ranged output. Not applicable at command line when
                        using templates.
  -t FILE, --template=FILE
                        define a template file to generate output in one call.
                        A displayable item in the file is in the form
                        [--datatype=HT --startday=1]. The following are
                        possible options within each item: --location,--
                        datatype,--startday,--endday,--night,--shortweekday,--
                        imperial,--beaufort,--hideunits,--hidedegreesymbol,--
                        spaces,--minuteshide. Note that the short forms of the
                        options are not supported! If any of these options is
                        set from the commandline, it sets the default value of
                        the option for all template items.
  -L LOCALE, --locale=LOCALE
                        override the system locale for language output
                        (bg=bulgarian, cs=czech, de=german, es=spanish,
                        en=english, es=spanish, fj=fijian, fr=french,
                        it=alecive@antigone:~$ conkyForecast --help
Usage: conkyForecast.py [options]

Options:
  -h, --help            show this help message and exit
  -l CODE, --location=CODE
                        location code for weather data [default: UKXX0103],Use
                        the following url to determine your location code by
                        city name:
                        http://xoap.weather.com/search/search?where=Norwich
  -d DATATYPE, --datatype=DATATYPE
                        [default: HT] The data type options are: DW (Day of
                        Week), WF (Weather Font output), WI (Weather Icon
                        Path), LT (Forecast:Low Temp,Current:Feels Like Temp),
                        HT (Forecast:High Temp,Current:Current Temp), CC
                        (Current Conditions), CT (Conditions Text), PC
                        (Precipitation Chance), HM (Humidity), VI
                        (Visibility), WD (Wind Direction), WA (Wind Angle - in
                        degrees), WS (Wind Speed), WG (Wind Gusts), BF
                        (Bearing Font), BI (Bearing Icon Path), BS (Bearing
                        font with Speed), CN (City Name), CO (Country), OB
                        (Observatory), SR (SunRise), SS (SunSet), DL
                        (DayLight), MP (Moon Phase), MF (Moon Font), MI (Moon
                        Icon Path), BR (Barometer Reading), BD (Barometer
                        Description), UI (UV Index), UT (UV Text), DP (Dew
                        Point), WM (weather map fetch and image path
                        returned),  LU (Last Update at weather.com), LF (Last
                        Fetch from weather.com). Not applicable at command
                        line when using templates.
  -s NUMBER, --startday=NUMBER
                        define the starting day number, if omitted current
                        conditions are output. Not applicable at command line
                        when using templates.
  -e NUMBER, --endday=NUMBER
                        define the ending day number, if omitted only starting
                        day data is output. Not applicable at command line
                        when using templates.
  -S NUMBER, --spaces=NUMBER
                        [default: 1] Define the number of spaces between
                        ranged output. Not applicable at command line when
                        using templates.
  -t FILE, --template=FILE
                        define a template file to generate output in one call.
                        A displayable item in the file is in the form
                        [--datatype=HT --startday=1]. The following are
                        possible options within each item: --location,--
                        datatype,--startday,--endday,--night,--shortweekday,--
                        imperial,--beaufort,--hideunits,--hidedegreesymbol,--
                        spaces,--minuteshide. Note that the short forms of the
                        options are not supported! If any of these options is
                        set from the commandline, it sets the default value of
                        the option for all template items.
  -L LOCALE, --locale=LOCALE
                        override the system locale for language output
                        (bg=bulgarian, cs=czech, de=german, es=spanish,
                        en=english, es=spanish, fj=fijian, fr=french,
                        it=italian, nl=dutch, pl=polish, ro=romanian,
                        sk=slovak, more to come)
  -i, --imperial        request imperial units, if omitted output is in
                        metric.
  -b, --beaufort        request beaufort scale for wind speeds, if omitted
                        output is either metric/imperial.
  -n, --night           switch output to night data, if omitted day output
                        will be output.
  -w, --shortweekday    Shorten the day of week data type to 3 characters.
  -u, --hideunits       Hide units such as mph or C, degree symbols (°) are
                        still shown.
  -x, --hidedegreesymbol
                        Hide the degree symbol used with temperature output,
                        this is only valid if used in conjunction with
                        --hideunits.
  -m NUMBER, --minuteshide=NUMBER
                        Works only with LU and LF. If present, hides the date
                        part of the LU or LF timestamp if the day of the
                        timestamp is today. The time part is also hidden, if
                        the timestamp is older than minutes specified in this
                        argument. If set to 0, the time part is always shown.
                        If set to -1, the value EXPIRY_MINUTES from the config
                        file is used.
  -c WIDTH, --centeredwidth=WIDTH
                        If used the output will be centered in a string of the
                        set width, padded out with spaces, if the output width
                        is greater than the setting it will be truncated
  -r, --refetch         Fetch data regardless of data expiry.
  -v, --verbose         Request verbose output, not a good idea when running
                        through conky!
  -V, --version         Displays the version of the script.
  --errorlogfile=FILE   If a filepath is set, the script appends errors to the
                        filepath.
  --infologfile=FILE    If a filepath is set, the script appends info to the
                        filepath.
italian, nl=dutch, pl=polish, ro=romanian,
                        sk=slovak, more to come)
  -i, --imperial        request imperial units, if omitted output is in
                        metric.
  -b, --beaufort        request beaufort scale for wind speeds, if omitted
                        output is either metric/imperial.
  -n, --night           switch output to night data, if omitted day output
                        will be output.
  -w, --shortweekday    Shorten the day of week data type to 3 characters.
  -u, --hideunits       Hide units such as mph or C, degree symbols (°) are
                        still shown.
  -x, --hidedegreesymbol
                        Hide the degree symbol used with temperature output,
                        this is only valid if used in conjunction with
                        --hideunits.
  -m NUMBER, --minuteshide=NUMBER
                        Works only with LU and LF. If present, hides the date
                        part of the LU or LF timestamp if the day of the
                        timestamp is today. The time part is also hidden, if
                        the timestamp is older than minutes specified in this
                        argument. If set to 0, the time part is always shown.
                        If set to -1, the value EXPIRY_MINUTES from the config
                        file is used.
  -c WIDTH, --centeredwidth=WIDTH
                        If used the output will be centered in a string of the
                        set width, padded out with spaces, if the output width
                        is greater than the setting it will be truncated
  -r, --refetch         Fetch data regardless of data expiry.
  -v, --verbose         Request verbose output, not a good idea when running
                        through conky!
  -V, --version         Displays the version of the script.
  --errorlogfile=FILE   If a filepath is set, the script appends errors to the
                        filepath.
  --infologfile=FILE    If a filepath is set, the script appends info to the
                        filepath.
La follia è come la gravità. Basta una piccola spinta.                              AwOken Iconset - Rilasciata la  2.4!! (c'è anche il ppa [lucid-maverick-natty-oneiric-precise]!)
Avatar utente
fango
Prode Principiante
Messaggi: 40
Iscrizione: domenica 1 novembre 2009, 22:52

Re: Posta il tuo .conkyrc & png

Messaggio da fango »

:o :o :o
Avatar utente
fango
Prode Principiante
Messaggi: 40
Iscrizione: domenica 1 novembre 2009, 22:52

Re: Posta il tuo .conkyrc & png

Messaggio da fango »

e pure qualcosa che non va rimane,l'ho provato anche io,e non solo le temperature effettive e percepite restano sempre le stesse,ma con il mio indirizzo mi risulta Bergamo e non Brescia.
Avatar utente
m3nhir
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 2291
Iscrizione: mercoledì 31 dicembre 2008, 18:48
Desktop: gnome-shell
Distribuzione: Ubuntu 12.04.4 LTS x86_64

Re: Posta il tuo .conkyrc & png

Messaggio da m3nhir »

qualche giorno addietro mi è arrivata ua mail dal sito weather.com che annunciava un aggiornamento del sito.
Non vorrei che fosero variati i riferimenti che usa conkyforecast nel leggere i vari dati di riferimento.  :-\
Chi sa ascoltare non soltanto è simpatico a tutti , ma dopo un pò finisce  con l'imparare qualcosa.
-Wilson Mizner- Linux User # 207701 Ubuntu User # 27508
Avatar utente
Diabolik62
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 16046
Iscrizione: domenica 20 dicembre 2009, 16:29
Distribuzione: wind 10049 archfce4.12

Re: Posta il tuo .conkyrc & png

Messaggio da Diabolik62 »

fango ha scritto: e pure qualcosa che non va rimane,l'ho provato anche io,e non solo le temperature effettive e percepite restano sempre le stesse,ma con il mio indirizzo mi risulta Bergamo e non Brescia.
io ho guardato su weater e sono di bg le temperature corrispondono
il conky meteo mi da 16 gradi su weather e ugali 61f corrispndono a 16 gradi celsius poi le differenze tra BG-BS non sono cosi differenti anzi sono quasi identiche x non dire uguali ;D
http://www.weather.com/weather/today/Be ... y+ITXX0005
http://www.weather.com/weather/today/Br ... y+ITXX0008
Avatar utente
fango
Prode Principiante
Messaggi: 40
Iscrizione: domenica 1 novembre 2009, 22:52

Re: Posta il tuo .conkyrc & png

Messaggio da fango »

si diciamo che il codice sia simile,ma è strano che faccia di questi errori,magari è dovuto proprio all'aggiornamento del sito.
deegan
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2639
Iscrizione: lunedì 28 aprile 2008, 12:42
Distribuzione: Ubuntu 20.04
Sesso: Maschile
Località: Varese

Re: Posta il tuo .conkyrc & png

Messaggio da deegan »

Ciao ragazzi,  ;)

Come mai non mi vengono visualizzati nel conky questi feed RSS?

Codice: Seleziona tutto

${rss http://www.furiousairbrush.com/public/portale/gymrss.php?forum=6&news 10 feed_title}
MB* ASUS TUF Gaming Z690 SV* EVGA RTX 3080 Ti CPU* i7-12700K
RAM* Vengeance RGB PRO 32GB 3600MHz SSD* Samsung 980 PRO 2TB
Avatar utente
fango
Prode Principiante
Messaggi: 40
Iscrizione: domenica 1 novembre 2009, 22:52

Re: Posta il tuo .conkyrc & png

Messaggio da fango »

pure gli RSS,se continuiamo a inserirgli operazioni,tra non molto conky diventerà un sistema operativo automatico. ;D
deegan
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2639
Iscrizione: lunedì 28 aprile 2008, 12:42
Distribuzione: Ubuntu 20.04
Sesso: Maschile
Località: Varese

Re: Posta il tuo .conkyrc & png

Messaggio da deegan »

deegan ha scritto: Ciao ragazzi,  ;)

Come mai non mi vengono visualizzati nel conky questi feed RSS?

Codice: Seleziona tutto

${rss http://www.furiousairbrush.com/public/portale/gymrss.php?forum=6&news 10 feed_title}
Ci sono riuscito.............da solo........ :P
MB* ASUS TUF Gaming Z690 SV* EVGA RTX 3080 Ti CPU* i7-12700K
RAM* Vengeance RGB PRO 32GB 3600MHz SSD* Samsung 980 PRO 2TB
Avatar utente
SuNjACk
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1061
Iscrizione: martedì 19 maggio 2009, 16:27
Località: Pesaro

Re: Posta il tuo .conkyrc & png

Messaggio da SuNjACk »

fango ha scritto: pure gli RSS,se continuiamo a inserirgli operazioni,tra non molto conky diventerà un sistema operativo automatico. ;D
non hai tutti i torti ;D
Desktop openbox Halloween Documents Linux non è Windows
Free Software Is A Matter Of Liberty Not Price
deegan
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2639
Iscrizione: lunedì 28 aprile 2008, 12:42
Distribuzione: Ubuntu 20.04
Sesso: Maschile
Località: Varese

Re: Posta il tuo .conkyrc & png

Messaggio da deegan »

Ragazzi, chi riesce a spiegarmi a che serve questo script per conky?   8)

conkyGuayadeque-GetCoverart.py

Codice: Seleziona tutto

#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#  Author: Kaivalagi
# Created: 06/08/2010
import traceback
import shutil
import gobject
import os
import sys
import eyeD3

try:
    import dbus
    DBUS_AVAIL = True
except ImportError:
    # Dummy D-Bus library
    class _Connection:
        get_object = lambda *a: object()
    class _Interface:
        __init__ = lambda *a: None
        ListNames = lambda *a: []
    class Dummy: pass
    dbus = Dummy()
    dbus.Interface = _Interface
    dbus.service = Dummy()
    dbus.service.method = lambda *a: lambda f: f
    dbus.service.Object = object
    dbus.SessionBus = _Connection
    DBUS_AVAIL = False

class Guayadeque_GetCoverart:

    COVERART_DESTINATION = "/tmp/guayadeque-coverart.jpg"
    current = ""
    
    
    def __init__(self):
        
        try:
            print "conkyGuayadeque-GetCoverart - Cover art will be copied to '%s'"%self.COVERART_DESTINATION
            print "* Initialising: Creating a D-Bus session..."
            self.bus = dbus.SessionBus()
            self.remote_player = self.bus.get_object('org.mpris.guayadeque', '/Player')
            self.iface_player = dbus.Interface(self.remote_player, 'org.freedesktop.MediaPlayer')
            self.iface_player.connect_to_signal("TrackChange", self.OnTrackChange)
            print "* Listening: waiting for a track change..."
        except:
            print "** Error: Is Guayadeque running? The D-Bus service is not working."
            traceback.print_exc()
    
    def OnTrackChange(self,sender=None):
        try:
            
            self.props = self.iface_player.GetMetadata()
            
            src = self.getCoverartPath()
            
            if src == None:
                
                print "** Track Changed: No cover art images known, Checking for embedded images in audio file..."
                
                if len(self.getCoverartImage(self.COVERART_DESTINATION)) > 0:
                    print "**                Image found and extracted to %s."%self.COVERART_DESTINATION
                else:
                    print "**                No image found."
                    
            elif src == self.current:
                
                print "** Track changed: Cover art unchanged, no copy necessary"

            elif os.path.exists(src) == True:
                
                print "** Track changed: Copying '%s' to '%s'"%(src,self.COVERART_DESTINATION)
                shutil.copy(src, self.COVERART_DESTINATION)
                self.current = src
                                    
            else:
                print "** Track changed: No sure what to do: src = '%s', dst='%s'"%(src,self.COVERART_DESTINATION) 
        except:
            print "*** Error: Begin"
            traceback.print_exc()
            print "*** Error: End"
        finally:
            print "* Listening: waiting for a track change..."
                        
    def getCoverartPath(self):
        
        try:       
            if "arturl" in self.props:
                coverart = os.path.expanduser(str(self.props["arturl"]).replace("file://","").replace("%20",""))
                #coverart = os.path.expanduser(str(props["arturl"]).replace(" ", "%20"))
                if coverart.find("http://") != -1:
                    coverart = None
            else:
                coverart = None
                
            return coverart
        except:
            traceback.print_exc()
            
    def getCoverartImage(self,savepath):

        # get file apth
        if "location" in self.props:
            location = self.props["location"]
        
        srcfilepath = location.replace("file://","").replace("%20"," ")
        dstfolder = os.path.dirname(savepath) 
        dstfile = savepath.replace(os.path.dirname(savepath)+"/","")
        
        tag = eyeD3.Tag()
        
        if os.path.isfile(srcfilepath):
            if os.path.splitext(srcfilepath)[1] == ".mp3":
                # Extract picture
                try:
                    tag.link(srcfilepath)
                    for image in tag.getImages():
                        image.writeFile(dstfolder, dstfile)
                        return savepath
                except:
                    print "Unable to extract image for: " + srcfilepath
                    traceback.print_exc()
        return ""


if __name__ == '__main__':
    from dbus.mainloop.glib import DBusGMainLoop
    DBusGMainLoop(set_as_default=True)
    loop = gobject.MainLoop()
    Guayadeque_GetCoverart()
    loop.run()
    
MB* ASUS TUF Gaming Z690 SV* EVGA RTX 3080 Ti CPU* i7-12700K
RAM* Vengeance RGB PRO 32GB 3600MHz SSD* Samsung 980 PRO 2TB
Avatar utente
beck_s
Prode Principiante
Messaggi: 214
Iscrizione: domenica 29 novembre 2009, 9:06
Località: Vicenza

Re: Posta il tuo .conkyrc & png

Messaggio da beck_s »

deegan ha scritto: Ragazzi, chi riesce a spiegarmi a che serve questo script per conky?   8)

conkyGuayadeque-GetCoverart.py
Get cover art, per avere la copertina dell'album della traccia in esecuzione, oltre credo al nome della canzone, dell'artista, dell'album, etc.
deegan
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2639
Iscrizione: lunedì 28 aprile 2008, 12:42
Distribuzione: Ubuntu 20.04
Sesso: Maschile
Località: Varese

Re: Posta il tuo .conkyrc & png

Messaggio da deegan »

beck_s ha scritto:
deegan ha scritto: Ragazzi, chi riesce a spiegarmi a che serve questo script per conky?   8)

conkyGuayadeque-GetCoverart.py
Get cover art, per avere la copertina dell'album della traccia in esecuzione, oltre credo al nome della canzone, dell'artista, dell'album, etc.
Allora non interessa... (bad)

Voglio capire come diamine posso fare per avere questo:
http://crunchbanglinux.org/forums/post/80473/#p80473
MB* ASUS TUF Gaming Z690 SV* EVGA RTX 3080 Ti CPU* i7-12700K
RAM* Vengeance RGB PRO 32GB 3600MHz SSD* Samsung 980 PRO 2TB
Avatar utente
beck_s
Prode Principiante
Messaggi: 214
Iscrizione: domenica 29 novembre 2009, 9:06
Località: Vicenza

Re: Posta il tuo .conkyrc & png

Messaggio da beck_s »

deegan ha scritto:
Voglio capire come diamine posso fare per avere questo:
http://crunchbanglinux.org/forums/post/80473/#p80473
L'immagine della terra è semplicemente caricata con il comando ${img } mentre per i dati ed il "mirino" viene utilizzato lo script sun.lua ;) maggiori informazioni QUI

Comunque ogni giorno mi stupisco  :o sempre di più di quante cose si possano fare con conky
deegan
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2639
Iscrizione: lunedì 28 aprile 2008, 12:42
Distribuzione: Ubuntu 20.04
Sesso: Maschile
Località: Varese

Re: Posta il tuo .conkyrc & png

Messaggio da deegan »

Ho fatto così:  ;D
.conkyrc

Codice: Seleziona tutto

## Test Conky
background yes


own_window yes
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_type normal

use_spacer none

override_utf8_locale yes
use_xft yes
update_interval 0.5
uppercase no  # set to yes if you want all text to be in uppercase
stippled_borders 0
border_inner_margin 0
border_width 0
default_outline_color black
default_shade_color black
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
default_color DCDCDC
color0 FFFFF0
color1 FFA07A
color2 FF8C00
color3 7FFF00
color4 778899
color5 FFDEAD
color6 00BFFF
color7 48D1CC
color8 FFFF00
color9 FF0000
text_buffer_size 1028
no_buffers yes
short_units yes
pad_percents 2
imlib_cache_size 0
# maximum_width 20
minimum_size 480 0 #width height

alignment bm  #  tl, tr, tm, bl, br, bm, ml, mr
gap_x 00 # left-right
gap_y 0 # up-down
xftfont Zekton:bold:size=12
xftalpha 1.0

lua_load /home/deegan/Scrivania/Conky/sun.lua
#lua_draw_hook_pre draw_newconky
TEXT
sun.lua

Codice: Seleziona tutto

--sun position lua script by mrpeachy 2010

--input latitude
--for northern hemisphere enter positive
--for southern hemisphere enter negative
latitude=-34.37


--input hemisphere
--for northern enter 1
--for southern enter 2
hemisphere=2

--edit the below line to input location of bash script
--in this case i have called the script "sundata.sh"
--location=('${exec /home/sector11/bin/sundata.sh}')

  location=('${exec /home/deegan/Scrivania/sundata.sh}')

require 'cairo'

function addzero10(num)
if tonumber(num) < 10 then
return "0" .. num
else
return num
end
end

function round(val, decimal)
  if (decimal) then
    return math.floor( (val * 10^decimal) + 0.5) / (10^decimal)
  else
    return math.floor(val+0.5)
  end
end

function string:split(delimiter)
local result = { }
local from  = 1
local delim_from, delim_to = string.find( self, delimiter, from  )
while delim_from do
table.insert( result, string.sub( self, from , delim_from-1 ) )
from  = delim_to + 1
delim_from, delim_to = string.find( self, delimiter, from  )
end
table.insert( result, string.sub( self, from  ) )
return result
end

function conky_draw_newconky()
if conky_window == nil then return end
local cs = cairo_xlib_surface_create(conky_window.display, conky_window.drawable, conky_window.visual, conky_window.width, conky_window.height)
cr = cairo_create(cs)
local updates=tonumber(conky_parse('${updates}'))

if updates ==5 then
test=(conky_parse(location))
end
if updates > 10 then

if hemisphere==1 then 
start=0
else
start=180
end

timer=(updates % 600)+1
if timer==1 then
test=(conky_parse(location))
end
test2=string.split(test, ":")

sunrisehours=test2[1]
sunrisemins=test2[2]
sunsethours=(test2[6])+12
sunsetmins=test2[7]
--time at sunrise and sunset in minutes
sun1=(test2[1]*60)+test2[2]
sun2=((test2[6]+12)*60)+test2[7]
sunlength=sun2-sun1

if tonumber(test2[3])<12 and test2[5]=="PM" then
sunhighhrs=(test2[3])+12
else
sunhighhrs=test2[3]
end

--time at solar noon in mins
sun3=(sunhighhrs*60)+(test2[4])
--calculate current time
hrs=os.date("%H")
min=os.date("%M")

--hrs=07
--min=46

current=(hrs*60)+min
total=(24*60)
--calculate offset to make solar noon at top
sundiff=(12*60)-sun3
--civil twilight for sunrise
ctr=(test2[8]*60)+test2[9]
--civil twilight for sunset
cts=((test2[10]+12)*60)+test2[11]
--sunrise altitude
ralt=test2[12]
--solar noon altitude
snalt=test2[13]
--sunset altitude
salt=test2[14]
--sunrize azimuth
rz=test2[15]
--solar noon azimuth
na=test2[16]
--sunset azimuth
sz=test2[17]
--sun declination (average of rise, noon and set)
sdec=(test2[18]+test2[19]+test2[20])/3

--sin(Alt) = cos(Lat) cos(Decl) cos(HAngle) + sin(Lat) sin(Dec)
--calculate altitude at solar noon
current=sun3
sha=(current-sun3)*(15/60)
cossha=math.cos(math.rad(sha))
cossundec=math.cos(math.rad(sdec))
coslat=math.cos(math.rad(latitude))
cosmath=cossha*cossundec*coslat
sinsundec=math.sin(math.rad(sdec))
sinlat=math.sin(math.rad(latitude))
sinmath=sinsundec*sinlat
sinelevation=cosmath+sinmath
elevation=math.deg(math.asin(sinelevation))
snalt=elevation

--calculate altitude at solar midnight
current=sun3+(12*60)
sha=(current-sun3)*(15/60)
cossha=math.cos(math.rad(sha))
cossundec=math.cos(math.rad(sdec))
coslat=math.cos(math.rad(latitude))
cosmath=cossha*cossundec*coslat
sinsundec=math.sin(math.rad(sdec))
sinlat=math.sin(math.rad(latitude))
sinmath=sinsundec*sinlat
sinelevation=cosmath+sinmath
elevation=math.deg(math.asin(sinelevation))
smalt=elevation*-1
--calculate sha when altitude=0
--sin(Alt) = cos(Lat) cos(Decl) cos(HAngle) + sin(Lat) sin(Dec)

sinalt0=math.sin(math.rad(0))
alt0math1=sinalt0-(sinlat*sinsundec)
alt0math2=alt0math1/coslat
alt0cossha=alt0math2/cossundec
shaalt0=math.deg(math.acos(alt0cossha))
alt0time1=shaalt0/(15/60)
alt0time=(alt0time1+sun3)

--calculate current solar altitude
current=(hrs*60)+min
sha=(current-sun3)*(15/60)
cossha=math.cos(math.rad(sha))
cossundec=math.cos(math.rad(sdec))
coslat=math.cos(math.rad(latitude))
cosmath=cossha*cossundec*coslat
sinsundec=math.sin(math.rad(sdec))
sinlat=math.sin(math.rad(latitude))
sinmath=sinsundec*sinlat
sinelevation=cosmath+sinmath
elevation=math.deg(math.asin(sinelevation))
curaltlong=elevation
curalt=round(curaltlong,2)

--calculate current azimuth
azmath1=(cossha*cossundec*sinlat)-(sinsundec*coslat)
azmath2=math.cos(math.rad(elevation))
cosaz=azmath1/azmath2
azi1=math.deg(math.acos(cosaz))
azi2=round(azi1, 2)


if sha>0 then
azi=azi2+180
else
azi=(azi2-180)*-1
end

if current==sundiff*-1 then azi=180 else end

--setup position
horizontal=100
vertical=150
radius=(snalt+(smalt))/2
raddiff=(snalt-smalt)/2

across=horizontal
down=vertical

--draws orbit circle
circx=across
circy=down
circrad=radius
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,0.4,0.4,0.4,1)
cairo_set_line_width (cr, 1)
cairo_stroke (cr)

--draw south
outer1=radius
text_arc=((2*math.pi/(total))*(total))
txs3=0-outer1*(math.sin(text_arc))
tys3=0+outer1*(math.cos(text_arc))

outer1=radius
text_arc=((2*math.pi/(total))*(total/2))
txs4=0-outer1*(math.sin(text_arc))
tys4=0+outer1*(math.cos(text_arc))

cairo_move_to (cr, across+txs3, down+tys3)
cairo_line_to (cr, across+txs4, down+tys4)
cairo_set_source_rgba(cr,0.5,0.5,0.5,1)
cairo_set_line_width (cr, 1)
cairo_stroke (cr)

--draws horizon stationary
--sin(Alt) = cos(Lat) cos(Decl) cos(HAngle) + sin(Lat) sin(Dec)

hamath1=math.sin(math.rad(0))-(sinlat*sinsundec)
hamath2=hamath1/(coslat*cossundec)

--calculate current azimuth
azmath1=(hamath2*cossundec*sinlat)-(sinsundec*coslat)
azmath2=math.cos(math.rad(0))
cosaz=azmath1/azmath2
azi1=math.deg(math.acos(cosaz))
azi0alt=(round(azi1, 2))+start

outer1=radius
text_arc=(2*math.pi/(360))*(azi0alt)+((2*math.pi/(360))*(180))
txs=0-outer1*(math.sin(text_arc))
tys=0+outer1*(math.cos(text_arc))

outer1=radius
text_arc=(2*math.pi/(360))*(azi0alt)
txs2=0-outer1*(math.sin(text_arc))
tys2=0+outer1*(math.cos(text_arc))

cairo_move_to (cr, horizontal-100, down+tys)
cairo_rel_line_to (cr, 200, 0)
cairo_set_source_rgba(cr,0.5,0.5,0.5,1)
cairo_set_line_width (cr, 1)
cairo_stroke (cr)

--draws current sun position
outer1=radius
text_arc=((2*math.pi/(360))*(azi))+((2*math.pi/(360))*(start))
txs=0-outer1*(math.sin(text_arc))
tys=0+outer1*(math.cos(text_arc))
circrad=1.6
circx=txs+across
circy=tys+down
cairo_arc(cr,circx,circy,circrad,0,2*math.pi)
cairo_close_path(cr)
cairo_set_source_rgba(cr,1,1,1,1)
cairo_fill (cr)


--draws text label

cairo_select_font_face (cr, "Mono", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, 10);
cairo_set_source_rgba (cr, 1, 1, 1, 1);
--current values above
cairo_move_to (cr, across-100, down-radius-40)
cairo_show_text (cr, "Time " .. addzero10(hrs) .. ":" .. min)
cairo_move_to (cr, across-100, down-radius-30)
cairo_show_text (cr, "Azimuth " .. azi .. "°")
cairo_move_to (cr, across-100, down-radius-20)
cairo_show_text (cr, "Altitude " .. curalt .. "°")

--table
cairo_move_to (cr, across-100, down+radius+40)
cairo_show_text (cr, "Time ")
cairo_move_to (cr, across-100, down+radius+50)
cairo_show_text (cr, "Altitude ")
cairo_move_to (cr, across-100, down+radius+60)
cairo_show_text (cr, "Azimuth ")
--titles
sr=-45
sn=5
ss=70
cairo_move_to (cr, across+sr, down+radius+30)
cairo_show_text (cr, "Sunrise")
cairo_move_to (cr, across+sn, down+radius+30)
cairo_show_text (cr, "Solar Noon")
cairo_move_to (cr, across+ss, down+radius+30)
cairo_show_text (cr, "Sunset")
sr=-38
sn=15
ss=72.5
cairo_move_to (cr, across+sr, down+radius+40)
cairo_show_text (cr, addzero10(test2[1]) .. ":" .. test2[2])
cairo_move_to (cr, across+sr, down+radius+50)
cairo_show_text (cr, test2[12] .. "°")
cairo_move_to (cr, across+sr, down+radius+60)
cairo_show_text (cr, test2[15] .. "°")

if test2[5]=="PM" and tonumber(test2[3])<12 then
sntime=(test2[3])+12
else
sntime=addzero10(test2[3])
end

cairo_move_to (cr, across+sn, down+radius+40)
cairo_show_text (cr, sntime .. ":" .. test2[4])
cairo_move_to (cr, across+sn, down+radius+50)
cairo_show_text (cr, test2[13] .. "°")
cairo_move_to (cr, across+sn, down+radius+60)
cairo_show_text (cr, test2[16] .. "°")

cairo_move_to (cr, across+ss, down+radius+40)
cairo_show_text (cr, (test2[6]+12) .. ":" .. test2[7])
cairo_move_to (cr, across+ss, down+radius+50)
cairo_show_text (cr, test2[14] .. "°")
cairo_move_to (cr, across+ss, down+radius+60)
cairo_show_text (cr, test2[17] .. "°")

cairo_move_to (cr, across-100, down+radius+80)
cairo_show_text (cr, "Length of Day " .. test2[21])
cairo_move_to (cr, across-100, down+radius+90)
cairo_show_text (cr, "Tomorrow will be " .. test2[22])

snz=round(test2[16],0)

if snz==180 then
cairo_move_to (cr, across-3, down-radius-5)
cairo_show_text (cr, "S")
cairo_move_to (cr, across-3, down+radius+12)
cairo_show_text (cr, "N")
else if snz==360 then
cairo_move_to (cr, across-3, down-radius-5)
cairo_show_text (cr, "N")
cairo_move_to (cr, across-3, down+radius+12)
cairo_show_text (cr, "S")
end
end

if curalt>-5 and curalt<5 and sha<0 then
cairo_move_to (cr, across-100, down-radius-10)
cairo_show_text (cr, "Sunrise")
else if curalt<5 and curalt>-5 and sha>0 then
cairo_move_to (cr, across-100, down-radius-10)
cairo_show_text (cr, "Sunset")
else if sha>-2 and sha<2 then
cairo_move_to (cr, across-100, down-radius-10)
cairo_show_text (cr, "Solar Noon")
end
end
end

end
end
sundata.sh

Codice: Seleziona tutto

#!/bin/bash
#!/bin/bash

#Setup nstructions.
#you will need to go to www.wunderground.com and locate your town/city
#then scroll down untill you see the astronomy section
#click on the button marked "extended view" 
#copy the resulting web address into the line beginning with "curl" below
#in place of the existing address (which is for St Louis, MO)
#see below for continued instruction

{
curl "http://www.wunderground.com/global/stations/87582.html?MR=0&extendedsun=sunon"
}>/tmp/sundata.html

{
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Actual Time</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Civil Twilight</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Altitude</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Azimuth</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=3 s="<td>Sun Declination</td>"
cat /tmp/sundata.html | nawk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=0 a=2 s="<td>Length of Day</td>"
cat /tmp/sundata.html |  grep -n 'Tomorrow will be' | sed -n 1p | awk -F'</span>.</div>' '{print $1}' 
}>/tmp/sundata.txt

#Instructions continued
#in the section below you will see the term "grep -n 'ART' "
#this is because for St Louis we use US Central Time.
# For your location look at the Astronomy section of the wunderground website
#for the lines that give times, the times will be followed by the timecode for your location.
# for example instead of CDT: London, England would be BST; Paris, France would be CEST
#replace all the instances of CDT with your timecode
#this concluded setup

{
#real time sunrise - hours and minutes
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 1p | awk -F'AM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's| ||g'
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 1p | awk -F'AM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's| ||g'
#real time solar noon - hours, minutes, am or pm
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 2p | awk -F'ART' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's|[ AMPM]||g'
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 2p | awk -F'ART' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's|[ AMPM]||g'
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 2p | awk -F'ART' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's|[0-9 ]||g'
#real time sunset - hours and minutes
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 3p | awk -F'PM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's| ||g'
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 3p | awk -F'PM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's| ||g'
#civil twilight- sunrise - hours and minutes
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 4p | awk -F'AM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's| ||g'
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 4p | awk -F'AM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's| ||g'
#civil twilight- sunset - hours and minutes
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 5p | awk -F'PM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $1}' | sed 's| ||g'
cat /tmp/sundata.txt |  grep -n 'ART' | sed -n 5p | awk -F'PM' '{print $1}' | awk -F'<td>' '{print $2}' | awk -F':' '{print $2}' | sed 's| ||g'
#altitude at sunrise
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 1p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#altitude at solar noon
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 2p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#altitude at sunset
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 3p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#azimuth at sunrise
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 4p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#azimuth at solar noon
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 5p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#azimuth at sunset
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 6p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#declination at sunrise
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 7p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#declination at solar noon
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 8p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#declination at sunset
cat /tmp/sundata.txt |  grep -n '°</td>' | sed -n 9p | awk -F'°</td>' '{print $1}' | awk -F'<td>' '{print $2}' | sed 's| ||g'
#length of day
cat /tmp/sundata.txt |  grep -n '</div>' | sed -n 1p | awk -F'</div>' '{print $1}' | awk -F'<div>' '{print $2}'
#tomorrow will be
cat /tmp/sundata.txt |  grep -n '<span class="b">' | sed -n 1p | awk -F'<span class="b">' '{print $2}'
}>/tmp/sundata2.txt

{
sed 's/$/:/' /tmp/sundata2.txt | tr -d '\n'
}>/tmp/sundata3.txt

cat /tmp/sundata3.txt
Terminale

Codice: Seleziona tutto

deegan@lucid-lynx:~$ conky -c .conkyrc2
Conky: forked to background, pid is 10166
deegan@lucid-lynx:~$ 
Conky: desktop window (1e000c1) is subwindow of root window (a5)
Conky: window type - normal
Conky: drawing to created window (0x4a00001)
Conky: drawing to single buffer
Risultato  :o
http://upload.centerzone.it/viewer.php? ... 399131.png
Ultima modifica di deegan il martedì 10 agosto 2010, 14:13, modificato 1 volta in totale.
MB* ASUS TUF Gaming Z690 SV* EVGA RTX 3080 Ti CPU* i7-12700K
RAM* Vengeance RGB PRO 32GB 3600MHz SSD* Samsung 980 PRO 2TB
Avatar utente
beck_s
Prode Principiante
Messaggi: 214
Iscrizione: domenica 29 novembre 2009, 9:06
Località: Vicenza

Re: Posta il tuo .conkyrc & png

Messaggio da beck_s »

A me funzia però ho dovuto modificare il conkyrc inoltre avevi commentato la riga con la quale disegnava la grafica. (non so se servisse comunque ho dato un chmod a+x sundata.sh
Prova con questo conkyrc

Codice: Seleziona tutto

# Conky sample configuration
#
# the list of variables has been removed from this file in favour
# of keeping the documentation more maintainable.
# Check http://conky.sf.net for an up-to-date-list.

#Background
background no

#font 9x15
#font *mintsmild.se*
font Santana:size=12

# Use Xft?
use_xft yes

# Xft font when Xft is enabled
xftfont Santana:size=12

# Text alpha when using Xft
xftalpha 0.8

# Print everything to stdout?
# out_to_console no

# MPD host/port
# mpd_host localhost
# mpd_port 6600
# mpd_password tinker_bell

# Print everything to console?
# out_to_console no

# mail spool
mail_spool $MAIL

# Update interval in seconds
update_interval 1.0

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window yes

# If own_window is yes, you may use type normal, desktop or override
own_window_type override

# Use pseudo transparency with own_window?
own_window_transparent yes

# If own_window_transparent is set to no, you can set the background colour here
#own_window_colour black

# If own_window is yes, these window manager hints may be used
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager,below

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum and Maximun size of text area
minimum_size 350 250 
maximum_width 350 250

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Draw borders around graphs
draw_graph_borders no

# Stippled borders?
#stippled_borders 8

# border margins
#border_margin 3

# border width
#border_width 2

# Default colors and also border colors
default_color 000000
default_shade_color black
default_outline_color black

# Text alignment, other possible values are commented
alignment top_left
#alignment top_right
#alignment bottom_left
#alignment bottom_right
#alignment none

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 0
gap_y 30

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer left

# Allow each port monitor to track at most this many connections (if 0 or not set, default is 256)
#max_port_monitor_connections 256

# Maximum number of special things, e.g. fonts, offsets, aligns, etc.
#max_specials 512

# Maximum size of buffer for user text, i.e. below TEXT line.
#max_user_text 16384

# variable is given either in format $variable or in ${variable}. Latter
# allows characters right after the variable and must be used in network
# stuff because of an argument
# Draw borders around graphs
draw_graph_borders no

lua_load /home/deegan/Scrivania/sun.lua
lua_draw_hook_pre draw_newconky
TEXT
deegan
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2639
Iscrizione: lunedì 28 aprile 2008, 12:42
Distribuzione: Ubuntu 20.04
Sesso: Maschile
Località: Varese

Re: Posta il tuo .conkyrc & png

Messaggio da deegan »

In qualche maniera è apparso, ma non mi visualizza l'immagine della luna... (nono)

Sapete mica se è possibile avere sul conky, una immagine animata, che mostri le precipitazioni che ci sono in tempo reale nella mia zona?  ;)

Una cosa del genere...

Radar Nord Ovest Italia
Ultima modifica di deegan il martedì 10 agosto 2010, 18:03, modificato 1 volta in totale.
MB* ASUS TUF Gaming Z690 SV* EVGA RTX 3080 Ti CPU* i7-12700K
RAM* Vengeance RGB PRO 32GB 3600MHz SSD* Samsung 980 PRO 2TB
Avatar utente
SuNjACk
Entusiasta Emergente
Entusiasta Emergente
Messaggi: 1061
Iscrizione: martedì 19 maggio 2009, 16:27
Località: Pesaro

Re: Posta il tuo .conkyrc & png

Messaggio da SuNjACk »

che cacchio ci fai con un radar?  ;D
Desktop openbox Halloween Documents Linux non è Windows
Free Software Is A Matter Of Liberty Not Price
deegan
Imperturbabile Insigne
Imperturbabile Insigne
Messaggi: 2639
Iscrizione: lunedì 28 aprile 2008, 12:42
Distribuzione: Ubuntu 20.04
Sesso: Maschile
Località: Varese

Re: Posta il tuo .conkyrc & png

Messaggio da deegan »

SuNjACk ha scritto: che cacchio ci fai con un radar?  ;D

8) 8) 8)
MB* ASUS TUF Gaming Z690 SV* EVGA RTX 3080 Ti CPU* i7-12700K
RAM* Vengeance RGB PRO 32GB 3600MHz SSD* Samsung 980 PRO 2TB
Avatar utente
beck_s
Prode Principiante
Messaggi: 214
Iscrizione: domenica 29 novembre 2009, 9:06
Località: Vicenza

Re: Posta il tuo .conkyrc & png

Messaggio da beck_s »

deegan ha scritto: In qualche maniera è apparso, ma non mi visualizza l'immagine della luna... (nono)
In teoria dovrebbe essere della Terra non della Luna e comunque la devi piazzare te l'immagine in conky con ${image ...}, credo tu possa ottenerne una decente con xplanet ma non mi ricordo più come funziona dovresti dare un'occhiata sul web
Chiusa

Ritorna a “Bar Ubuntu”

Chi c’è in linea

Visualizzano questa sezione: nicolas e 11 ospiti