mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
change format of downloadable dict info. Late checkin: Android code's
been counting on this for several days.
This commit is contained in:
parent
a6205f3dca
commit
d55dd7e206
1 changed files with 15 additions and 4 deletions
|
@ -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 = []
|
||||||
|
|
Loading…
Add table
Reference in a new issue