]> git.parisson.com Git - tools.git/commitdiff
thumbs
authoryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Sat, 3 Nov 2007 18:00:45 +0000 (18:00 +0000)
committeryomguy <yomguy@457c0346-1240-4656-8a5a-9edca8063506>
Sat, 3 Nov 2007 18:00:45 +0000 (18:00 +0000)
git-svn-id: http://svn.parisson.org/svn/tools/trunk@5 457c0346-1240-4656-8a5a-9edca8063506

webthumb_list.py [new file with mode: 0755]

diff --git a/webthumb_list.py b/webthumb_list.py
new file mode 100755 (executable)
index 0000000..3cc63dc
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/python
+# Create thumbs of webpages from a list of URLs
+
+# depends : webthumb, imagemagick
+
+import os
+import sys
+
+img_dir = '/var/www/img/thumbs'
+site_list_file = '/var/www/img/thumbs/url_list.txt'
+
+def main(site_list_file, img_dir):
+    site_list = open(img_dir + os.sep + site_list_file,'r')
+    for site in site_list.readlines():
+        site = site[0:len(site)-1]
+        command = 'webthumb http://'+ site +' | pnmscale -xysize 650 400 | ' + \
+                  'pnmtopng | convert -crop 510x275+5+60 - ' + site +'.png'
+        print command
+        os.system(command)
+    site_list.close()
+    print 'Webthumbs created !'
+
+if __name__ == '__main__':
+    main(site_list_file, img_dir)
\ No newline at end of file