wttr.in icon indicating copy to clipboard operation
wttr.in copied to clipboard

Add option for smaller output (for 80x24)

Open MightyPork opened this issue 6 years ago • 36 comments

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

MightyPork avatar Sep 30 '17 15:09 MightyPork

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

curl wttr.in/Prague?2n

chubin avatar Sep 30 '17 16:09 chubin

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

MightyPork avatar Sep 30 '17 16:09 MightyPork

Try this:

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

It exactly fits the screen (80x25)

chubin avatar Sep 30 '17 17:09 chubin

it's perfect ;)

MightyPork avatar Sep 30 '17 17:09 MightyPork

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

chubin avatar Sep 30 '17 18:09 chubin

@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.

aaferrari avatar Oct 04 '17 23:10 aaferrari

I know about less, but similar to grep, ultimately I can't use it, because the place I wanted to run this doesn't have any OS on it, just an equivalent of curl. If it could be an extra flag, that would be ideal - for now, if course, the solution is to do those text transforms in C before displaying it

On Oct 5, 2017 1:20 AM, "Agustin Ferrari" [email protected] wrote:

@chubin https://github.com/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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chubin/wttr.in/issues/151#issuecomment-334316903, or mute the thread https://github.com/notifications/unsubscribe-auth/AB8lHsti7oaIcvYA8x8jGDoqrYYt4k8sks5spBKmgaJpZM4PpmYM .

MightyPork avatar Oct 05 '17 06:10 MightyPork

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.

yne avatar Nov 15 '17 05:11 yne

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

curl wttr.in/?3n

Does it work for you?

chubin avatar Dec 03 '17 13:12 chubin

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

yne avatar Dec 03 '17 18:12 yne

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

chubin avatar Dec 03 '17 18:12 chubin

@chubin

Photo:

Screencap:

Sorry for derailing this thread

yne avatar Dec 04 '17 06:12 yne

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

chubin avatar Dec 04 '17 08:12 chubin

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

yne avatar Dec 04 '17 16:12 yne

@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)

chubin avatar Dec 04 '17 16:12 chubin

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 ?

yne avatar Dec 07 '17 16:12 yne

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.

MightyPork avatar Dec 07 '17 16:12 MightyPork

@MightyPork Thanks for clearing that up, and for your patience. I've opened an issue https://github.com/chubin/rate.sx/issues/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)

yne avatar Dec 07 '17 21:12 yne

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.

joelostblom avatar Mar 23 '18 13:03 joelostblom

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

pmgupte avatar May 13 '19 06:05 pmgupte

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.

kyprifog avatar Mar 16 '20 13:03 kyprifog

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

chubin avatar Mar 22 '20 12:03 chubin

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

kyprifog avatar Mar 22 '20 15:03 kyprifog

@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)

chubin avatar Mar 22 '20 15:03 chubin

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.

nickajeglin avatar May 24 '20 20:05 nickajeglin

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

chubin avatar May 25 '20 18:05 chubin

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)

nickajeglin avatar May 26 '20 05:05 nickajeglin

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

chubin avatar May 26 '20 07:05 chubin

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

nickajeglin avatar May 27 '20 01:05 nickajeglin

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

chubin avatar May 28 '20 13:05 chubin

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).

nick87720z avatar Oct 26 '20 12:10 nick87720z

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 avatar Nov 09 '20 17:11 chubin

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

chubin avatar Nov 09 '20 20:11 chubin

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.

ghost avatar Aug 31 '21 13:08 ghost

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月  ├───────────────────────┐
│              昼       └──────┬──────┘        夜             │

FrostKiwi avatar May 16 '22 04:05 FrostKiwi

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

chubin avatar Jun 06 '22 12:06 chubin