Skip to content

Instantly share code, notes, and snippets.

@Chikowitz
Created December 19, 2017 06:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chikowitz/071d2da0be99528d93d77ee581e0f248 to your computer and use it in GitHub Desktop.
Save Chikowitz/071d2da0be99528d93d77ee581e0f248 to your computer and use it in GitHub Desktop.
import os
from shutil import copyfile
print('---begin of the script---')
demo_path = os.path.join(os.getenv('APPDATA'), "Teeworlds\\demos\\auto")
demo_dest_path = "D:\\Games\\teeworlds\\demos_check"
demos_already_in_dest_path = [file for file in os.listdir(demo_dest_path) if file.endswith(".demo")]
print 'from: ' + demo_path
print 'to: ' + demo_dest_path
demo_files = [file for file in os.listdir(demo_path) if file.endswith(".demo")]
for demo_file in demo_files:
if demo_file in demos_already_in_dest_path:
continue
demo_file_path = os.path.join(demo_path, demo_file)
with open(demo_file_path, "rb") as f:
f.seek(178)
byte = f.read(2).encode("hex")
markers_num = int('0x' + byte, 0)
if markers_num > 0:
print demo_file
copyfile(demo_file_path, os.path.join(demo_dest_path, demo_file))
print('---end of the script---')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment