Browse Source

Bricodash/Extra:Calendar

master
beadsland 6 months ago
parent
commit
6ff64f9512
5 changed files with 50 additions and 28 deletions
  1. 27
    0
      jobs/brico/events/extra.py
  2. 5
    2
      jobs/brico/events/holiday.py
  3. 0
    12
      jobs/cal/local.cal
  4. 15
    13
      requirements.in
  5. 3
    1
      requirements.txt

+ 27
- 0
jobs/brico/events/extra.py View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python3

import re
import json
from urllib.parse import urlencode
from urllib.request import urlopen
import wikitextparser

import brico.common

API_URL = "https://wiki.hackmanhattan.com/api.php"

def main():
cal = []
for l in parse("Bricodash/Extra:Calendar").lists():
for i in l.items:
cal.append(i.lstrip())

brico.common.write_text("extra.cal", cal)

def parse(title):
data = {"action": "query", "prop": "revisions", "rvlimit": 1,
"rvprop": "content", "format": "json", "titles": title}
raw = urlopen(API_URL, urlencode(data).encode()).read()
res = json.loads(raw)
text = list(res["query"]["pages"].values())[0]["revisions"][0]["*"]
return wikitextparser.parse(text)

+ 5
- 2
jobs/brico/events/holiday.py View File

@@ -27,18 +27,21 @@ import brico.common
import brico.common.html as html

import brico.events.birth
import brico.events.extra

def main():
brico.events.birth.main()
brico.events.extra.main()

geek = "cal/geek.cal"
birth = "../html/pull/birth.cal"
usnat = "cal/usnat.cal"
local = "cal/local.cal"
extra = "../html/pull//extra.cal"
trivia = "cal/trivia.cal"

arr = sorted( parse_cal(trivia, 0) \
+ parse_cal(birth, 2) + parse_cal(geek, 7) \
arr = sorted( parse_cal(trivia, 0) + parse_cal(birth, 2) \
+ parse_cal(geek, 4) + parse_cal(extra, 7) \
+ parse_cal(usnat, 14) + parse_cal(local) )
arr = ( { 'start': t[0].decode('utf-8'),
'venue': "Holiday",

+ 0
- 12
jobs/cal/local.cal View File

@@ -24,15 +24,3 @@ Oct 27 :: Hack Manhattan Incorporated (2011) :: img/hm.png
2nd Sun in Jun :: Flag Day :: 🗽
3rd Mon in Feb :: Washington's Birthday (observed) :: 🗽
17 Mar :: St. Patrick's Day :: ☘️

#
# Miscellaneous -- to move to wiki
#
Apr 7 at 1 pm :: Just for Fun / February Crafts Day (Penn South) :: 🎨

#Oct 4 :: First Day of NY Comic Con <img class="logo" src="img/flickr_nalends_super_pop.png"> / Anime Expo (Javits Center)
#Oct 7 :: Last Day of NY Comic Con <img class="logo" src="img/flickr_nalends_super_pop.png"> / Anime Expo (Javits Center)

#Oct 7 :: Doctor Who Series 11 Premier :: img/tardis.png

#Oct 5 at 8 am :: PyGotham (Pennsylvania Hotel)

+ 15
- 13
requirements.in View File

@@ -1,32 +1,34 @@
pipreqs>=0.4.9

dateparser>=0.7.0
python_resize_image>=1.1.12

LunarCalendar>=0.0.9

emoji_data_python>=1.1.0

requests>=2.18.4

astral>=1.7.1

daemonize>=2.4.7

eventbrite>=3.3.3

humanize>=0.5.1
icalevents>=0.1.13

PyChromecast>=2.3.0
wikitextparser>=0.23.0

LunarCalendar>=0.0.9
PyChromecast>=2.3.0

convertdate>=2.1.3

python_resize_image>=1.1.12

icalevents>=0.1.13

daemonize>=2.4.7
humanize>=0.5.1

pip_tools>=3.0.0

emoji_data_python>=1.1.0
ummalqura>=2.0.1

requests>=2.18.4
dateparser>=0.7.0

cssutils>=1.0.2

ummalqura>=2.0.1


+ 3
- 1
requirements.txt View File

@@ -34,12 +34,14 @@ pychromecast==2.3.0
python-dateutil==2.7.3 # via dateparser, icalendar, lunarcalendar
python-resize-image==1.1.12
pytz==2018.5 # via astral, convertdate, dateparser, datetime, icalendar, icalevents, lunarcalendar, tzlocal
regex==2018.8.29 # via dateparser
regex==2018.8.29 # via dateparser, wikitextparser
requests==2.19.1
six==1.11.0 # via pip-tools, protobuf, python-dateutil
tzlocal==1.5.1 # via dateparser
ummalqura==2.0.1
urllib3==1.23 # via requests
wcwidth==0.1.7 # via wikitextparser
wikitextparser==0.23.0
yarg==0.1.9 # via pipreqs
zeroconf==0.21.3 # via pychromecast
zope.interface==4.6.0 # via datetime

Loading…
Cancel
Save