Created
December 19, 2017 06:21
-
-
Save Chikowitz/071d2da0be99528d93d77ee581e0f248 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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