diff options
-rw-r--r-- | app/python/fetch_cals.py (renamed from bin/fetch_cals.py) | 0 | ||||
-rw-r--r-- | app/python/import_cals.py (renamed from bin/import_cals.py) | 10 | ||||
-rw-r--r-- | app/python/init_db.py (renamed from bin/init_db.py) | 0 | ||||
-rwxr-xr-x | bin/pyrun.sh | 2 | ||||
-rw-r--r-- | config/reddit-import.json | 2 |
5 files changed, 9 insertions, 5 deletions
diff --git a/bin/fetch_cals.py b/app/python/fetch_cals.py index 30e7abc..30e7abc 100644 --- a/bin/fetch_cals.py +++ b/app/python/fetch_cals.py diff --git a/bin/import_cals.py b/app/python/import_cals.py index 07b8967..a08bfb2 100644 --- a/bin/import_cals.py +++ b/app/python/import_cals.py @@ -10,10 +10,14 @@ from sqlalchemy import inspect from rcal.db import Session from rcal.model import Calendar, Category +BASEPATH = os.path.join( + os.environ['PYTHONPATH'], + '..', + '..') + CONFIG = json.load(open( os.path.join( - os.path.dirname(os.path.realpath(__file__)), - '..', + BASEPATH, 'config', 'reddit-import.json'), 'r')) @@ -21,7 +25,7 @@ CONFIG = json.load(open( def get_cal_list(): cache_path = os.path.join( - os.path.dirname(os.path.realpath(__file__)), + BASEPATH, CONFIG['cache']) if not os.path.exists(cache_path) or \ int(time.time()) - int(os.path.getmtime(cache_path)) > \ diff --git a/bin/init_db.py b/app/python/init_db.py index 7d48e80..7d48e80 100644 --- a/bin/init_db.py +++ b/app/python/init_db.py diff --git a/bin/pyrun.sh b/bin/pyrun.sh index 36a3339..69c63b0 100755 --- a/bin/pyrun.sh +++ b/bin/pyrun.sh @@ -3,4 +3,4 @@ DIR=$(dirname $0) SCRIPT=$(echo $1 | sed 's/\.py\$//') shift export PYTHONPATH=$DIR/../app/python/ -python $DIR/$SCRIPT.py $@ +python $PYTHONPATH/$SCRIPT.py $@ diff --git a/config/reddit-import.json b/config/reddit-import.json index 0016703..f15bd77 100644 --- a/config/reddit-import.json +++ b/config/reddit-import.json @@ -1,5 +1,5 @@ { - "cache": "../cache/list.md", + "cache": "cache/list.md", "cache_time": 86400, "reddit_url": "https://www.reddit.com/r/MotorsportsCalendar/wiki/index.json", "user_agent": "/u/emkael" |