mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
add option to list a single language code's wordlists
This commit is contained in:
parent
31f3e71704
commit
51e6892c32
1 changed files with 9 additions and 2 deletions
|
@ -284,7 +284,7 @@ def getStats( path ):
|
|||
|
||||
# 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( lc = None ):
|
||||
global s_shelf
|
||||
langsVers = 2
|
||||
# langsVers = random.random() # change this to force recalc of shelf langs data
|
||||
|
@ -317,6 +317,11 @@ def listDicts():
|
|||
|
||||
result = { 'langs' : s_shelf[k_LANGS] }
|
||||
closeShelf();
|
||||
|
||||
print "looking for", lc
|
||||
if lc:
|
||||
result['langs'] = [elem for elem in result['langs'] if elem['lc'] == lc]
|
||||
|
||||
return result
|
||||
|
||||
def getDicts( params ):
|
||||
|
@ -455,7 +460,9 @@ def main():
|
|||
if arg == '--clear-shelf':
|
||||
clearShelf()
|
||||
elif arg == '--list-dicts':
|
||||
dictsJson = listDicts()
|
||||
if 2 < len(sys.argv): lc = sys.argv[2]
|
||||
else: lc = None
|
||||
dictsJson = listDicts( lc )
|
||||
print json.dumps( dictsJson )
|
||||
elif arg == '--get-sums':
|
||||
dictSums = getDictSums()
|
||||
|
|
Loading…
Add table
Reference in a new issue