mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 23:31:13 -05:00
SPM fix for negative/teamdamage
added localization as downloaded from the Master API interupted network communication no longer treated as unknown exception topstats prints the right message if no one qualifies angle adjustments move unflag to seperate command
This commit is contained in:
35
Master/master/resources/localization.py
Normal file
35
Master/master/resources/localization.py
Normal file
@ -0,0 +1,35 @@
|
||||
from flask_restful import Resource
|
||||
from flask import request, jsonify
|
||||
from flask_jwt_extended import create_access_token
|
||||
from master import app, ctx
|
||||
import datetime
|
||||
import urllib.request
|
||||
import csv
|
||||
from io import StringIO
|
||||
|
||||
class Localization(Resource):
|
||||
def get(self):
|
||||
response = urllib.request.urlopen('https://docs.google.com/spreadsheets/d/e/2PACX-1vRQjCqPvd0Xqcn86WqpFqp_lx4KKpel9O4OV13NycmV8rmqycorgJQm-8qXMfw37QJHun3pqVZFUKG-/pub?gid=0&single=true&output=csv')
|
||||
data = response.read().decode('utf-8')
|
||||
|
||||
localization = []
|
||||
csv_data = csv.DictReader(StringIO(data))
|
||||
|
||||
for language in csv_data.fieldnames[1:]:
|
||||
localization.append(
|
||||
{
|
||||
'LocalizationName' : language,
|
||||
'LocalizationIndex' : {
|
||||
'Set' : {}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
for row in csv_data:
|
||||
localization_string = row['STRING']
|
||||
count = 0
|
||||
for language in csv_data.fieldnames[1:]:
|
||||
localization[count]['LocalizationIndex']['Set'][localization_string] = row[language]
|
||||
count += 1
|
||||
|
||||
return localization, 200
|
Reference in New Issue
Block a user