Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"UI Remover: Chat window" -> "TCC chat link" #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 75 additions & 57 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,57 +1,75 @@
import urllib.request
import os
import json
from html.parser import HTMLParser

class MLStripper(HTMLParser):
def __init__(self):
super().__init__()
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)

def strip_tags(html):
s = MLStripper()
s.feed(html)
return s.get_data()

# Download all module.json files from the list
lines = open('modulelist.txt').readlines()
result = []
names = set()
for url in lines:
try:
myreq = urllib.request.urlopen(url)
mydata = myreq.read()

module = json.loads(mydata.decode('utf-8'))
if 'name' not in module:
print('No name specified:', url)
elif module['name'].lower() in names:
print('Duplicate module name:', url)
else:
names.add(module['name'].lower())
result.append(module)
except:
print(url)

# Sort by name
def guiname(x):
if 'options' in x:
if 'guiName' in x['options']:
return strip_tags(x['options']['guiName'])
if 'niceName' in x['options']:
return strip_tags(x['options']['niceName'])
return x['name']

result = sorted(result, key = lambda x: guiname(x).lower())

with open('modulelist.json', 'w') as fh:
json.dump(result, fh)

print(len(result), 'mods listed!')
print(sum(1 for x in result if 'category' not in x or x['category'] != 'client'), 'network mods listed!')
print(sum(1 for x in result if 'category' in x and x['category'] == 'client'), 'client mods listed!')
import urllib.request
import os
import json
from html.parser import HTMLParser

class MLStripper(HTMLParser):
def __init__(self):
super().__init__()
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)

def strip_tags(html):
s = MLStripper()
s.feed(html)
return s.get_data()

# Download all module.json files from the list
lines = open('modulelist.txt').readlines()
result = []
names = set()
for url in lines:
try:
myreq = urllib.request.urlopen(url)
mydata = myreq.read()

module = json.loads(mydata.decode('utf-8'))
if 'name' not in module:
print('No name specified:', url)
else:
if module['name'].lower() in names:
print('WARNING: Duplicate module name:', url)

names.add(module['name'].lower())

# Upgrade legacy fields
if 'options' in module:
if 'niceName' in module['options']:
module['options']['cliName'] = module['options']['niceName']
del module['options']['niceName']

if 'category' in module:
if 'keywords' not in module:
module['keywords'] = [module['category']]
else:
module['keywords'].append(module['category'])
del module['category']
else:
if 'keywords' not in module:
module['keywords'] = ['network']

result.append(module)
except:
print(url)

# Sort by name
def guiname(x):
if 'options' in x:
if 'guiName' in x['options']:
return strip_tags(x['options']['guiName'])
if 'cliName' in x['options']:
return strip_tags(x['options']['cliName'])
return x['name']

result = sorted(result, key = lambda x: guiname(x).lower())

with open('modulelist.json', 'w') as fh:
json.dump(result, fh)

print(len(result), 'mods listed!')
print(sum(1 for x in result if 'network' in x['keywords']), 'network mods listed!')
print(sum(1 for x in result if 'client' in x['keywords']), 'client mods listed!')
2 changes: 1 addition & 1 deletion modulelist.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions modulelist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ https://raw.githubusercontent.com/Owyn/rk9guide/master/module.json
https://raw.githubusercontent.com/Owyn/show_hp_etchings/master/module.json
https://raw.githubusercontent.com/Owyn/talents_info/master/module.json
https://raw.githubusercontent.com/soler91/unicast-free/master/module.json
https://raw.githubusercontent.com/SaltyMonkey/no-more-wasted-bubbles/master/module.json
https://raw.githubusercontent.com/DeathDefying/crafting-calculator/master/module.json
https://raw.githubusercontent.com/DeathDefying/bathysmal-guide/master/module.json
https://raw.githubusercontent.com/DeathDefying/sc-guide/master/module.json
https://raw.githubusercontent.com/DeathDefying/UI-Remover/master/remove_BossWindow/module.json
https://raw.githubusercontent.com/DeathDefying/UI-Remover/master/remove_BuffsWindow/module.json
https://raw.githubusercontent.com/DeathDefying/UI-Remover/master/remove_CharacterWindow/module.json
https://raw.githubusercontent.com/DeathDefying/UI-Remover/master/remove_ChatWindow/module.json
https://raw.githubusercontent.com/DeathDefying/UI-Remover/master/remove_FlightGauge/module.json
https://raw.githubusercontent.com/DeathDefying/UI-Remover/master/remove_LfgWindow/module.json
https://raw.githubusercontent.com/DeathDefying/UI-Remover/master/remove_PartyWindow/module.json
Expand Down Expand Up @@ -188,5 +188,6 @@ https://raw.githubusercontent.com/Foglio1024/tera-modern-ui/master/Modern_WareHo

https://raw.githubusercontent.com/Foglio1024/toolbox-client-mods/master/GageBar_TopScreen/module.json
https://raw.githubusercontent.com/Foglio1024/toolbox-client-mods/master/thinkblob/module.json

https://raw.githubusercontent.com/Foglio1024/tcc-chat-link/master/module.json
https://raw.githubusercontent.com/Foglio1024/tcc-toolbox-release/master/module.json
https://raw.githubusercontent.com/Foglio1024/tcc-chat-link/master/module.json