Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for smaller output (for 80x24) #151

Open
MightyPork opened this issue Sep 30, 2017 · 36 comments
Open

Add option for smaller output (for 80x24) #151

MightyPork opened this issue Sep 30, 2017 · 36 comments

Comments

@MightyPork
Copy link

It would be nice to have an option to get a more compact output (eg. with icon only for the current weather)

This is what it looks like on a 80x24 screen:

screenshot_20170930_175203

@chubin
Copy link
Owner

chubin commented Sep 30, 2017

Yes, you are right, but as a temporary workaround you can use ?2n:

curl wttr.in/Prague?2n

@MightyPork
Copy link
Author

good tip, that almost fits my screen (except the current weather icon and the last line). 1n wouldn't be much of a forecast, but fits well :)
screenshot_20170930_184047

@chubin
Copy link
Owner

chubin commented Sep 30, 2017

Try this:

curl -s wttr.in/Prague?2nQ | head -n -3 | grep -v ┼

It exactly fits the screen (80x25)

@MightyPork
Copy link
Author

it's perfect ;)

@chubin
Copy link
Owner

chubin commented Sep 30, 2017

I would say it is a perfect workaround, but what would be really perfect, if we could get 4x4 weather table that fits 80x25 screen and could be activated with a single option

@aaferrari
Copy link

@chubin, you may be interested in this:
curl wttr.in | less -S
This way the long lines are truncated and the text can be moved using the arrows keys.

@MightyPork
Copy link
Author

MightyPork commented Oct 5, 2017 via email

@yne
Copy link

yne commented Nov 15, 2017

I'm currently porting wttr.in to an embedded platform which have a 80*68 terminal but does no binutils.
Since it does not rely on Curl but on a custom HTTP client, It can provide a specific useragent if needed.
A custom GET param would also be fine by me.

@chubin
Copy link
Owner

chubin commented Dec 3, 2017

@yne Just specify curl as user-agent. Regarding 80x68 version, have you tried ?3n already?

curl wttr.in/?3n

Does it work for you?

@yne
Copy link

yne commented Dec 3, 2017

@chubin
Yeah, I found a way to tweak the font in order to get a narrow output (while keeping the Morning/Noon/Evening/Night).
vitasdk/samples#38
So now wttr.in work on the PSvita.

@chubin
Copy link
Owner

chubin commented Dec 3, 2017

@yne: That's really cool!!! Could you please a photo of it and post it here?

@yne
Copy link

yne commented Dec 4, 2017

@chubin

Photo:

Screencap:

Sorry for derailing this thread

@chubin
Copy link
Owner

chubin commented Dec 4, 2017

@yne Thank you very much! Overcast looks strange. Do you know why?

@yne
Copy link

yne commented Dec 4, 2017

no Idea, maybe one of the CSI code was misunderstood, I'll investigate later :)

@chubin
Copy link
Owner

chubin commented Dec 4, 2017

@yne Have you tried rate.sx by the way already? Maybe you don't need this info on PSvita, but it anyway cool (and I'm curious, if the sparks will be displayed correclty). (I noted that some unicode characters are displayed wrong on your shot)

@yne
Copy link

yne commented Dec 7, 2017

