diff options
-rw-r--r-- | arafetch/ara2influx.py (renamed from ara2influx.py) | 0 | ||||
-rwxr-xr-x | arafetch/arafetch.py (renamed from day.py) | 0 | ||||
-rw-r--r-- | day.sh | 11 | ||||
-rw-r--r-- | default.nix | 18 | ||||
-rw-r--r-- | scripts/weekrun | 21 | ||||
-rw-r--r-- | setup.py | 28 | ||||
-rw-r--r-- | week.sh | 10 |
7 files changed, 67 insertions, 21 deletions
diff --git a/ara2influx.py b/arafetch/ara2influx.py index 26d7d0a..26d7d0a 100644 --- a/ara2influx.py +++ b/arafetch/ara2influx.py diff --git a/day.py b/arafetch/arafetch.py index 4364762..4364762 100755 --- a/day.py +++ b/arafetch/arafetch.py @@ -1,11 +0,0 @@ -#!/bin/sh -OUTDIR=${OUTDIR:-$PWD/db} -# old: thyssenkruppsystemengineering -# empty: metabo-nuertingen -mkdir -p $OUTDIR -for i in thales-deutschland ibm-boeblingen buerocampus-wangen continental-villingen vodafone-campus ;do - db=$OUTDIR/$i.json - python3 day.py --db $db --cantine $i - python3 ara2influx.py $db --cantine $i - # git add $db -done diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..556e658 --- /dev/null +++ b/default.nix @@ -0,0 +1,18 @@ +{ pkgs ? import <nixpkgs> {} }: +with pkgs.python3Packages; +let + inp = [ + python + requests + docopt + influxdb + beautifulsoup4 + pkgs.git + pkgs.wget + ]; +in buildPythonPackage { + name = "arafetch"; + src = ./.; + propagatedBuildInputs = inp; +} + diff --git a/scripts/weekrun b/scripts/weekrun new file mode 100644 index 0000000..316f3ce --- /dev/null +++ b/scripts/weekrun @@ -0,0 +1,21 @@ +#!/bin/sh +# requires: wget git +set -euf +NOW=$(date -I) +OUTDIR=${OUTDIR:-$PWD} +DATADIR=${DATADIR:-$OUTDIR/db} +PDFDIR=${PDFDIR:-$OUTDIR/pdf} + +# old: thyssenkruppsystemengineering +# empty: metabo-nuertingen + +mkdir -p $DATADIR $PDFDIR +for i in thales-deutschland ibm-boeblingen buerocampus-wangen continental-villingen vodafone-campus ;do + db=$DATADIR/$i.json + arafetch --db $db --cantine $i + ara2influx $db --cantine $i + db=$PDFDIR/$i-$NOW.pdf + wget http://gast.aramark.de/$i/menu/pdf/woche_de.php -O $db + git add -A $DATADIR + git commit -m "update $NOW" +done diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0b6a0d4 --- /dev/null +++ b/setup.py @@ -0,0 +1,28 @@ +from setuptools import setup, find_packages +setup( + name='arafetch', + version='0.1', + description='fetch aramark data', + author='Felix Richter', + license='WTFPL', + author_email='github@syntax-fehler.de', + url='http://cgit.euer.krebsco.de/arafetch', + install_requires = [ + 'docopt', + 'requests', + 'beautifulsoup4', + 'influxdb' + ], + packages=find_packages(), + scripts = [ + "scripts/weekrun" + ], + entry_points = { + 'console_scripts': [ + 'arafetch=arafetch.arafetch:main', + 'ara2influx=arafetch.ara2influx:main' + ], + }, + + keywords=['api'], +) diff --git a/week.sh b/week.sh deleted file mode 100644 index f972e16..0000000 --- a/week.sh +++ /dev/null @@ -1,10 +0,0 @@ -NOW=$(date -I) -OUTDIR=${OUTDIR:-$PWD/pdf} -mkdir -p $OUTDIR -# Broken: -# vodafone-campus thyssenkruppsystemengineering -# Gone? metabo-nuertingen -for i in thales-deutschland ibm-boeblingen buerocampus-wangen continental-villingen ;do - db=$OUTDIR/$i-week.pdf - wget http://gast.aramark.de/$i/menu/pdf/woche_de.php -O $db -done |