1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
hipchat-emoticons-for-all/assets/build-assets.py

32 lines
757 B
Python
Raw Normal View History

import json
from glob import glob
ASSETS_URL="https://raw.githubusercontent.com/RealOrangeOne/hipchat-emoticons-for-all/master/assets/"
def get_icon_name(path):
return get_filename(path).replace('.png', '')
def get_filename(path):
return path.replace('assets/', '')
files = glob('assets/*.png')
images = []
for filename in files:
images.append({get_icon_name(filename): ASSETS_URL + get_filename(filename)})
image_decoder = {"images":images}
image_decoder_json = json.dumps(image_decoder, indent=2, sort_keys=True)
js_file = None
with open('src/injector.js', "r") as file:
js_file = file.read()
js_file = js_file.replace("%image_decoder%", image_decoder_json)
with open('build/injector.js', 'w') as file:
file.write(js_file)