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/chrome/build-manifest.py
2015-08-24 14:57:19 +01:00

41 lines
1,001 B
Python

import json
import os
current_dir = os.path.dirname(os.path.realpath(__file__)) + "/"
with open(current_dir + "../package.json") as json_file:
project_package = json.load(json_file)
with open(current_dir + "manifest.json") as json_file:
manifest = json.load(json_file)
switcher = {
'name': 'name',
'version': 'version',
'description': 'description',
}
for key, value in switcher.items():
manifest[value] = project_package[key]
with open(current_dir + "data/decoder.json") as json_file:
site_decoder = json.load(json_file)['sites']
content_scripts = []
for site in site_decoder:
site = list(site.items())[0]
temp = {}
temp['matches'] = ["*://" + site[0] + '/*']
temp['js'] = ['data/lib/jquery.js', 'data/image-decoder.js', 'data/injections/' + site[1]]
content_scripts.append(temp)
manifest['content_scripts'] = content_scripts
with open(current_dir + 'manifest.json', 'w') as file:
json.dump(manifest, file, indent=2, sort_keys=True)