Last active
March 12, 2016 19:04
-
-
Save jeena/9d9b00581a8b064a6426 to your computer and use it in GitHub Desktop.
A script to copy the next random Call of Duty map into the c&p buffer.
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
#!/usr/bin/env python3 | |
# A script to copy the next random Call of Duty map into the c&p buffer. | |
import os | |
import random | |
def is_map(str): | |
return str.startswith("mp_") | |
CURSOR_UP_ONE = '\x1b[1A' | |
ERASE_LINE = '\x1b[2K' | |
usermaps_dir = os.environ['HOME'] + "/Library/Application Support/Call of Duty 4/usermaps/" | |
usermaps = list(filter(is_map, os.listdir(usermaps_dir))) | |
while len(usermaps) > 0: | |
l = len(usermaps) | |
usermap = random.choice(usermaps) | |
usermaps.remove(usermap) | |
input(l.__str__() + " maps left, next: " + usermap + " ") | |
print(CURSOR_UP_ONE + ERASE_LINE + CURSOR_UP_ONE) | |
os.system("echo 'map " + usermap + "' | pbcopy") | |
os.system("open -a /Applications/Call\ of\ Duty\ 4.app/Contents/Call\ of\ Duty\ 4\ Multiplayer.app") | |
print("All maps done.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment