You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wubloader/delete_old_segments.py

126 lines
1.9 KiB
Python

import os
import shutil
import argh
RACERS = [
"abu__yazan",
"amellensatz",
"amitai_",
"ancalagor",
"arborelia",
"artq",
"asher__rose",
"autoclaves",
"azumak1",
"bgm_",
"biggiemac42",
"bookworm52",
"botwman",
"cavalca",
"cheekyhummus",
"chef_mayhem",
"crate3333",
"cryss__",
"cyber_1",
"definitely_not_him",
"dlkurosh_",
"echaen",
"eladdifficult",
"eleriz",
"evtet",
"faba_nocturne",
"flamehaze0",
"focusingface",
"g4mmadelta",
"gamingprosadventure",
"gekke__",
"gfitty",
"gleeokenspiel",
"hallowedcrow",
"hating_mirror",
"hummingbee__",
"itsmedash2",
"jackofgames",
"jo_jo909",
"jped",
"kailaria",
"kupioala",
"ladyljl",
"lakehope2",
"linforcer",
"macnd",
"mahpete_",
"minhs2",
"missmists",
"mizmy",
"monster_racer",
"nbtelethia",
"nd_tea",
"nomkey",
"notester_82",
"ocre307",
"pancelor",
"paratroopa1",
"parkerpng",
"pedrom664",
"pleasantbreeze",
"poanclr2",
"priw8",
"probablyathena",
"ptar124",
"ratracing",
"raviolinguini",
"ribbongraph",
"rivs218",
"rolamni",
"royalgoof",
"sailo93",
"sailormint",
"sanga_5_3",
"scc127",
"shandee_",
"shortcakesweets",
"sivcria",
"siveure",
"slimo",
"smokepipetwitch",
"speedfrog",
"speedgaming",
"speedgaming2",
"spootybiscuit",
"squega",
"squidy1226",
"studkid",
"supervillain_joe",
"szprychaaa",
"tang_pls",
"teki_b0t",
"tictacfoe",
"tr0gd0rburns",
"tufwfo",
"valkhiya",
"vhatenav",
"waskilledby",
"wooperpng",
"wow_tomato",
"yjalexis",
"yuka34",
"yuka_nd",
"zelllooo",
]
def main(keep_hour, base_dir='/srv/wubloader', dry_run=False):
for racer in RACERS:
hours_dir = os.path.join(base_dir, racer, "source")
for hour in os.listdir(hours_dir):
if hour < keep_hour:
hour_path = os.path.join(hours_dir, hour)
print "Deleting hour: {}".format(hour_path)
if not dry_run:
shutil.rmtree(hour_path)
if __name__ == '__main__':
argh.dispatch_command(main)