Last active
December 12, 2022 22:49
-
-
Save ProtoxiDe22/d0ae2a08bc32af7ff16d7a89b23e78df to your computer and use it in GitHub Desktop.
generate a Terraria timelapse with TerraMap from the history of .wld files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is how i would generate a timelapse, IF I HAD MY BACKUPS https://www.youtube.com/watch?v=_Tc0C3fhjt0 | |
from selenium import webdriver | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.common.by import By | |
import os; | |
# directory path with .wld files | |
folder = 'E:\\User\\Documents\\My Games\\Terraria\\Worlds' | |
files = [] | |
# loop through all the files in the folder | |
for filename in os.listdir(folder): | |
filepath = os.path.join(folder, filename) | |
files.append(filepath) | |
driver = webdriver.Chrome('./chromedriver.exe') | |
page = driver.get("https://terramap.github.io/") | |
for file in files: | |
upload = driver.find_element_by_id("file") | |
upload.send_keys(file) | |
status = driver.find_element_by_id("status") | |
WebDriverWait(driver, 120).until(EC.text_to_be_present_in_element((By.ID, "status"), "Done")) | |
save = driver.find_element_by_xpath("//button[@title='Save Map Image']") | |
save.click() | |
#then idk you have the download folder full of pngs, use ffmpeg, print all of them or idk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment