Commit e3885ac2 authored by Koen Martens's avatar Koen Martens

Add 3rdlifegrid.

parent 6a93232f
import requests
from lib.event import Event
from fetcher.icalfetcher import IcalFetcher
import icalendar
from lib.category import Category
from fetcher.icalfetcher import IcalFetcher
from helper.thirdlife import ThirdLifeHelper
from datetime import timedelta
class ThirdLifeFetcher(IcalFetcher):
def __init__(self, eventlist, webcache=None):
super(ThirdLifeFetcher,self).__init__(
"http://www.brownbearsw.com/cal/3rdLifeCalendar?Op=iCalSubscribe",
[ Category("grid-thirdlife") ],
eventlist,
webcache,
ThirdLifeHelper()
)
self.webcache = webcache
self.minexpiry = 3000
self.maxexpiry = 5000
if __name__=='__main__':
from lib.webcache import WebCache
from lib.eventlist import EventList
eventlist = EventList()
cache = WebCache('data/test_thirdlifefetcher.pck')
f = ThirdLifeFetcher(eventlist, cache)
f.fetch()
cache.flush()
for ev in eventlist:
print str(ev)
import re
import pickle
from datetime import timedelta
from helper import Helper
class ThirdLifeHelper(Helper):
hgre = re.compile("^[^:]+:[0-9]+:[^:]+$")
def findRegion(self, data):
if data==None or data=='' or data=='-':
return '3rdlifegrid.com:8002:'
return None
def customizeEvent(self, event):
event = super(ThirdLifeHelper, self).customizeEvent(event)
hgurl = self.findRegion(event.hgurl)
if hgurl != None:
event.hgurl = hgurl
if event.hgurl is not None and self.hgre.search(event.hgurl) is None:
event.hgurl = None
return event
......@@ -130,6 +130,7 @@
case "narasnook": rv = "Nara's Nook"; break;
case "jog": rv = "Japan Open Grid"; break;
case "arcana": rv = "Arcana"; break;
case "thirdlife": rv = "3rdLifeGrid"; break;
default: rv = null; break;
}
return rv;
......
......@@ -13,6 +13,7 @@
<span id="headerHYP">HYP</span><span id="headerEvents">Events</span>
</div>
<div class="mainrow" id="news">
<div class="newsitem">2016-09-19: Added calendar from 3rdLifeGrid</div>
<div class="newsitem">2016-02-03: New calendar from the Arcana grid added</div>
<div class="newsitem">2015-12-19: Added calendar from Japan Open Grid</div>
<div class="newsitem">2015-12-17: Calendar from VHS (Volks Hoch Schule) added</div>
......@@ -91,6 +92,7 @@ If, for some reason, an ical feed or json provider is not an option (or there is
<h2>What grids are listed?</h2>
<p>The following calendars are imported:</p>
<ul>
<li><a href="http://3rdlifegrid.com/">3rdLifeGrid</a></li>
<li><a href="http://avatarfest.net/">AVATARfest</a></li>
<li><a href="http://www.craft-world.org/">Craft World</a></li>
<li><a href="http://exo-life.onl/">Exo-Life Virtual World</a></li>
......
......@@ -27,6 +27,7 @@ from lib.eventlist import EventList
# will be discarded
fetchers = [
# ("gridtalkfetcher", "GridTalkFetcher", 0),
("thirdlifefetcher", "ThirdLifeFetcher", 0),
("arcanafetcher", "ArcanaFetcher", 0),
("japanopenfetcher", "JapanOpenFetcher", 0),
("oscc15fetcher", "OSCC15Fetcher", 0),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment