-
7 votes
-
In Iceland, traditionally a land of cat lovers, bans and curfews are redefining the human relationship with domestic cats
7 votes -
Continued drop in EU’s greenhouse gas emissions confirms achievement of 2020 target
4 votes -
The Google engineer who thinks the company’s AI has come to life
17 votes -
Foone reverse engineering SkiFree, one function at a time
@foone: OKAY SKIFREEThis is a game originally from 1991, developed by Chris Pirih, and included on one of the Windows Entertainment Packs. There's a modern 32bit version by the original developer, on the official site:https://t.co/Yoj7PDmkcV pic.twitter.com/ETQa1wdqqR
8 votes -
What happened to giant hovercraft?
5 votes -
It’s Warren Buffett versus Google, Facebook in latest US wind-farm debate
6 votes -
Erling Haaland scored two goals and made another as Norway thumped neighbours Sweden 3-2 in their UEFA Nations League clash
4 votes -
Chasing the treasure fox
2 votes -
Elon Musk’s regulatory woes mount as US moves closer to recalling Tesla’s self-driving software
10 votes -
gron - Make JSON greppable
7 votes -
Sunsetting the Atom text editor
6 votes -
Python Loops for JSON
How the heck do these work? I've cobbled together the script below for my bot (using Limnoria) to return the F1 standings in a line. Right now it returns the first value perfectly, but I can't...
How the heck do these work? I've cobbled together the script below for my bot (using Limnoria) to return the F1 standings in a line. Right now it returns the first value perfectly, but I can't figure out the loop to get the other drivers at all.
The script
import supybot.utils as utils from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks import supybot.ircmsgs as ircmsgs import requests import os import collections import json try: from supybot.i18n import PluginInternationalization _ = PluginInternationalization("F1") except ImportError: _ = lambda x: x class F1(callbacks.Plugin): """Uses API to retrieve information""" threaded = True def f1(self, irc, msg, args): """ F1 Standings """ channel = msg.args[0] data = requests.get("https://ergast.com/api/f1/2022/driverStandings.json") data = json.loads(data.content)["MRData"]["StandingsTable"]["StandingsLists"][0]["DriverStandings"][0] name = data["Driver"]["code"] position = data["positionText"].zfill(2) points = data["points"] output = ", ".join(['\x0306\x02' + name + '\x0303' + " [" + position + ", "+ points + "]"]) irc.reply(output) result = wrap(f1) Class = F1The output should be
VER [1, 125], LEC [2, 116], PER [3, 110], RUS [4, 84], SAI [5, 83], HAM [6, 50], NOR [7, 48], BOT [8, 40], OCO [9, 30], MAG [10, 15], RIC [11, 11], TSU [12, 11], ALO [13, 10], GAS [14, 6], VET [15, 5], ALB [16, 3], STR [17, 2], ZHO [18, 1], MSC [19, 0], HUL [20, 0], LAT [21, 0]...but it only returns
VER [1, 125]I'm in that state where I can read the stuff, but when I put it together, it doesn't always work.
Final script
# this accepts @champ or @constructor with an optional year # and also @gp with an optional race number for the current season import supybot.utils as utils from supybot.commands import * import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.callbacks as callbacks import supybot.ircmsgs as ircmsgs import requests import os import collections import json try: from supybot.i18n import PluginInternationalization _ = PluginInternationalization("F1") except ImportError: _ = lambda x: x class F1(callbacks.Plugin): """Uses API to retrieve information""" threaded = True def champ(self, irc, msg, args, year): """<year> Call standings by year F1 Standings """ data = requests.get("https://ergast.com/api/f1/current/driverStandings.json") if year: data = requests.get( "https://ergast.com/api/f1/%s/driverStandings.json" % (year) ) driver_standings = json.loads(data.content)["MRData"]["StandingsTable"][ "StandingsLists" ][0]["DriverStandings"] string_segments = [] for driver in driver_standings: name = driver["Driver"]["code"] position = driver["positionText"] points = driver["points"] string_segments.append(f"\x035{name}\x0F {points}") irc.reply(", ".join(string_segments)) champ = wrap(champ, [optional("int")]) def gp(self, irc, msg, args, race): """<year> Call standings by year F1 Standings """ data = requests.get("https://ergast.com/api/f1/current/last/results.json") if race: data = requests.get( "https://ergast.com/api/f1/current/%s/results.json" % (race) ) driver_result = json.loads(data.content)["MRData"]["RaceTable"]["Races"][0][ "Results" ] string_segments = [] for driver in driver_result: name = driver["Driver"]["code"] position = driver["positionText"] points = driver["points"] string_segments.append(f"{position} \x035{name}\x0F {points}") irc.reply(", ".join(string_segments)) gp = wrap(gp, [optional("int")]) def constructor(self, irc, msg, args, year): """<year> Call standings by year F1 Standings """ data = requests.get( "https://ergast.com/api/f1/current/constructorStandings.json" ) if year: data = requests.get( "https://ergast.com/api/f1/current/constructorStandings.json" % (year) ) driver_result = json.loads(data.content)["MRData"]["StandingsTable"][ "StandingsLists" ][0]["ConstructorStandings"] string_segments = [] for driver in driver_result: name = driver["Constructor"]["name"] position = driver["positionText"] points = driver["points"] string_segments.append(f"{position} \x035{name}\x0F {points}") irc.reply(", ".join(string_segments)) constructor = wrap(constructor, [optional("int")]) Class = F13 votes -
Short-sightedness has become an epidemic
7 votes -
Finland and Russia share more than 800 miles of land border, plus the archipelago sea – a photo journey through the border zone
4 votes -
Trader Joe's workers in Massachusetts file to create chain's first union
16 votes -
We are (almost) halfway through the year. How is 2022 going for you?
I'd like to know how you're all doing. Did you have any goals for this year? Have you achieved any of them? Given up on any of them? What are the top 3 things that changed in your life so far this...
I'd like to know how you're all doing. Did you have any goals for this year? Have you achieved any of them? Given up on any of them? What are the top 3 things that changed in your life so far this year?
16 votes -
Tom Scott plus Alton Towers: Coasterphobia (Fear of rollercoasters)
5 votes -
Are rubber-tired trains a scam?
2 votes -
Do you think an ~engineering group would make sense?
I think it would, that's something that interests a vast number of users. Things like construction, bridges, buildings, city planning, trains, etc. Right now they can go to ~misc or ~design which...
I think it would, that's something that interests a vast number of users. Things like construction, bridges, buildings, city planning, trains, etc. Right now they can go to ~misc or ~design which doesn't seem appropriate.
5 votes -
Microsoft trying to kill HDD boot drives by 2023: Report
8 votes -
Magnus Carlsen wins fifth Norway Chess title – has now won half of the ten editions and the last four in a row
3 votes -
Judge blocks Texas investigating families of trans youth
18 votes -
‘The Boys’ renewed for season four at Amazon
8 votes -
Adolescents in the US are chronically sleep-deprived, in part because most schools start too early. This summer, California will become the first state in the nation to require later start times.
24 votes -
Canada and Denmark reach settlement over disputed Arctic island, sources say
5 votes -
How to turn your images into paint-by-number templates: The five best free sites
2 votes -
Justin Bieber explains rare virus that has paralyzed half of his face, causing tour postponement
7 votes -
Workers on The Simpsons, Rick and Morty, Family Guy, and American Dad vote to unionize
11 votes -
Oslo's vast National Museum opens with tapestry of 400 reindeer skulls – the ‘grey box’ has been eight years and £500m in the making
9 votes -
Racing an excavator to save this house’s wood from landfill
6 votes -
How DALL-E could power a creative revolution
8 votes -
What have you been listening to this week?
What have you been listening to this week? You don't need to do a 6000 word review if you don't want to, but please write something! If you've just picked up some music, please update on that as...
What have you been listening to this week? You don't need to do a 6000 word review if you don't want to, but please write something! If you've just picked up some music, please update on that as well, we'd love to see your hauls :)
Feel free to give recs or discuss anything about each others' listening habits.
You can make a chart if you use last.fm:
http://www.tapmusic.net/lastfm/
Remember that linking directly to your image will update with your future listening, make sure to reupload to somewhere like imgur if you'd like it to remain what you have at the time of posting.
2 votes -
Bob Chapek’s empire of insecurity
3 votes -
What did you do this week (and weekend)?
As part of a weekly series, these topics are a place for users to casually discuss the things they did — or didn't do — during their week. Did you accomplish any goals? Suffer a failure? Do...
As part of a weekly series, these topics are a place for users to casually discuss the things they did — or didn't do — during their week. Did you accomplish any goals? Suffer a failure? Do nothing at all? Tell us about it!
10 votes -
Snarky Puppy - Trinity (Extended Version) (2022)
9 votes -
Minitel: France’s alternate Internet that survived until 2012
13 votes -
Queer Games Bundle 2022
8 votes -
Microsoft to curb use of non-competes, drop NDAs from worker settlements, disclose salary ranges, launch civil rights audit
22 votes -
Making massive ‘Jurassic World: Dominion’ made Colin Trevorrow worried for the future of indies
4 votes -
Is searching for comments possible?
I never noticed this before today, but I don't seem to be able to search for comments. Is that supposed to be doable on Tildes? It took me way too long to figure out that the links at the top of...
I never noticed this before today, but I don't seem to be able to search for comments. Is that supposed to be doable on Tildes?
It took me way too long to figure out that the links at the top of the search results page are sort options; I had been clicking "Comments" hoping to see comment search results, and I was a bit confused why only full topics were still being listed. I guess comment search doesn't currently exist?
12 votes -
The Munsters | Teaser trailer
8 votes -
What creative projects have you been working on?
This topic is part of a series. It is meant to be a place for users to discuss creative projects they have been working on. Projects can be personal, professional, physical, digital, or even just...
This topic is part of a series. It is meant to be a place for users to discuss creative projects they have been working on.
Projects can be personal, professional, physical, digital, or even just ideas.
If you have any creative projects that you have been working on or want to eventually work on, this is a place for discussing those.
10 votes -
Fitness Weekly Discussion
What have you been doing lately for your own fitness? Try out any new programs or exercises? Have any questions for others about your training? Want to vent about poor behavior in the gym? Started...
What have you been doing lately for your own fitness? Try out any new programs or exercises? Have any questions for others about your training? Want to vent about poor behavior in the gym? Started a new diet or have a new recipe you want to share? Anything else health and wellness related?
8 votes -
Gori: Cuddly Carnage | Announcement trailer
4 votes -
Weekly megathread for news/updates/discussion of Russian invasion of Ukraine - June 9
This thread is posted weekly on Thursday - please try to post relevant content in here, such as news, updates, opinion articles, etc. Especially significant updates may warrant a separate topic,...
This thread is posted weekly on Thursday - please try to post relevant content in here, such as news, updates, opinion articles, etc. Especially significant updates may warrant a separate topic, but most should be posted here.
If you'd like to help support Ukraine, please visit the official site at https://help.gov.ua/ - an official portal for those who want to provide humanitarian or financial assistance to people of Ukraine, businesses or the government at the times of resistance against the Russian aggression.
10 votes -
Slow Social networking thread
Back in April we had this thread about Slow Social, a social media platform that only allows one long post per week. I've tried it out but friend discovery is woeful, so I think we could use a...
Back in April we had this thread about Slow Social, a social media platform that only allows one long post per week. I've tried it out but friend discovery is woeful, so I think we could use a thread to share usernames and do some networking. See if we can't get a few of us into using it. If you like the idea and haven't made an account yet, now's the time.
Post your Slow Social username below, and any specific topics you might be posting about.
11 votes -
Introducing Zed — A lightning-fast, collaborative code editor written in Rust
From Hacker News: Founder of Atom here. We're building the spiritual successor to Atom over at https://zed.dev. We learned a lot with Atom and had a great time, but it always fell short of our...
From Hacker News:
Founder of Atom here. We're building the spiritual successor to Atom over at https://zed.dev.
We learned a lot with Atom and had a great time, but it always fell short of our vision. With Zed we're going to get it right. Written in Rust, custom native UI framework, engineered to be collaborative. Just starting our private alpha this week, so the timing of this announcement feels quite fitting.
14 votes -
Anger and heartbreak on Bus No. 15
4 votes -
California imposes sweeping ban on pumping river water in San Joaquin Valley, Bay Area
11 votes