GitHub PullRequestReviewCommentEvent at 2014-08-22 12:28:50
Repository: kitsune
Actor: willkg
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/kitsune/pulls/comments/16594827","id":16594827,"diff_hunk":"@@ -0,0 +1,66 @@\n+#!/usr/bin/env python\n+# -*- coding: utf-8 -*-\n+\n+\"\"\"\n+Downloads image files for gallery images from the CDN.\n+\n+Run this script like `./manage.py runscript get_media`.\n+\"\"\"\n+\n+import sys\n+from datetime import datetime\n+\n+import urllib\n+\n+from kitsune.gallery.models import Image\n+\n+\n+BASE_URL = 'https://support.cdn.mozilla.net'\n+\n+\n+def run():\n+    images = list(Image.objects.all())\n+    progress = Progress(len(images))\n+    progress.draw()\n+\n+    for img in images:\n+        url = BASE_URL + img.file.url\n+        path = img.file.url[1:]  # Remove leading '/'\n+        try:\n+            urllib.urlretrieve(url, path)\n+        except urllib.ContentTooShortError:\n+            print \"Couldn't download\", path\n+        progress.tick()\n+    print '\\nDone'\n+\n+\n+class Progress():","path":"scripts/get_media.py","position":37,"original_position":37,"commit_id":"df84508ccca31be146b4399d19cdb5589a8eee7f","original_commit_id":"df84508ccca31be146b4399d19cdb5589a8eee7f","user":{"login":"willkg","id":820826,"avatar_url":"https://avatars.githubusercontent.com/u/820826?v=2","gravatar_id":"cc327cef30f763a450644d4b5df895c7","url":"https://api.github.com/users/willkg","html_url":"https://github.com/willkg","followers_url":"https://api.github.com/users/willkg/followers","following_url":"https://api.github.com/users/willkg/following{/other_user}","gists_url":"https://api.github.com/users/willkg/gists{/gist_id}","starred_url":"https://api.github.com/users/willkg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willkg/subscriptions","organizations_url":"https://api.github.com/users/willkg/orgs","repos_url":"https://api.github.com/users/willkg/repos","events_url":"https://api.github.com/users/willkg/events{/privacy}","received_events_url":"https://api.github.com/users/willkg/received_events","type":"User","site_admin":false},"body":"This is a pretty interesting class. I think I'd move it into `kitsune.sumo.utils` or whatever that module is because we could use this elsewhere. For example, it'd be nice to have a much much much much much much less verbose esreindex. I'd also change it to take the `milestone_stride` as an argument.\r\n\r\nPlus I'd probably switch it to use blessings so you can get awesome colors.\r\n\r\nAnd I'd rename it to `RickyIsIronMan`.","created_at":"2014-08-22T12:28:50Z","updated_at":"2014-08-22T12:28:50Z","html_url":"https://github.com/mozilla/kitsune/pull/2082#discussion_r16594827","pull_request_url":"https://api.github.com/repos/mozilla/kitsune/pulls/2082","_links":{"self":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/comments/16594827"},"html":{"href":"https://github.com/mozilla/kitsune/pull/2082#discussion_r16594827"},"pull_request":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/2082"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/kitsune/pulls/2082","id":20147446,"html_url":"https://github.com/mozilla/kitsune/pull/2082","diff_url":"https://github.com/mozilla/kitsune/pull/2082.diff","patch_url":"https://github.com/mozilla/kitsune/pull/2082.patch","issue_url":"https://api.github.com/repos/mozilla/kitsune/issues/2082","number":2082,"state":"open","locked":false,"title":"Gallery API","user":{"login":"mythmon","id":305049,"avatar_url":"https://avatars.githubusercontent.com/u/305049?v=2","gravatar_id":"c6b8139c802fb2123f01ad1ee173dbd4","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"body":"This new Gallery API is a pretty cool guy. It lets us query images based on width and height and it doesn't afraid of anything.\r\n\r\nA lot of things now might require/enjoy having all the images referenced in the DB to actually exist on the filesystem and be images that PIL/Pillow know how to handle. To that end, I added a script that downloads them and sticks them in the right place. It took about 30 minutes to run for me.\r\n\r\nIf your DB is slightly old, this might get some 404s, which I just replaced with copies of blank.png from our static files.\r\n\r\nr?","created_at":"2014-08-22T00:47:28Z","updated_at":"2014-08-22T12:28:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea0ab02753acec85a1803148ede19a5f20f5a9b8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/kitsune/pulls/2082/commits","review_comments_url":"https://api.github.com/repos/mozilla/kitsune/pulls/2082/comments","review_comment_url":"https://api.github.com/repos/mozilla/kitsune/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/kitsune/issues/2082/comments","statuses_url":"https://api.github.com/repos/mozilla/kitsune/statuses/df84508ccca31be146b4399d19cdb5589a8eee7f","head":{"label":"mythmon:gallery-api","ref":"gallery-api","sha":"df84508ccca31be146b4399d19cdb5589a8eee7f","user":{"login":"mythmon","id":305049,"avatar_url":"https://avatars.githubusercontent.com/u/305049?v=2","gravatar_id":"c6b8139c802fb2123f01ad1ee173dbd4","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"repo":{"id":4978152,"name":"kitsune","full_name":"mythmon/kitsune","owner":{"login":"mythmon","id":305049,"avatar_url":"https://avatars.githubusercontent.com/u/305049?v=2","gravatar_id":"c6b8139c802fb2123f01ad1ee173dbd4","url":"https://api.github.com/users/mythmon","html_url":"https://github.com/mythmon","followers_url":"https://api.github.com/users/mythmon/followers","following_url":"https://api.github.com/users/mythmon/following{/other_user}","gists_url":"https://api.github.com/users/mythmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mythmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mythmon/subscriptions","organizations_url":"https://api.github.com/users/mythmon/orgs","repos_url":"https://api.github.com/users/mythmon/repos","events_url":"https://api.github.com/users/mythmon/events{/privacy}","received_events_url":"https://api.github.com/users/mythmon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mythmon/kitsune","description":"Platform for Firefox Help","fork":true,"url":"https://api.github.com/repos/mythmon/kitsune","forks_url":"https://api.github.com/repos/mythmon/kitsune/forks","keys_url":"https://api.github.com/repos/mythmon/kitsune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mythmon/kitsune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mythmon/kitsune/teams","hooks_url":"https://api.github.com/repos/mythmon/kitsune/hooks","issue_events_url":"https://api.github.com/repos/mythmon/kitsune/issues/events{/number}","events_url":"https://api.github.com/repos/mythmon/kitsune/events","assignees_url":"https://api.github.com/repos/mythmon/kitsune/assignees{/user}","branches_url":"https://api.github.com/repos/mythmon/kitsune/branches{/branch}","tags_url":"https://api.github.com/repos/mythmon/kitsune/tags","blobs_url":"https://api.github.com/repos/mythmon/kitsune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mythmon/kitsune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mythmon/kitsune/git/refs{/sha}","trees_url":"https://api.github.com/repos/mythmon/kitsune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mythmon/kitsune/statuses/{sha}","languages_url":"https://api.github.com/repos/mythmon/kitsune/languages","stargazers_url":"https://api.github.com/repos/mythmon/kitsune/stargazers","contributors_url":"https://api.github.com/repos/mythmon/kitsune/contributors","subscribers_url":"https://api.github.com/repos/mythmon/kitsune/subscribers","subscription_url":"https://api.github.com/repos/mythmon/kitsune/subscription","commits_url":"https://api.github.com/repos/mythmon/kitsune/commits{/sha}","git_commits_url":"https://api.github.com/repos/mythmon/kitsune/git/commits{/sha}","comments_url":"https://api.github.com/repos/mythmon/kitsune/comments{/number}","issue_comment_url":"https://api.github.com/repos/mythmon/kitsune/issues/comments/{number}","contents_url":"https://api.github.com/repos/mythmon/kitsune/contents/{+path}","compare_url":"https://api.github.com/repos/mythmon/kitsune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mythmon/kitsune/merges","archive_url":"https://api.github.com/repos/mythmon/kitsune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mythmon/kitsune/downloads","issues_url":"https://api.github.com/repos/mythmon/kitsune/issues{/number}","pulls_url":"https://api.github.com/repos/mythmon/kitsune/pulls{/number}","milestones_url":"https://api.github.com/repos/mythmon/kitsune/milestones{/number}","notifications_url":"https://api.github.com/repos/mythmon/kitsune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mythmon/kitsune/labels{/name}","releases_url":"https://api.github.com/repos/mythmon/kitsune/releases{/id}","created_at":"2012-07-10T18:09:51Z","updated_at":"2014-06-20T18:11:34Z","pushed_at":"2014-08-22T00:42:11Z","git_url":"git://github.com/mythmon/kitsune.git","ssh_url":"git@github.com:mythmon/kitsune.git","clone_url":"https://github.com/mythmon/kitsune.git","svn_url":"https://github.com/mythmon/kitsune","homepage":"http://support.mozilla.com/","size":93147,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"1a839dd46d2110aa3e2575e76f9d1d915e590bf1","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=2","gravatar_id":"9ba739c8f3288e256b13553e4d257b5e","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":489645,"name":"kitsune","full_name":"mozilla/kitsune","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=2","gravatar_id":"9ba739c8f3288e256b13553e4d257b5e","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/kitsune","description":"Platform for Mozilla Support","fork":false,"url":"https://api.github.com/repos/mozilla/kitsune","forks_url":"https://api.github.com/repos/mozilla/kitsune/forks","keys_url":"https://api.github.com/repos/mozilla/kitsune/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/kitsune/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/kitsune/teams","hooks_url":"https://api.github.com/repos/mozilla/kitsune/hooks","issue_events_url":"https://api.github.com/repos/mozilla/kitsune/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/kitsune/events","assignees_url":"https://api.github.com/repos/mozilla/kitsune/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/kitsune/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/kitsune/tags","blobs_url":"https://api.github.com/repos/mozilla/kitsune/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/kitsune/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/kitsune/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/kitsune/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/kitsune/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/kitsune/languages","stargazers_url":"https://api.github.com/repos/mozilla/kitsune/stargazers","contributors_url":"https://api.github.com/repos/mozilla/kitsune/contributors","subscribers_url":"https://api.github.com/repos/mozilla/kitsune/subscribers","subscription_url":"https://api.github.com/repos/mozilla/kitsune/subscription","commits_url":"https://api.github.com/repos/mozilla/kitsune/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/kitsune/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/kitsune/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/kitsune/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/kitsune/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/kitsune/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/kitsune/merges","archive_url":"https://api.github.com/repos/mozilla/kitsune/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/kitsune/downloads","issues_url":"https://api.github.com/repos/mozilla/kitsune/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/kitsune/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/kitsune/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/kitsune/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/kitsune/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/kitsune/releases{/id}","created_at":"2010-01-26T18:53:57Z","updated_at":"2014-08-22T05:40:12Z","pushed_at":"2014-08-21T01:36:40Z","git_url":"git://github.com/mozilla/kitsune.git","ssh_url":"git@github.com:mozilla/kitsune.git","clone_url":"https://github.com/mozilla/kitsune.git","svn_url":"https://github.com/mozilla/kitsune","homepage":"http://support.mozilla.com/","size":155286,"stargazers_count":242,"watchers_count":242,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":false,"forks_count":215,"mirror_url":null,"open_issues_count":9,"forks":215,"open_issues":9,"watchers":242,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/2082"},"html":{"href":"https://github.com/mozilla/kitsune/pull/2082"},"issue":{"href":"https://api.github.com/repos/mozilla/kitsune/issues/2082"},"comments":{"href":"https://api.github.com/repos/mozilla/kitsune/issues/2082/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/2082/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/kitsune/pulls/2082/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/kitsune/statuses/df84508ccca31be146b4399d19cdb5589a8eee7f"}}}}