aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/svg
diff options
context:
space:
mode:
authorGravatar rmistry <rmistry@google.com>2016-08-10 07:00:43 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-10 07:00:43 -0700
commitd8a620b173113f73ec708bcd2f56d4c2b2bba60c (patch)
treea313b6c0f834260da3e96092f84b750e20e629b0 /tools/svg
parentd5b88a3dc500c16fc56d472acad01e78d56ef14a (diff)
SVG tool that downloads SVGs from a txt file into a specified dir
Diffstat (limited to 'tools/svg')
-rw-r--r--tools/svg/README.md19
-rw-r--r--tools/svg/svg_downloader.py41
-rw-r--r--tools/svg/svgs.txt69
3 files changed, 129 insertions, 0 deletions
diff --git a/tools/svg/README.md b/tools/svg/README.md
new file mode 100644
index 0000000000..501f3c6bc0
--- /dev/null
+++ b/tools/svg/README.md
@@ -0,0 +1,19 @@
+SVG Tools
+=========
+
+This directory contains the following-
+
+
+svgs.txt
+--------
+This text file contains an SVG URL per line.
+The SVGs in this file have been downloaded from the internal doc here:
+https://docs.google.com/document/d/1kYRvUxZTnm1tI_0bTU0BX9jqSSTqPUhGXJVcD3Rcg2c/edit
+
+
+svg_downloader.py
+-----------------
+This python script parses svgs.txt and downloads SVGs into a specified directory.
+
+The script can be run by hand:
+$ python svg_downloader.py --output_dir /tmp/svgs/
diff --git a/tools/svg/svg_downloader.py b/tools/svg/svg_downloader.py
new file mode 100644
index 0000000000..94a0b6fd0d
--- /dev/null
+++ b/tools/svg/svg_downloader.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# Copyright (c) 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Downloads SVGs into a specified directory."""
+
+
+import optparse
+import os
+import sys
+import urllib
+
+
+PARENT_DIR = os.path.dirname(os.path.realpath(__file__))
+
+
+def downloadSVGs(svgs_file, output_dir):
+ with open(svgs_file, 'r') as f:
+ for url in f.xreadlines():
+ svg_url = url.strip()
+ dest_file = os.path.join(output_dir, os.path.basename(svg_url))
+ print 'Downloading %s' % svg_url
+ urllib.urlretrieve(svg_url, dest_file)
+
+
+if '__main__' == __name__:
+ option_parser = optparse.OptionParser()
+ option_parser.add_option(
+ '-s', '--svgs_file',
+ help='Path to the text file containing SVGs. Each line should contain a '
+ 'single URL.',
+ default=os.path.join(PARENT_DIR, 'svgs.txt'))
+ option_parser.add_option(
+ '-o', '--output_dir',
+ help='The output dir where downloaded SVGs will be stored in.')
+ options, unused_args = option_parser.parse_args()
+
+ if not options.output_dir:
+ raise Exception('Must specify --output_dir')
+ sys.exit(downloadSVGs(options.svgs_file, options.output_dir))
diff --git a/tools/svg/svgs.txt b/tools/svg/svgs.txt
new file mode 100644
index 0000000000..b6375a38e4
--- /dev/null
+++ b/tools/svg/svgs.txt
@@ -0,0 +1,69 @@
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/AJ_Digital_Camera.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/acid.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/alphachannel.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/android.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/bozo.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/cartman.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/bzrfeed.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/car.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/compass.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/displayWebStats.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/eff.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/fsm.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/gallardo.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/rg1024_green_grapes.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/usaf.svg
+https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/yinyang.svg
+https://upload.wikimedia.org/wikipedia/commons/6/6d/Alabama-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/2/2b/Alaska-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/7/7e/Arizona-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/a/a4/Seal_of_Arkansas.svg
+https://upload.wikimedia.org/wikipedia/commons/0/0f/Seal_of_California.svg
+https://upload.wikimedia.org/wikipedia/commons/5/51/Colorado-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/e/e5/Connecticut-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/c/c0/Delaware-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/b/bf/Florida-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/e/e0/Georgia-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/c/c5/Hawaii-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/4/49/Idaho-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/e/e7/Seal_of_Illinois.svg
+https://upload.wikimedia.org/wikipedia/commons/c/c4/Indiana-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/5/5a/Iowa-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/4/45/Seal_of_Kansas.svg
+https://upload.wikimedia.org/wikipedia/commons/3/35/Seal_of_Kentucky.svg
+https://upload.wikimedia.org/wikipedia/commons/2/2f/Seal_of_Louisiana.svg
+https://upload.wikimedia.org/wikipedia/commons/a/a0/Maine-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/0/00/Seal_of_Maryland_%28reverse%29.svg
+https://upload.wikimedia.org/wikipedia/commons/8/82/Seal_of_Massachusetts.svg
+https://upload.wikimedia.org/wikipedia/commons/3/3f/Seal_of_Michigan.svg
+https://upload.wikimedia.org/wikipedia/commons/6/63/Minnesota-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/f/fe/Seal_of_Mississippi_2014.svg
+https://upload.wikimedia.org/wikipedia/commons/d/de/Seal_of_Missouri.svg
+https://upload.wikimedia.org/wikipedia/commons/e/ed/Montana-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/6/60/Nebraska-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/7/77/Nevada-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/a/aa/Seal_of_New_Hampshire.svg
+https://upload.wikimedia.org/wikipedia/commons/8/8d/Seal_of_New_Jersey.svg
+https://upload.wikimedia.org/wikipedia/commons/3/3b/NewMexico-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/c/ca/NewYork-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/7/72/Seal_of_North_Carolina.svg
+https://upload.wikimedia.org/wikipedia/commons/e/e7/NorthDakota-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/6/69/Seal_of_Ohio_%281967-1996%29.svg
+https://upload.wikimedia.org/wikipedia/commons/3/39/Seal_of_Oklahoma.svg
+https://upload.wikimedia.org/wikipedia/commons/c/c9/Oregon-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/e/e8/Pennsylvania_state_seal.svg
+https://upload.wikimedia.org/wikipedia/commons/7/73/RhodeIsland-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/8/80/Seal_of_South_Carolina.svg
+https://upload.wikimedia.org/wikipedia/commons/b/bb/SouthDakota-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/3/3c/Seal_of_Tennessee.svg
+https://upload.wikimedia.org/wikipedia/commons/c/cb/Seal_of_Texas.svg
+https://upload.wikimedia.org/wikipedia/commons/7/72/Seal_of_Utah_%28Alternate%29.svg
+https://upload.wikimedia.org/wikipedia/commons/5/5b/Vermont_state_seal.svg
+https://upload.wikimedia.org/wikipedia/commons/6/6f/Seal_of_Virginia.svg
+https://upload.wikimedia.org/wikipedia/commons/9/92/Washington-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/9/92/WestVirginia-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/b/b3/Wisconsin-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/c/c0/Wyoming-StateSeal.svg
+https://upload.wikimedia.org/wikipedia/commons/d/df/Seal_of_American_Samoa.svg
+https://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg
+https://upload.wikimedia.org/wikipedia/commons/6/6c/Trajans-Column-lower-animated.svg