-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuntitled.py
More file actions
56 lines (45 loc) · 1.3 KB
/
untitled.py
File metadata and controls
56 lines (45 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2017-05-11 17:30:00
# @Author : 袁平华 (yuanpinghua@yeah.net)
# @Link : yuanph.org
# @Version : 1.0
"""[summary]
[description]
"""
import os
import json
import smtplib
def findAssetsCar(baseroot):
for root,dirs,files in os.walk(baseroot):
for file in files:
if os.path.splitext(file)[1] =='.car':
print( os.path.join(root,file))
return os.path.join(root,file)
return None
def assetProperty(carpath):
jsonpath = os.path.join(os.getcwd(),'car.json')
xrun_cmd = "xcrun --sdk iphoneos assetutil --info %s > %s "%(carpath,jsonpath)
os.system(xrun_cmd)
parseJson(jsonpath)
def parseJson(jsonpath):
with open(jsonpath,'r')as file:
data = json.load(file)
# print(data)
result =[]
for dic in data:
if 'DisplayGamut' in dic:
if dic['DisplayGamut'] =='P3':
item ={"Name":dic['Name'],'DisplayGamut':dic['DisplayGamut'],'Encoding':dic['Encoding']}
result.append(item)
if len(result):
print("count: %s"%(len(result)))
print(result)
jsonobj= json.dumps(result)
with open(jsonpath,'w') as file:
file.write(jsonobj)
def function():
pass
if __name__ == '__main__':
carpath = findAssetsCar(u'/Users/yuanpinghua/Desktop/2017-05-20-04-37/archive/Mask.xcarchive')
assetProperty(carpath)