From 6471193e4c5e003dc18c07cea1def394ac7aec5c Mon Sep 17 00:00:00 2001 From: Xevion Date: Sun, 30 Jun 2019 14:05:22 -0500 Subject: [PATCH] migration from showsize tag to showfull tag for simpler use experience --- app/routes.py | 12 +++++------- app/templates/hidden.html | 14 +++++++------- app/templates/hidden_help.html | 25 +++++++++++++------------ app/templates/hidden_help.md | 23 ++++++++++++----------- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/app/routes.py b/app/routes.py index fa77117..2fe98f4 100644 --- a/app/routes.py +++ b/app/routes.py @@ -121,20 +121,18 @@ def hidden(id): return '\"count\" parameter must be Integer.
Invalid \"count\": \"{}\"'.format(request.args.get('count')) base64 = boolparse(request.args.get('base64')) # Handled within Jinja template - print(request.args.get('showsample')) - showsample = boolparse(request.args.get('showsample'), default=True) + showfull = boolparse(request.args.get('showfull')) showtags = boolparse(request.args.get('showtags')) # Request, Parse & Build Data - data = trap(tags, page, count, base64, showsample) - print(showsample) - return render_template('hidden.html', title='Gelbooru', data=data, base64=base64, showsample=showsample, showtags=showtags) + data = trap(tags, page, count, base64, showfull) + return render_template('hidden.html', title='Gelbooru', data=data, base64=base64, showfull=showfull, showtags=showtags) def base64ify(url): return base64.b64encode(requests.get(url).content).decode() gelbooru_url = "https://gelbooru.com/index.php?page=dapi&s=post&q=index&tags={}&pid={}&limit={}" -def trap(tags, page, count, base64, showsample): +def trap(tags, page, count, base64, showfull): # URL Building & Request temp = gelbooru_url.format(tags, page, count) response = requests.get(temp).text @@ -150,7 +148,7 @@ def trap(tags, page, count, base64, showsample): 'tags' : element['@tags'] } if base64: - if showsample: + if not showfull: temp['base64'] = base64ify(temp['sample_url']) else: temp['base64'] = base64ify(temp['real_url']) diff --git a/app/templates/hidden.html b/app/templates/hidden.html index 1615160..80b4a25 100644 --- a/app/templates/hidden.html +++ b/app/templates/hidden.html @@ -45,15 +45,15 @@
- +
- - + +
- +
@@ -85,10 +85,10 @@ {% if base64 %} {% else %} - {% if showsample %} - - {% else %} + {% if showfull %} {{ image.sample_url }} + {% else %} + {% endif %} {% endif %} diff --git a/app/templates/hidden_help.html b/app/templates/hidden_help.html index 1d7f14d..4bcafc2 100644 --- a/app/templates/hidden_help.html +++ b/app/templates/hidden_help.html @@ -330,7 +330,7 @@ It's maxmimum value is 1000.

The count parameter specifies how many images will load on the page at once.
It is recommended you do not exceed 100, as most images will not load past this.
-When base64 is enabled, count is automatically set back to 25 to stop server load, unless showsample is enabled, where it will be set to 50.

+When base64 is enabled, count is automatically set back to 50 to stop server load, unless showfull is enabled, where it will be set to 25.

Example
    @@ -348,33 +348,34 @@ will load 50 images using base64 encoding.


-

showsample parameter

+

showfull parameter

Type
-

The showsample parameter is a boolean.
+

The showfull parameter is a boolean.
As usual, it expects some form of True, False, 0, or 1.
The parameter is not case sensitive.
-showsample defaults to True if not specified.

+showfull defaults to False if not specified.

Description
-

The showsample parameter is very simple.
+

The showfull parameter is very simple.
+This requests that the page load with high quality images instead of the default thumbnail quality image.
The Gelbooru API provides multiple links for any given image, one of which is a link for the thumnbail.
The Gelbooru site staff prefer that sites like mine link to the thumbnail image, of which this parameter does. The thumnbail image is of significantly lower quality, but it lowers loading time for both you, as well as reduce load on the Gelbooru CDN. Out of respect for them, we ask that this parameter be kept on, as to view the full high quality version of the image, you need but click on the image itself.

Example
  • -

    /hidden?showsample=True
    -shows all images in thumbnail quality

    -
  • -
  • -

    /hidden?showsample=False
    +

    /hidden?showfull=True
    shows all images in high quality

  • -

    hidden/showsample=0&base64=True
    -shows all images in high quality using base64 encoding

    +

    /hidden?showfull=False
    +shows all images in thumbnail quality

    +
  • +
  • +

    hidden/showfull=0&base64=True
    +shows all images in thumnbnail quality using base64 encoding


diff --git a/app/templates/hidden_help.md b/app/templates/hidden_help.md index 0d0663f..3f01799 100644 --- a/app/templates/hidden_help.md +++ b/app/templates/hidden_help.md @@ -78,7 +78,7 @@ It's maxmimum value is `1000`. The `count` parameter specifies how many images will load on the page at once. It is recommended you do not exceed `100`, as most images will not load past this. -When `base64` is enabled, count is automatically set back to `25` to stop server load, unless `showsample` is enabled, where it will be set to `50`. +When `base64` is enabled, count is automatically set back to `50` to stop server load, unless `showfull` is enabled, where it will be set to `25`. ##### Example @@ -93,31 +93,32 @@ will load `50` images using `base64` encoding. --- -#### `showsample` parameter +#### `showfull` parameter ##### Type -The `showsample` parameter is a boolean. +The `showfull` parameter is a boolean. As usual, it expects some form of `True`, `False`, `0`, or `1`. The parameter is not case sensitive. -`showsample` defaults to `True` if not specified. +`showfull` defaults to `False` if not specified. ##### Description -The `showsample` parameter is very simple. +The `showfull` parameter is very simple. +This requests that the page load with high quality images instead of the default thumbnail quality image. The Gelbooru API provides multiple links for any given image, one of which is a link for the thumnbail. The Gelbooru site staff prefer that sites like mine link to the thumbnail image, of which this parameter does. The thumnbail image is of significantly lower quality, but it lowers loading time for both you, as well as reduce load on the Gelbooru CDN. Out of respect for them, we ask that this parameter be kept on, as to view the full high quality version of the image, you need but click on the image itself. ##### Example -* `/hidden?showsample=True` -shows all images in thumbnail quality - -* `/hidden?showsample=False` +* `/hidden?showfull=True` shows all images in high quality -* `hidden/showsample=0&base64=True` -shows all images in high quality using `base64` encoding +* `/hidden?showfull=False` +shows all images in thumbnail quality + +* `hidden/showfull=0&base64=True` +shows all images in thumnbnail quality using `base64` encoding ---