Skip to content

Commit

Permalink
Demo mover plugin (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
p-hennessy authored Feb 13, 2022
1 parent 3e028b9 commit 11b4092
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions demo_mover/demo_mover.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
from listeners.tick import GameThread
from listeners import OnLevelInit

# Core Imports
import os

# 3rd Party Imports
pass

TF_ROOT = "/home/tf/tf/"

@OnLevelInit
def on_level_init(name):
global TF_ROOT
for file_name in os.listdir(TF_ROOT):
if file_name.endswith(".dem"):
demo_info = file_name.split("-")
map_name = demo_info[3]

if not name == map_name:
src = os.path.join(TF_ROOT, file_name)
dest = os.path.join(TF_ROOT, "demos_finished", file_name)
print(f"Moving {src} to {dest}")

os.rename(src, dest)

0 comments on commit 11b4092

Please sign in to comment.