Create the preview directory if it doesn't already exist.
This commit is contained in:
parent
acb8a7a793
commit
0622410e4a
1 changed files with 9 additions and 0 deletions
|
@ -66,6 +66,7 @@ def scan_set_file(aircraft_dir, set_file):
|
||||||
if sim_node == None:
|
if sim_node == None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
root_node.write('/tmp/junk/' + base_id + '-props.xml')
|
||||||
variant = {}
|
variant = {}
|
||||||
variant['name'] = sim_node.getValue("description", None)
|
variant['name'] = sim_node.getValue("description", None)
|
||||||
variant['status'] = sim_node.getValue("status", None)
|
variant['status'] = sim_node.getValue("status", None)
|
||||||
|
@ -79,6 +80,7 @@ def scan_set_file(aircraft_dir, set_file):
|
||||||
|
|
||||||
# extract and record previews for each variant
|
# extract and record previews for each variant
|
||||||
if sim_node.hasChild('previews'):
|
if sim_node.hasChild('previews'):
|
||||||
|
print "has previews ..."
|
||||||
variant['previews'] = extract_previews(sim_node.getChild('previews'), aircraft_dir)
|
variant['previews'] = extract_previews(sim_node.getChild('previews'), aircraft_dir)
|
||||||
|
|
||||||
if sim_node.hasChild('rating'):
|
if sim_node.hasChild('rating'):
|
||||||
|
@ -128,6 +130,9 @@ def scan_aircraft_dir(aircraft_dir):
|
||||||
except:
|
except:
|
||||||
print "Skipping set file since couldn't be parsed:", os.path.join(aircraft_dir, file), sys.exc_info()[0]
|
print "Skipping set file since couldn't be parsed:", os.path.join(aircraft_dir, file), sys.exc_info()[0]
|
||||||
continue
|
continue
|
||||||
|
#except:
|
||||||
|
# print "Skipping set file since couldn't be parsed:", os.path.join(aircraft_dir, file)
|
||||||
|
# continue
|
||||||
|
|
||||||
setDicts.append(d)
|
setDicts.append(d)
|
||||||
if d['primary-set']:
|
if d['primary-set']:
|
||||||
|
@ -221,6 +226,10 @@ def copy_previews_for_variant(variant, package_name, package_dir, previews_dir):
|
||||||
for preview in variant['previews']:
|
for preview in variant['previews']:
|
||||||
preview_src = os.path.join(package_dir, preview['path'])
|
preview_src = os.path.join(package_dir, preview['path'])
|
||||||
preview_dst = os.path.join(previews_dir, package_name + '_' + preview['path'])
|
preview_dst = os.path.join(previews_dir, package_name + '_' + preview['path'])
|
||||||
|
#print preview_src, preview_dst, preview['path']
|
||||||
|
dir = os.path.dirname(preview_dst)
|
||||||
|
if not os.path.isdir(dir):
|
||||||
|
os.makedirs(dir)
|
||||||
if os.path.exists(preview_src):
|
if os.path.exists(preview_src):
|
||||||
shutil.copy2(preview_src, preview_dst)
|
shutil.copy2(preview_src, preview_dst)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue