diff --git a/scripts/image_scrape.py b/scripts/image_scrape.py deleted file mode 100644 index 1f3f1c3..0000000 --- a/scripts/image_scrape.py +++ /dev/null @@ -1,110 +0,0 @@ -import MySQLdb as mdb -import sys -import requests -import json -import urllib2 -import hashlib -#Connect to MySQL db, get list of image fields to scrape - -def mysql_connection(img_name, tag_raw, tag_name, checksum): - try: - conn = mdb.connect('www.idealcoder.co.uk', 'YRS-2013', 'hipercritical', 'yrs-2013', port = 1001,charset='utf8') - cur = conn.cursor() - cur.execute("INSERT INTO images (checksum, url) VALUES (%s, %s)", (checksum, img_name)) - conn.commit() - print "get last id" - print cur.lastrowid - print img_name - last_img_id2 = cur.lastrowid - except mdb.Error, e: - print "Error, I died... I know that's not very helpful but meh %d: %s" % (e.args[0], e.args[1]) - sys.exit(1) - finally: - if conn: - conn.close() - return last_img_id2 - -def insert_tags(tag_raw, tag_name, last_img_id): - print last_img_id - try: - conn = mdb.connect('www.idealcoder.co.uk', 'YRS-2013', 'hipercritical', 'yrs-2013', port=1001,charset='utf8') - cur = conn.cursor() - cur.execute("INSERT INTO imagetag (imageid, languageid, name) VALUES (%s, %s, %s)", (last_img_id, "1", tag_raw)) - print tag_raw - conn.commit() - except mdb.Error, e: - print "Error inserting tags... %d: %s" % (e.args[0], e.args[1]) - sys.exit(1) - finally: - if conn: - conn.close() - -#Connect to Flickr API, perform request -tag = ["laptop"] -tag_length = len(tag) -i = 0 -while i < tag_length: - if i == 0: - url_tag = tag[i] - else: - url_tag = url_tag + "," + tag[i] - i += 1 -url = "http://ycpi.api.flickr.com/services/rest/?method=flickr.photos.search&per_page=10&api_key=37cf642c93fc4bc58d8be3292db48442&format=json&tags=" + url_tag -r = requests.get(url) -txt = r.text -txt = txt[14:-1] -json_data = json.loads(txt) -json_data = json_data["photos"]["photo"] -print json_data -#Follow URL :-) -#Iterate thru all json_data to find id -json_length = len(json_data) -i = 0 -id_list = [] -farm_list = [] -server_id = [] -secret = [] -while i < json_length: - cur_id = json_data[i]["id"] - cur_farm = json_data[i]["farm"] - cur_server = json_data[i]["server"] - cur_secret = json_data[i]["secret"] - img_url = "http://farm" + str(cur_farm) + ".staticflickr.com/" + str(cur_server) + "/" + str(cur_id) + "_" + str(cur_secret) + "_n.jpg" - #Get tags! - tag_url = "https://secure.flickr.com/services/rest/?method=flickr.photos.getInfo&format=json&api_key=37cf642c93fc4bc58d8be3292db48442&photo_id=" + cur_id - g = requests.get(tag_url) - tag_txt = g.text - tag_txt = tag_txt[14:-1] - print tag_txt - print "\n" - json_tag_txt = json.loads(tag_txt) - a = 0 - a = int(a) - tag_raw = [] - tag_ids = [] - json_tag_txt = json_tag_txt["photo"]["tags"]["tag"] - tag_len = len(json_tag_txt) - q = 0 - img_name = tag[q] + str(i) + ".jpg" - img_location = "../static/img/tags" - img = urllib2.urlopen(img_url).read() - checksum = hashlib.md5(img) - checksum = checksum.hexdigest() - print checksum - with open(img_name, 'wb') as f: - f.write(img_location) - i += 1 - last_img_id = mysql_connection(img_name, tag_raw, tag_ids, checksum) - for tag_loop in json_tag_txt: - tag_id = tag_loop["id"] - tag_txt = tag_loop["raw"] - insert_tags(tag_txt, tag_id, last_img_id) - a += 1 - tag_raw.append(tag_txt) - tag_ids.append(tag_id) - -#Insert back into SQL db, the tag URL, the tags - both raw, id -#http://farm{farm-id}.staticflickr.com/{server-id}/{id}_{secret}.jpg -#Grab the image, based on the image ID - then grab the tags - -#Resize image \ No newline at end of file diff --git a/static/font/FontAwesome.otf b/static/font/FontAwesome.otf new file mode 100644 index 0000000..7012545 Binary files /dev/null and b/static/font/FontAwesome.otf differ diff --git a/static/font/fontawesome-webfont.eot b/static/font/fontawesome-webfont.eot new file mode 100644 index 0000000..0662cb9 Binary files /dev/null and b/static/font/fontawesome-webfont.eot differ diff --git a/static/font/fontawesome-webfont.svg b/static/font/fontawesome-webfont.svg new file mode 100644 index 0000000..2edb4ec --- /dev/null +++ b/static/font/fontawesome-webfont.svg @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/static/font/fontawesome-webfont.ttf b/static/font/fontawesome-webfont.ttf new file mode 100644 index 0000000..d365924 Binary files /dev/null and b/static/font/fontawesome-webfont.ttf differ diff --git a/static/font/fontawesome-webfont.woff b/static/font/fontawesome-webfont.woff new file mode 100644 index 0000000..b9bd17e Binary files /dev/null and b/static/font/fontawesome-webfont.woff differ diff --git a/static/img/tags/Apples.jpg b/static/img/tags/Apples.jpg deleted file mode 100644 index d144b28..0000000 Binary files a/static/img/tags/Apples.jpg and /dev/null differ diff --git a/static/img/tags/Red_Apple.jpg b/static/img/tags/Red_Apple.jpg deleted file mode 100644 index ddbde94..0000000 Binary files a/static/img/tags/Red_Apple.jpg and /dev/null differ diff --git a/static/img/tags/laptop0.jpg b/static/img/tags/laptop0.jpg deleted file mode 100644 index 6f11284..0000000 Binary files a/static/img/tags/laptop0.jpg and /dev/null differ diff --git a/static/img/tags/laptop1.jpg b/static/img/tags/laptop1.jpg deleted file mode 100644 index a33c5b7..0000000 Binary files a/static/img/tags/laptop1.jpg and /dev/null differ diff --git a/static/img/tags/laptop2.jpg b/static/img/tags/laptop2.jpg deleted file mode 100644 index 30f58fc..0000000 Binary files a/static/img/tags/laptop2.jpg and /dev/null differ diff --git a/static/img/tags/laptop3.jpg b/static/img/tags/laptop3.jpg deleted file mode 100644 index 54c167d..0000000 Binary files a/static/img/tags/laptop3.jpg and /dev/null differ diff --git a/static/img/tags/laptop4.jpg b/static/img/tags/laptop4.jpg deleted file mode 100644 index 174fac4..0000000 Binary files a/static/img/tags/laptop4.jpg and /dev/null differ diff --git a/static/img/tags/laptop5.jpg b/static/img/tags/laptop5.jpg deleted file mode 100644 index bdfbad4..0000000 Binary files a/static/img/tags/laptop5.jpg and /dev/null differ diff --git a/static/img/tags/laptop6.jpg b/static/img/tags/laptop6.jpg deleted file mode 100644 index bfc9873..0000000 Binary files a/static/img/tags/laptop6.jpg and /dev/null differ diff --git a/static/img/tags/laptop7.jpg b/static/img/tags/laptop7.jpg deleted file mode 100644 index c69775a..0000000 Binary files a/static/img/tags/laptop7.jpg and /dev/null differ diff --git a/static/img/tags/laptop8.jpg b/static/img/tags/laptop8.jpg deleted file mode 100644 index c6df496..0000000 Binary files a/static/img/tags/laptop8.jpg and /dev/null differ diff --git a/static/img/tags/laptop9.jpg b/static/img/tags/laptop9.jpg deleted file mode 100644 index 3e8aec1..0000000 Binary files a/static/img/tags/laptop9.jpg and /dev/null differ diff --git a/static/img/tags/orange_color.jpg b/static/img/tags/orange_color.jpg deleted file mode 100644 index 8142541..0000000 Binary files a/static/img/tags/orange_color.jpg and /dev/null differ diff --git a/static/img/tags/orange_fruit.jpg b/static/img/tags/orange_fruit.jpg deleted file mode 100644 index 8c99dab..0000000 Binary files a/static/img/tags/orange_fruit.jpg and /dev/null differ diff --git a/static/img/tags/orange_logo.jpg b/static/img/tags/orange_logo.jpg deleted file mode 100644 index 792c74a..0000000 Binary files a/static/img/tags/orange_logo.jpg and /dev/null differ