added readme and travis

This commit is contained in:
gempir 2017-03-08 22:16:37 +01:00
parent 9ff0195145
commit f65c8ab950
3 changed files with 38 additions and 0 deletions

11
.travis.yml Normal file
View file

@ -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

5
README.MD Normal file
View file

@ -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.

22
archive.py Normal file
View file

@ -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)