From 93b0670f86222d3b9f53d6dff41e1ab755e62b12 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sun, 22 Nov 2020 23:33:44 +0200 Subject: [PATCH] [scripts/copy-crosscode-emoji-url] add an option for specifying the default image size for the pasted emotes --- scripts/copy-crosscode-emoji-url | 15 +++++++++++---- scripts/query-bookmarks | 4 +--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/copy-crosscode-emoji-url b/scripts/copy-crosscode-emoji-url index 21e772c..9ae73a1 100755 --- a/scripts/copy-crosscode-emoji-url +++ b/scripts/copy-crosscode-emoji-url @@ -6,9 +6,7 @@ from configparser import ConfigParser import requests import json -sys.path.insert( - 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") -) +sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils # noqa: E402 @@ -65,7 +63,16 @@ chosen_index = common_script_utils.run_chooser( emote_downloader_and_iterator(), prompt="emote", async_read=True ) chosen_emote = data["list"][chosen_index] -common_script_utils.set_clipboard(chosen_emote["url"]) + +emote_url = chosen_emote["url"] +default_emote_image_size = config.getint( + "default", "default_emote_image_size", fallback=None +) +if default_emote_image_size is not None: + emote_url += "?size={}".format(default_emote_image_size) + +common_script_utils.set_clipboard(emote_url) + common_script_utils.send_notification( os.path.basename(__file__), "copied URL of {} to clipboard!".format(chosen_emote["ref"]), diff --git a/scripts/query-bookmarks b/scripts/query-bookmarks index 7dc63cb..1014eac 100755 --- a/scripts/query-bookmarks +++ b/scripts/query-bookmarks @@ -16,9 +16,7 @@ import shutil import sqlite3 import collections -sys.path.insert( - 1, os.path.join(os.path.dirname(os.path.dirname(__file__)), "script-resources") -) +sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "script-resources")) import common_script_utils # noqa: E402