change format of downloadable dict info. Late checkin: Android code's

been counting on this for several days.
This commit is contained in:
Eric House 2014-06-03 07:43:47 -07:00
parent a6205f3dca
commit d55dd7e206

View file

@ -223,18 +223,29 @@ def getApp( params, name ):
logging.debug( 'missing param' ) logging.debug( 'missing param' )
return result return result
# create obj containing array of objects each with 'lang' and 'xwds',
# the latter an array of objects giving info about a dict.
def listDicts(): def listDicts():
result = {} ldict = {}
root = k_filebase + "and_wordlists/" root = k_filebase + "and_wordlists/"
dictSums = getDictSums() dictSums = getDictSums()
for path in glob.iglob( root + "*/*.xwd" ): for path in glob.iglob( root + "*/*.xwd" ):
path = path.replace( root, '' ) path = path.replace( root, '' )
lang, xwd = path.split( '/' ) lang, xwd = path.split( '/' )
if not lang in result: result[lang] = [] if not lang in ldict: ldict[lang] = []
result[lang].append({ 'md5sums' : md5Checksums( dictSums, path ), ldict[lang].append({ 'md5sums' : md5Checksums( dictSums, path ),
'xwd' : xwd, 'xwd' : xwd,
}) })
return result
# now format as we want 'em
langs = []
for lang, entry in ldict.iteritems():
obj = { 'lang' : lang,
'dicts' : entry,
}
langs.append( obj )
return { 'langs' : langs }
def getDicts( params ): def getDicts( params ):
result = [] result = []