Merge branch 'master' of github.com:RfidResearchGroup/proxmark3
[RRG-proxmark3.git] / client / emojis_scrap_github.py
blob1d808e13aeb58d4af3f24444f62e8ca4766f7ffa
1 #!/usr/bin/env python3
3 # Mostly derived from https://github.com/mrowa44/emojify Copyright (c) 2015 Justyna Rachowicz
5 from urllib.request import urlopen
6 import json
9 EMOJI_JSON_URL = 'https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json'
11 def print_emoji(emoji_json):
12 for alias in emoji_json['aliases']:
13 print(' {{":{0}:", "{1}"}}, // {2}'.format(alias,
15 ''.join('\\x{:02x}'.format(b) for b in emoji_json['emoji'].encode('utf8')),
17 emoji_json['emoji']))
19 print(
20 """#ifndef EMOJIS_H__
21 #define EMOJIS_H__
23 typedef struct emoji_s {
24 const char *alias;
25 const char *emoji;
26 } emoji_t;
27 // emoji_t array are expected to be NULL terminated
29 static emoji_t EmojiTable[] = {""")
31 with urlopen(EMOJI_JSON_URL) as conn:
32 emojis_json = json.loads(conn.read().decode('utf-8'))
33 for emoji_json in emojis_json:
34 print_emoji(emoji_json)
36 print(""" {NULL, NULL}
38 #endif""")