mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-01 19:57:11 +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',
|
# create obj containing array of objects each with 'lang' and 'xwds',
|
||||||
# the latter an array of objects giving info about a dict.
|
# the latter an array of objects giving info about a dict.
|
||||||
def listDicts():
|
def listDicts( lc = None ):
|
||||||
global s_shelf
|
global s_shelf
|
||||||
langsVers = 2
|
langsVers = 2
|
||||||
# langsVers = random.random() # change this to force recalc of shelf langs data
|
# langsVers = random.random() # change this to force recalc of shelf langs data
|
||||||
|
@ -317,6 +317,11 @@ def listDicts():
|
||||||
|
|
||||||
result = { 'langs' : s_shelf[k_LANGS] }
|
result = { 'langs' : s_shelf[k_LANGS] }
|
||||||
closeShelf();
|
closeShelf();
|
||||||
|
|
||||||
|
print "looking for", lc
|
||||||
|
if lc:
|
||||||
|
result['langs'] = [elem for elem in result['langs'] if elem['lc'] == lc]
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def getDicts( params ):
|
def getDicts( params ):
|
||||||
|
@ -455,7 +460,9 @@ def main():
|
||||||
if arg == '--clear-shelf':
|
if arg == '--clear-shelf':
|
||||||
clearShelf()
|
clearShelf()
|
||||||
elif arg == '--list-dicts':
|
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 )
|
print json.dumps( dictsJson )
|
||||||
elif arg == '--get-sums':
|
elif arg == '--get-sums':
|
||||||
dictSums = getDictSums()
|
dictSums = getDictSums()
|
||||||
|
|
Loading…
Add table
Reference in a new issue