summaryrefslogtreecommitdiffstats
path: root/parsers
diff options
context:
space:
mode:
authormartin speleo <martin.speleo@gmail.com>2009-07-04 17:19:30 +0100
committermartin speleo <martin.speleo@gmail.com>2009-07-04 17:19:30 +0100
commitaa26690e33c793520be2d6d84c445ced8aba2a45 (patch)
tree040e355d5bb3b252f02d1ff9927ce017bafd0c2a /parsers
parent09581829d141cb29f1b87473c2266562ae6f7679 (diff)
downloadtroggle-aa26690e33c793520be2d6d84c445ced8aba2a45.tar.gz
troggle-aa26690e33c793520be2d6d84c445ced8aba2a45.tar.bz2
troggle-aa26690e33c793520be2d6d84c445ced8aba2a45.zip
[svn] Pareser for cave descriptions
Diffstat (limited to 'parsers')
-rw-r--r--parsers/descriptions.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/parsers/descriptions.py b/parsers/descriptions.py
new file mode 100644
index 0000000..fe325e7
--- /dev/null
+++ b/parsers/descriptions.py
@@ -0,0 +1,38 @@
+from django.conf import settings
+import core.models as models
+import os
+from utils import html_to_wiki, get_html_body, get_html_title
+
+pages = [(["smkridge", "204", "ariston-rigging.html"], "ariston-rigging"),
+ (["smkridge", "204", "ariston.html"], "ariston"),
+ (["smkridge", "204", "bivvy.html"], "bivvy"),
+ (["smkridge", "204", "bridge.html"], "bridge"),
+ (["smkridge", "204", "entrance-rigging.html"], "entrance-rigging"),
+ (["smkridge", "204", "entrance.html"], "entrance"),
+ (["smkridge", "204", "midlevel.html"], "midlevel"),
+ (["smkridge", "204", "millennium.html"], "millennium"),
+ (["smkridge", "204", "nopain.html"], "nopain"),
+ (["smkridge", "204", "razordance.html"], "razordance"),
+ (["smkridge", "204", "rhino.html"], "rhino"),
+ (["smkridge", "204", "sbview.html"], "sbview"),
+ (["smkridge", "204", "subway.html"], "subway"),
+ (["smkridge", "204", "swings.html"], "swings"),
+ (["smkridge", "204", "treeumphant.html"], "treeumphant"),
+ (["smkridge", "204", "uworld.html"], "uworld"), ]
+
+
+def getDescriptions():
+ for filelocation, name in pages:
+ f = open(os.path.join(settings.EXPOWEB, *filelocation), "r")
+ html = f.read()
+
+ cd = models.CaveDescription(short_name = name,
+ long_name = unicode(get_html_title(html), "latin1"),
+ description = unicode(get_html_body(html), "latin1"))
+ cd.save()
+
+def parseDescriptions():
+ for cd in models.CaveDescription.objects.all():
+ cd.description = html_to_wiki(cd.description)
+
+ cd.save() \ No newline at end of file