The PSVita does not have any "terminal emulator" (because it's a game console, and because debug are supposed to be send to the development host machine).
So in order to "printf" to the screen we have to do the pixel drawing ourselves.
And the font table used is only made of 256 characters:
out
So I do the unicode->256char_table conversion myself (this is why some cyrilic character cannot be printed)

About rate.sx:
It print a lots of 'q':
out
and curl | hd seems to show that this is related to a strange kind of escape

00000450  42 54 43 20 44 6f 6d 69  6e 61 6e 63 65 3a 20 36  |BTC Dominance: 6|
00000460  33 2e 37 25 20 1b 5b 32  6d 3d 1b 5b 30 6d 0a 1b  |3.7% .[2m=.[0m..|
00000470  28 30 1b 5b 32 6d 6c 71  71 71 71 71 71 77 71 71  |(0.[2mlqqqqqqwqq|

why didn't you reuse the same box drawing than wttr.in ?

@MightyPork
Copy link
Author

we're getting a bit derailed here, but I can help explain what's going on there.
rate.sx is using alternate character sets (which is a standard vt100 feature), looks like your terminal doesn't have support yet.

This page https://www.in-ulm.de/~mascheck/various/alternate_charset/ has some explanation, it's a little confusing.

ESC(0 switches to codepage 0, which is:

screenshot_20171207_173143

The normal codepage is "B".

Some more details - https://espterm.github.io/help.html - if you open the Alternate Character Sets section - note that pages 1, 2 and 3 listed there are not standard.

@yne
Copy link

yne commented Dec 7, 2017

@MightyPork Thanks for clearing that up, and for your patience.
I've opened an issue chubin/rate.sx#3 to ask for a unified unicode usage across all @chubin applications.
I'll continue the discussion about rate.cx+PSVita on this new Issue (since wttr.in now work)

@joelostblom
Copy link

I think a compact output option would be great! I am imagining something like this:

Weather report: Toronto, Canada

    \  /       Partly cloudy
  _ /"".-.     -4-2 °C        
    \_(   ).   ↓ 35 km/h      
    /(___(__)  24 km          
               0.0 mm         
Thu
Morning  -8  -4  Cloudy         
Noon     -4   0  Cloudy         
Evening  -3   1  Partly cloudy  
Night    -5  -1  Partly cloudy  

Fri
Morning  -6  -2  Cloudy         
Noon     -2   1  Partly cloudy  
Evening  -1   2  Partly cloudy  
Night    -5  -1  Partly cloudy  

Sat
Morning  -7  -3  Sunny  
Noon     -3   0  Sunny  
Evening  -1   2  Sunny  
Night    -5  -1  Clear 

Is this format similar to what you had in mind @MightyPork @chubin?

For now, I just use a short python script which creates this summary by reformatting stdout from wttr.in (without colors, ?T). It is not very flexible since it depends on the specific position of the lines, but it works for me at the moment, so I just wanted to include it in case someone find it helpful. Ideally it should be possible to choose which columns are displayed, and of course not just reformat stdout, but actually use the input data and present it in an alternative layout.

@pmgupte
Copy link

pmgupte commented May 13, 2019

Not sure if what @joelostblom asked for is being worked on/done. But I vote for that.

@kyprifog
Copy link

Third this, this is exactly what I was looking for. I used your script @joelostblom but had to sub out "-" for ".." which they apparent did at some point.

@chubin
Copy link
Owner

chubin commented Mar 22, 2020

@kyprifog At what place have you substituted - with ..? At the picture at the top?

@chubin chubin pinned this issue Mar 22, 2020
@kyprifog
Copy link

I was referring to the python parsing script. It was assuming dates ranges were with - but they were with ...

@chubin
Copy link
Owner

chubin commented Mar 22, 2020

@kyprifog Ah, ok; I think we shoult adopt the output format as the script, and make it available at t1.wttr.in (aka wttr.in/?format=t1)

@nickajeglin
Copy link

Just jumping in to say I also want this feature. I want to use wttr on small embedded displays that might only be 70x25 or something like that.

@chubin
Copy link
Owner

chubin commented May 25, 2020

@nickajeglin Sure! Have you seen v2.wttr.in by the way? What do you think about it?

@nickajeglin
Copy link

V2 is awesome! I am kind of obsessed with meteograms. I have a widget on my phone right now that grabs a custom image from NOAA every 4 hours. It's apparently a php backend and you can pull charts for lots of different weather variables and locations just by changing the arguments:

https://preview.tinyurl.com/ycbb94zv

(Sorry for the tinyurl, GitHub wouldn't let me link the original huge one)

@chubin
Copy link
Owner

chubin commented May 26, 2020

Wow, it is a cool meteogram; we need something like this in the console!

@nickajeglin
Copy link

Maybe I should open a separate issue for this request, but it goes sort of along with this. The "n" option outputs noon and night. Can we get a similar option to get any 3 divisions? I'm looking for the ability to select morning-noon-night or morning-noon-evening

@chubin
Copy link
Owner

chubin commented May 28, 2020

@nickajeglin It's a good idea, something like columns=mde (m for morning, d for day, e for evening)

@nick87720z
Copy link

nick87720z commented Oct 26, 2020

w3m could be workaround in terminal, since it can scroll contents. But it fails to show colors (despite receiving html) and png - only basic format and only mono. There could be URL options for expected window size.
Also some more ways to reduce size:

  • no vertical spliters - just 1..3 spaces between columns and up to 0 spaces between column and frame (edit again: could be separate options for vertical separators and spacing).
  • joined vertical box, with date headers placed at separators.
  • column names could be just bold, also with header separator removed.
    Btw... since I'm about style, how about rounded corners :) (sure if fonts have weather emoji, they would have these candy as well).

Edit: With options for output size some above options could be tuned dynamically (at least try to fit).

@chubin
Copy link
Owner

chubin commented Nov 9, 2020

actually, w3m works currently, but it can't handle ANSI, and uses HTML as input.

The real solution would be to pass the terminal width automatically to the server
(it is the $COLUMNS variable basically), but this feature needs support at the client side
(or should be passed explicitly). Anyway, it is not yet supported on the server side.

I think, we have a lot of different options and opinions, how exactly the narrow view should
look like, so the best way to go here would be probably to create a flexible post-processing
mechanism that could allow to select the view on the fly (similarly to that what we have,
for the major views selection: v1, v2, v3, and subviews v1t and v1d for the nerd fonts views).

@chubin
Copy link
Owner

chubin commented Nov 9, 2020

Related issues:
#65
#113
#192
#197
#297

@ghost
Copy link

ghost commented Aug 31, 2021

For the people who are too lazy to read the entire issue, you can do curl wttr.in/(location)?0n to get only the weather report for today. Adding 1 to the number right before n will add the next day to the weather report.

@FrostKiwi
Copy link

I would like to propose a slim-version. I really care about evening and morning, but it doesn't work on my portrait orientation monitor. It works with the option n, which limits to noon and night, but I think there is a middle ground: Just stack one day into two rows. And whilst we are it, make an ultra-slim version, which stacks all 4 into one column...

     \  /       所により曇り
   _ /"".-.     19 °C
     \_(   ).   → 4 km/h
     /(___(__)  10 km
                0.0 mm
                        ┌─────────────┐
┌───────────────────────┤  月 16 5月  ├───────────────────────┐
│              朝       └──────┬──────┘        昼             │
├──────────────────────────────┼──────────────────────────────┤
│    \  /       所により曇り   │    \  /       所により曇り   │
│  _ /"".-.     18 °C          │  _ /"".-.     19 °C          │
│    \_(   ).   → 4-5 km/h     │    \_(   ).   → 2 km/h       │
│    /(___(__)  10 km          │    /(___(__)  10 km          │
│               0.0 mm | 0%    │               0.0 mm | 0%    │
├──────────────────────────────┼──────────────────────────────┤
│              夕              │               夜             │
├──────────────────────────────┼──────────────────────────────┤
│    \  /       所により曇り   │  _`/"".-.     所により雨     │
│  _ /"".-.     17 °C          │   ,\_(   ).   13 °C          │
│    \_(   ).   → 2 km/h       │    /(___(__)  ↗ 4-8 km/h     │
│    /(___(__)  10 km          │      ‘ ‘ ‘ ‘  10 km          │
│               0.0 mm | 0%    │     ‘ ‘ ‘ ‘   0.1 mm | 73%   │
└──────────────────────────────┴──────────────────────────────┘
                        ┌─────────────┐
┌───────────────────────┤  火 17 5月  ├───────────────────────┐
│              昼       └──────┬──────┘        夜             │

@chubin
Copy link
Owner

chubin commented Jun 6, 2022

@FrostKiwi Wow! That's a good idea, accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants