From f65c8ab950a31427d29c75cc772db675d767db15 Mon Sep 17 00:00:00 2001 From: gempir Date: Wed, 8 Mar 2017 22:16:37 +0100 Subject: [PATCH] added readme and travis --- .travis.yml | 11 +++++++++++ README.MD | 5 +++++ archive.py | 22 ++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 .travis.yml create mode 100644 README.MD create mode 100644 archive.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ba89bd6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: go +go: + - 1.5.3 + - 1.6.3 + - 1.7.1 + +script: + - curl https://glide.sh/get | sh + - glide install + - make + - make test \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..eb2cffe --- /dev/null +++ b/README.MD @@ -0,0 +1,5 @@ +# gempbotgo [![Build Status](https://travis-ci.org/gempir/gempbotgo.svg?branch=master)](https://travis-ci.org/gempir/gempbotgo) + +#### What is this? +gempbot is a bot i maintain for a couple of channels. It's features differ from other bots in that it doesn't support +commands etc. yet, it focuses on logging and providing an api for the logs. \ No newline at end of file diff --git a/archive.py b/archive.py new file mode 100644 index 0000000..79f6da3 --- /dev/null +++ b/archive.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import datetime +import gzip +import os +import re +import shutil + +mydate = datetime.datetime.now() +month = mydate.strftime('%B') +rootdir = '/var/twitch_logs' + +for subdir, dirs, files in os.walk(rootdir): + for file in files: + if re.search(month, subdir, re.IGNORECASE): + continue # current month should be ignored + log = os.path.join(subdir, file) + if re.search('.gz', file): + continue # already gzipped this + with open(log, 'rb') as f_in, gzip.open(log + '.gz', 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + os.remove(log) \ No newline at end of file