#!/bin/bash

# BASEDIR=/var/www/digisnaxx.com/
# DJANGODIR=/var/www/digisnaxx.com/ds_events
# EVENTDIR=/var/www/digisnaxx.com/ds_events/event_scrapers

BASEDIR=/home/canin/Downloads/DigiSnaxxEvents
DJANGODIR=/home/canin/Downloads/DigiSnaxxEvents/ds_events
EVENTDIR=/home/canin/Downloads/DigiSnaxxEvents/ds_events/event_scrapers
VENUESDIR=/home/canin/Downloads/DigiSnaxxEvents/ds_events/event_scrapers/Working/venues
ICALDIR=/home/canin/Downloads/DigiSnaxxEvents/ds_events/event_scrapers/Working/iCal
GOVTDIR=/home/canin/Downloads/DigiSnaxxEvents/ds_events/event_scrapers/Working/govt

export DJANGO_SUPERUSER_EMAIL=canin@dreamfreely.org
export DJANGO_SUPERUSER_USERNAME=canin
export DJANGO_SUPERUSER_PASSWORD='hello123'

cd $BASEDIR
pwd
source venv/bin/activate

cd $DJANGODIR
pwd
mv db.sqlite3 db.sqlite3.bak
# rm ../db.sqlite3
# touch db.sqlite3
python manage.py migrate
# python manage.py createsuperuser --noinput
# python manage.py loaddata events/fixtures/organizations.json
# python manage.py loaddata events/fixtures/promo.json

# cd $EVENTDIR
# python start_up.py

bash run_venues.sh $1
bash run_ical.sh 
bash run_govt.sh $1
bash run_news.sh $1

python Working/bluesky.py
python Working/redsky.py

cd $EVENTDIR
python clean_up.py

deactivate
bash run_media_update.sh

rm -rf ../*/__pycache__
rm -rf ../*/*/__pycache__