Permalink
Browse files

Rename merged update script and remove Alfred-specific one

1 parent 705aa4b commit 7d4f09d722daa5dee45eff7a0c663ad62620da6d @valrus valrus committed Mar 13, 2017
Showing with 0 additions and 52 deletions.
  1. +0 โˆ’52 scripts/update-alfred.py
  2. 0 scripts/{update-km.py โ†’ update-output.py}
View
@@ -1,52 +0,0 @@
-from __future__ import unicode_literals
-
-import binascii
-import json
-import os
-import plistlib
-import sys
-import unicodedata
-import zipfile
-
-
-def make_random_uid():
- return binascii.b2a_hex(os.urandom(15))
-
-
-def titlecase_phrase(phrase):
- return ' '.join([word.title() for word in phrase])
-
-
-def make_emoji_name(emoji, shortcut):
- try:
- return titlecase_phrase(unicodedata.name(emoji).split())
- except (ValueError, TypeError):
- return titlecase_phrase(shortcut.strip(':').split('_'))
-
-
-def main():
- scripts_directory = os.path.dirname(os.path.realpath(__file__))
- emoji_substitutions_file = os.path.join(scripts_directory,
- '../emoji substitutions.plist')
- emoji_substitutions = plistlib.readPlist(emoji_substitutions_file)
- outfile = '../Emoji.alfredsnippets'
- with zipfile.ZipFile(outfile, 'w') as snippets:
- for item in emoji_substitutions:
- phrase, shortcut = item['phrase'], item['shortcut']
- uid = make_random_uid()
- name = make_emoji_name(phrase, shortcut)
- snippets.writestr(
- '{} [{}].json'.format(name, uid),
- json.dumps({
- "alfredsnippet" : {
- "snippet" : phrase,
- "uid" : uid,
- "name" : name,
- "keyword" : shortcut
- }
- })
- )
-
-
-if __name__ == "__main__":
- sys.exit(main())
File renamed without changes.

0 comments on commit 7d4f09d

Please sign in to comment.