Skip to content

Commit

Permalink
Create execute_gif_sender.py
Browse files Browse the repository at this point in the history
  • Loading branch information
coltenthefirst authored Nov 27, 2024
1 parent 366abd2 commit 752de2c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions execute_gif_sender.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import os
import sys
import time

os.makedirs("/tmp/output", exist_ok=True)

uploaded_urls = sys.argv[1:]

if not uploaded_urls:
print("No uploaded URLs provided.")
sys.exit(1)

output_filename = "output_lua_urls"

max_retries = 5
retry_delay = 1
success = False

for attempt in range(max_retries):
try:
with open(f"{os.path.join('/tmp/output', output_filename)}.lua", 'w') as f:
for url in uploaded_urls:
f.write(url + "\n")
print("Processed uploaded URLs successfully.")
success = True
break
except Exception as e:
print(f"Error processing uploaded URLs: {e}")
if attempt < max_retries - 1:
print(f"Retrying in {retry_delay} seconds...")
time.sleep(retry_delay)
else:
print(f"Failed to process after {max_retries} attempts.")

if success:
print("All URLs processed successfully!")
subprocess.run(["python3", "generate_lua_file.py"])
else:
print("Some files could not be processed after multiple attempts.")
sys.exit(1)

0 comments on commit 752de2c

Please sign in to comment.