-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove spam, and the sys.exit line. Seems I forgot to commit this ear…
…lier :-P
- Loading branch information
1 parent
be8fe33
commit b5604ef
Showing
2 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/python | ||
# | ||
# Copyright Hugh Perkins 2015 hughperkins at gmail | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public License, | ||
# v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
# obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
|
||
import sys,os,time, os.path | ||
import zipfile | ||
|
||
mydir = os.path.dirname(os.path.abspath(__file__)) | ||
print( mydir ) | ||
sys.path.append(mydir + '/gomill' ) | ||
import gomill | ||
import gomill.sgf | ||
#import gomill.handicap_layout | ||
|
||
import kgs_dataset_preprocessor | ||
|
||
def scanZip( zipfilepath ): | ||
thiszip = zipfile.ZipFile( zipfilepath ) | ||
for name in thiszip.namelist(): | ||
#print( name ) | ||
if name.endswith('.sgf'): | ||
sgfContents = thiszip.read( name ) | ||
#sgf = gomill.sgf.Sgf_game.from_string( sgfContents ) | ||
#print( sgfContents ) | ||
try: | ||
size = sgfContents.split("\nSZ[")[1].split("]")[0] | ||
if size != "19": | ||
print( size ) | ||
except: | ||
print( "[not known]" ) | ||
#sys.exit(-1) | ||
|
||
def go( sTargetDirectory ): | ||
for sZipfilename in os.listdir( sTargetDirectory ): | ||
if sZipfilename.endswith('.zip'): | ||
scanZip( sTargetDirectory + '/' + sZipfilename ) | ||
|
||
if __name__ == '__main__': | ||
sTargetDirectory = 'data' | ||
go( sTargetDirectory ) | ||
|