home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where author_association = "MEMBER", "created_at" is on date 2020-05-06 and "updated_at" is on date 2020-05-06 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: issue_url, updated_at (date)

issue 2

  • Ability to serve thumbnailed Apple Photo from its place on disk 3
  • apple-photos command should work even if upload has not run 1

user 1

  • simonw 4

author_association 1

  • MEMBER · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
624408738 https://github.com/dogsheep/dogsheep-photos/issues/20#issuecomment-624408738 https://api.github.com/repos/dogsheep/dogsheep-photos/issues/20 MDEyOklzc3VlQ29tbWVudDYyNDQwODczOA== simonw 9599 2020-05-06T02:21:05Z 2020-05-06T02:21:32Z MEMBER

Here's rendering code from my hacked-together not-yet-released S3 image proxy: ```python from starlette.responses import Response from PIL import Image, ExifTags import pyheif

for ORIENTATION_TAG in ExifTags.TAGS.keys(): if ExifTags.TAGS[ORIENTATION_TAG] == "Orientation": break ... # Load it into Pillow if ext == "heic": heic = pyheif.read_heif(image_response.content) image = Image.frombytes(mode=heic.mode, size=heic.size, data=heic.data) else: image = Image.open(io.BytesIO(image_response.content))

# Does EXIF tell us to rotate it?
try:
    exif = dict(image._getexif().items())
    if exif[ORIENTATION_TAG] == 3:
        image = image.rotate(180, expand=True)
    elif exif[ORIENTATION_TAG] == 6:
        image = image.rotate(270, expand=True)
    elif exif[ORIENTATION_TAG] == 8:
        image = image.rotate(90, expand=True)
except (AttributeError, KeyError, IndexError):
    pass

# Resize based on ?w= and ?h=, if set
width, height = image.size
w = request.query_params.get("w")
h = request.query_params.get("h")
if w is not None or h is not None:
    if h is None:
        # Set h based on w
        w = int(w)
        h = int((float(height) / width) * w)
    elif w is None:
        h = int(h)
        # Set w based on h
        w = int((float(width) / height) * h)
    w = int(w)
    h = int(h)
    image.thumbnail((w, h))

# ?bw= converts to black and white
if request.query_params.get("bw"):
    image = image.convert("L")

# ?q= sets the quality - defaults to 75
quality = 75
q = request.query_params.get("q")
if q and q.isdigit() and 1 <= int(q) <= 100:
    quality = int(q)

# Output as JPEG or PNG
output_image = io.BytesIO()
image_type = "JPEG"
kwargs = {"quality": quality}
if image.format == "PNG":
    image_type = "PNG"
    kwargs = {}

image.save(output_image, image_type, **kwargs)
return Response(
    output_image.getvalue(),
    media_type="image/jpeg",
    headers={"cache-control": "s-maxage={}, public".format(365 * 24 * 60 * 60)},
)

```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Ability to serve thumbnailed Apple Photo from its place on disk 613006393  
624408370 https://github.com/dogsheep/dogsheep-photos/issues/20#issuecomment-624408370 https://api.github.com/repos/dogsheep/dogsheep-photos/issues/20 MDEyOklzc3VlQ29tbWVudDYyNDQwODM3MA== simonw 9599 2020-05-06T02:19:27Z 2020-05-06T02:19:27Z MEMBER

The plugin can be generalized: it can be configured to know how to take the URL path, look it up in ANY table (via a custom SQL query) to get a path on disk and then serve that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Ability to serve thumbnailed Apple Photo from its place on disk 613006393  
624408220 https://github.com/dogsheep/dogsheep-photos/issues/20#issuecomment-624408220 https://api.github.com/repos/dogsheep/dogsheep-photos/issues/20 MDEyOklzc3VlQ29tbWVudDYyNDQwODIyMA== simonw 9599 2020-05-06T02:18:47Z 2020-05-06T02:18:47Z MEMBER

The apple_photos table has an indexed uuid column and a path column which stores the full path to that photo file on disk.

I can write a custom Datasette plugin which takes the uuid from the URL, looks up the path, then serves up a thumbnail of the jpeg or heic image file.

I'll prototype this is a one-off plugin first, then package it on PyPI for other people to install.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Ability to serve thumbnailed Apple Photo from its place on disk 613006393  
624406285 https://github.com/dogsheep/dogsheep-photos/issues/19#issuecomment-624406285 https://api.github.com/repos/dogsheep/dogsheep-photos/issues/19 MDEyOklzc3VlQ29tbWVudDYyNDQwNjI4NQ== simonw 9599 2020-05-06T02:10:03Z 2020-05-06T02:10:03Z MEMBER

Most annoying part of this is the difficulty of actually showing a photo.

Maybe I need to run a local proxy that I can link to? A custom Datasette plugin perhaps?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
apple-photos command should work even if upload has not run 613002220  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 662.553ms · About: github-to-sqlite