#!/usr/bin/python import os, glob try: import fcntl read_stdout = True except: read_stdout = False from logger import make_custom_logger from subprocess import call, Popen, PIPE from time import sleep import mutagen if __name__ == "__main__": LOGGER = make_custom_logger() search_dir = "./dubsteplight/" stream_url = "http://dubsteplight.moeradio.ru:23000/dubsteplight.ogg" forbidden_chars = ["/", "\\"] LOGGER.info("Starting stream %s parsing" % stream_url) ripper = Popen(["streamripper", stream_url], stdout=PIPE) if read_stdout: fcntl.fcntl(ripper.stdout.fileno(), fcntl.F_SETFL, os.O_NONBLOCK) newest = None converted = 0 try: while True:
#!/usr/bin/python import re import yaml from wikiapi import xmlrpc from utils import * from logger import make_custom_logger from jinja2 import Environment, PackageLoader def split_requirements(line): cols = re.split("</td><td[^>]*>", line) LOGGER.info("* %s" % cols[0]) return "%s</td><td>%s" % (cols[0], cols[1]) if __name__ == "__main__": LOGGER = make_custom_logger() config = get_config() env = Environment(loader=PackageLoader("weekly_report", "templates")) template = env.get_template("weekly_report.html") wn = int(today.strftime("%U")) LOGGER.info("Weekly %s Report" % wn) wiki_api = xmlrpc.api(config["wiki_xmlrpc"]) wiki_api.connect(config["wiki_login"], config["wiki_password"]) LOGGER.info("Retrieving scope information") page = wiki_api.get_page("DEC", config["scope_page"]) requirements = [split_requirements(match.group(1))
# Replaces inline csv data with updated def replace_table(text, table_title, chart): pattern = csv_pattern(table_title) found = pattern.search(text) if not found: return text s = "Category, Pool, Owner, Start, End\n" for t in sorted(chart.tasks): s += t.to_csv() + "\n" result = pattern.sub("%s%s%s" % (found.group(1), s, found.group(5)), text) return result if __name__ == "__main__": LOGGER = logger.make_custom_logger() config = get_config() wiki_api = xmlrpc.api(config["wiki_xmlrpc"]) wiki_api.connect(config["wiki_login"], config["wiki_password"]) page = wiki_api.get_page("CCCOE", "Resources Utilization") # Removing errors block page["content"] = re.sub(make_macro("warning"), "", page["content"]) errors = [] LOGGER.debug(page["content"]) try: cache_date = datetime.datetime.strptime(read_file("updated.txt"), "%x %X") except ValueError: