first push
This commit is contained in:
33
scripts/clean_up.py
Normal file
33
scripts/clean_up.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import re, os, sys
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from django.db.models import Count
|
||||
|
||||
import django
|
||||
sys.path.append('../../../')
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'config.django.local'
|
||||
django.setup()
|
||||
|
||||
from events.models import Event, Organization
|
||||
|
||||
new_time = datetime.now() - timedelta(days=1)
|
||||
right_bound_time = datetime.now() + timedelta(days=45)
|
||||
events = Event.objects.filter(show_date__lte=new_time)
|
||||
events1 = Event.objects.filter(show_date__gte=right_bound_time)
|
||||
|
||||
for e in events:
|
||||
e.delete()
|
||||
|
||||
for e in events1:
|
||||
e.delete()
|
||||
|
||||
org_sin_events = Organization.objects.annotate(num_events = Count('event')).filter(num_events__lt=1)
|
||||
|
||||
for o in org_sin_events:
|
||||
print(o)
|
||||
|
||||
# for org in org_sin_events:
|
||||
# print(org)
|
||||
# org.delete()
|
||||
|
||||
print("completed and cleaned scrapes")
|
||||
17
scripts/run_govt.sh
Normal file
17
scripts/run_govt.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASEDIR=/var/www/digisnaxx.ado/api.digisnaxx
|
||||
EVENTSDIR=/var/www/digisnaxx.ado/api.digisnaxx/events
|
||||
SCRIPTDIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers/scripts
|
||||
GOVTDIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers/Working/govt
|
||||
|
||||
cd $GOVTDIR
|
||||
for file in *
|
||||
do
|
||||
python "$file" $1
|
||||
echo "SCRIPT COMPLETE"
|
||||
done
|
||||
|
||||
cd $SCRIPTDIR
|
||||
pwd
|
||||
python clean_up.py
|
||||
16
scripts/run_ical.sh
Normal file
16
scripts/run_ical.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASEDIR=/var/www/digisnaxx.ado/api.digisnaxx
|
||||
DJANGODIR=/var/www/digisnaxx.ado/api.digisnaxx/events
|
||||
SCRIPTDIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers/scripts
|
||||
ICALDIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers/Working/iCal
|
||||
|
||||
cd $ICALDIR
|
||||
for file in *
|
||||
do
|
||||
python "$file"
|
||||
echo "SCRIPT COMPLETE"
|
||||
done
|
||||
|
||||
cd $SCRIPTDIR
|
||||
python clean_up.py
|
||||
22
scripts/run_media_update.sh
Normal file
22
scripts/run_media_update.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
ENVDIR=/var/www/digisnaxx.ado/
|
||||
DJANGODIR=/var/www/digisnaxx.ado/api.digisnaxx/events
|
||||
EVENTDIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers
|
||||
WORKMEDIADIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers/Working/smedia
|
||||
|
||||
# ENVDIR=/home/canin/Downloads/DigiSnaxxEvents
|
||||
# DJANGODIR=/home/canin/Documents/repos/digisnaxx/events
|
||||
# WORKMEDIADIR=/home/canin/Documents/repos/digisnaxx/events/scrapers/Working/smedia
|
||||
|
||||
cd $ENVDIR
|
||||
pwd
|
||||
source venv/bin/activate
|
||||
|
||||
cd $WORKMEDIADIR
|
||||
|
||||
python bluesky.py
|
||||
python bluesky_media.py
|
||||
python redsky.py
|
||||
|
||||
deactivate
|
||||
16
scripts/run_news.sh
Normal file
16
scripts/run_news.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASEDIR=/var/www/digisnaxx.com/api.digisnaxx
|
||||
DJANGODIR=/var/www/digisnaxx.com/api.digisnaxx/events
|
||||
SCRIPTDIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers/scripts
|
||||
NEWSDIR=/var/www/digisnaxx.com/api.digisnaxx/events/scrapers/Working/news
|
||||
|
||||
cd $NEWSDIR
|
||||
for file in *
|
||||
do
|
||||
python "$file" $1
|
||||
echo "SCRIPT COMPLETE"
|
||||
done
|
||||
|
||||
cd $SCRIPTDIR
|
||||
python clean_up.py
|
||||
16
scripts/run_venues.sh
Normal file
16
scripts/run_venues.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASEDIR=/var/www/digisnaxx.ado/api.digisnaxx
|
||||
DJANGODIR=/var/www/digisnaxx.ado/api.digisnaxx/events
|
||||
SCRIPTDIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers/scripts
|
||||
VENUESDIR=/var/www/digisnaxx.ado/api.digisnaxx/events/scrapers/Working/venues
|
||||
|
||||
cd $VENUESDIR
|
||||
for file in *
|
||||
do
|
||||
python "$file" $1
|
||||
echo "SCRIPT COMPLETE"
|
||||
done
|
||||
|
||||
cd $SCRIPTDIR
|
||||
python clean_up.py
|
||||
29
scripts/start_up.py
Normal file
29
scripts/start_up.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import re, os, sys
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import django
|
||||
sys.path.append('../../../')
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'config.django.local'
|
||||
django.setup()
|
||||
|
||||
from events.models import Event,Organization, Promo, Calendar
|
||||
|
||||
# venue, created = Organization.objects.get_or_create(name="DreamFreely",
|
||||
# website="https://www.dreamfreely.org",
|
||||
# city="Minneapolis",
|
||||
# contact_name="Canin Carlos",
|
||||
# contact_email="canin@dreamfreely.org",
|
||||
# phone_number="6124054535")
|
||||
|
||||
# print("Created DreamFreely:", created, venue)
|
||||
|
||||
# calendar, created = Calendar.objects.get_or_create(name='Mpls-StP', shortcode='msp', desc='none')
|
||||
# calendar, created = Calendar.objects.get_or_create(name='Medellin', shortcode='mde', desc='none')
|
||||
# calendar, created = Calendar.objects.get_or_create(name='Online', shortcode='000', desc='none')
|
||||
|
||||
events = Event.objects.all()
|
||||
|
||||
for e in events:
|
||||
e.delete()
|
||||
|
||||
print("Events are cleared. Ready to scrape.")
|
||||
Reference in New Issue
Block a user