Python Guru's ::: I need you :::

Hi So I am trying to bring in the data from this website into touch :

trillionthtonne.org/ >> attached is the source index.

All help welcome. Thanks in advance.

much love.
Tonne source code.pdf (76.8 KB)

Is this a duplicate of your other post in which elburz offered to help you?
[url]Anyone want a quick job? needed ASAP - General TouchDesigner Discussion - TouchDesigner forum

import time

time0 = 1262304000000;
time1 = 1325376000000;

current_unixtime_ms = time.time()
combined_emissions_to_time1 = 555401776700
rate_of_2012_emissions = 0.328755651
total = int(((current_unixtime_ms - time1) * rate_of_2012_emissions) + combined_emissions_to_time1);

It isn’t pulling data from anywhere, it’s just doing some calculations.

Hi Thanks - elburz offered a cool app that skins websites - But I need to have this running without wifi. So i still need to have this data running in Touchdesigner. :stuck_out_tongue:

How would I print the total continuously?

You could put it in an execute dat and have it evaluate every frame.

Then you could add something like this to print out the value into a dat:

op(‘name_of_table_comp’)[0,0] = total

or if you were to just put it in a text top you could say:

op(‘text1’).par.text = total

FYI you’ll probably need to remove those semicolons in the code above.

[code]def frameStart(frame):

#equation stuff
time0 = 1262304000000
time1 = 1325376000000

current_unixtime_ms = time.time()
combined_emissions_to_time1 = 555401776700
rate_of_2012_emissions = 0.328755651
total = int(((current_unixtime_ms - time1) * rate_of_2012_emissions) + combined_emissions_to_time1)

#do some sort of datetime shit ( this is definitely wrong )
s = total / 1000.0
some_time = datetime.datetime.fromtimestamp(s).strftime('%Y-%m-%d %H:%M:%S.%f')

#write to table
op('table1')[0,0] = some_time
return

[/code]

Thanks Matt! I was using a dat execute instead of just execute // bah

That’s where Frame Start is ~ duh < thanks so much.

Still - I need all the info from this site in touch or openframeworks working.
1973-10-22 11:44:56.587999 << wow that’s a crazy date - hmmm
I love figuring out all these puzzles - for sure. Just don’t have the (know/how) to pull it without going deep into a dark hole.

Really appreciate you helping me get to a new level tho - :wink:

Keep me posted if you know of anyone that is able to hook me up with transferring all the data from the website ( I need the tons too and temp) and be able to have it run properly.
or if anyone is reading this and is able to ~ email me catparkmor@gmail.com

Right now I am just faking it the best i can while the rest gets sorted.

Excited to play with that and see if I will be able match the website data. :smiley:

As far as I can tell, this site does not appear to “host” any data. It’s just using some javascript with hard-coded values to generate the data.

Yeah - That’s what I need help with.