Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/plugins/images.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2005-07-22 21:17:07 +0200
committerArthur de Jong <arthur@arthurdejong.org>2005-07-22 21:17:07 +0200
commitee99926f649f4e489919d601c2af4ac4ffb2d75d (patch)
treeacd278a2b41e68dc90990eb9f89db57f2e9e907d /plugins/images.py
parent9906836c76245e66ac410def106d5482a862877a (diff)
almost complete rewrite of crawling and site state code making children and parents link objects instead of URLs and giving link member variables better names, change plugins accordingly, make scheme handling more pluggable and only use one function call and have a better pluggable structure for content parsing (currently only html)
git-svn-id: http://arthurdejong.org/svn/webcheck/webcheck@66 86f53f14-5ff3-0310-afe5-9b438ce3f40c
Diffstat (limited to 'plugins/images.py')
-rw-r--r--plugins/images.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/images.py b/plugins/images.py
index 3e9166b..1d24b06 100644
--- a/plugins/images.py
+++ b/plugins/images.py
@@ -28,12 +28,18 @@ __description__ = 'This is the list of all images found linked on the ' \
'website.'
import plugins
+import re
def generate(fp,site):
"""Output a list of images to the given file descriptor."""
fp.write('<ol>\n')
- images=site.images.values()
- images.sort(lambda a, b: cmp(a.url, b.url))
- for image in images:
- fp.write(' <li>%s</li>\n' % plugins.make_link(image.url,image.url))
+ links=site.linkMap.values()
+ links.sort(lambda a, b: cmp(a.url, b.url))
+ # this finds all links with a reasonable content-type
+ matcher=re.compile("^image/.*$")
+ for link in links:
+ if link.ispage or (link.mimetype is None):
+ continue
+ if matcher.search(link.mimetype):
+ fp.write(' <li>%s</li>\n' % plugins.make_link(link.url,link.url))
fp.write('</ol>\n')