-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppInfoOld.py
More file actions
226 lines (170 loc) · 5.82 KB
/
Copy pathAppInfoOld.py
File metadata and controls
226 lines (170 loc) · 5.82 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#!/usr/bin/python
# coding=utf-8
import sys
import zipfile
import shutil
import os
import os.path
import time
import datetime
import json
#include mainResource.py
# sys.path.append('./common')
o_path = os.getcwd() # 返回当前工作目录
# 当前工作目录 Common/PythonCreator/ProjectConfig/Script
sys.path.append('../../')
sys.path.append('./')
sys.path.append('../../')
sys.path.append('./')
from Config.Config import Config
from Common import Source
from Config.AdConfig import AdConfig
from Project.Resource import mainResource
from Common.File.JsonUtil import JsonUtil
from xml.dom.minidom import parse
class AppInfoOld():
rootJsonData: None
isHd:None
#构造函数
def __init__(self,isHd):
self.isHd = isHd
self.rootJsonData = self.loadJson(isHd)
def saveString2File(self, str, file):
f = open(file, 'wb') # 若是'wb'就表示写二进制文件
b = str.encode('utf-8', "ignore")
f.write(b)
f.close()
def GetJsonFile(self,isHd):
cur_path = mainResource.GetProjectConfigApp()+"/appinfo"
jsonfile = cur_path+'/appinfo.json'
if isHd:
jsonfile = cur_path+'/appinfo_hd.json'
return jsonfile
def loadJson(self,isHd):
jsonfile = self.GetJsonFile(isHd)
with open(jsonfile, 'rb') as json_file:
data = json.load(json_file)
return data
def IsOldVersion(self):
isOld = True
if ("appname" in self.rootJsonData) :
isOld = False
return isOld
def saveString2File(self,str, file):
mainResource.saveString2File(str, file)
def GetPackage(self,osSrc):
jsonData = self.rootJsonData
ret = ""
key = "PACKAGE_IOS"
if osSrc == Source.ANDROID:
key = "PACKAGE_ANDROID"
ret = jsonData[key]
return ret
def GetConfigDataAppId(self,os,chanel):
dirconfig = mainResource.GetConfigDataDir()
filepath = ""
appid = ""
if os==Source.ANDROID:
filepath = dirconfig+"/config/config_android.json"
if self.isHd:
filepath = dirconfig+"/config/config_android_hd.json"
if os==Source.IOS:
filepath = dirconfig+"/config/config_ios.json"
if self.isHd:
filepath = dirconfig+"/config/config_ios_hd.json"
with open(filepath) as json_file:
data = json.load(json_file)
appid = data["APPID"][chanel]
return appid
def APPSTORE_PROMOTION(self,lan):
data = self.rootJsonData["APPSTORE_PROMOTION"]
name = data[lan]
return name
def APPSTORE_VERSION_UPDATE(self,lan):
data = self.rootJsonData["APPSTORE_VERSION_UPDATE"]
name = data[lan]
return name
def APPSTORE_TITLE(self,lan):
data = self.rootJsonData["APPSTORE_TITLE"]
name = data[lan]
return name
def APPSTORE_SUBTITLE(self,lan):
data = self.rootJsonData["APPSTORE_SUBTITLE"]
name = data[lan]
return name
def APPSTORE_KEYWORD(self,lan):
data = self.rootJsonData["APPSTORE_KEYWORD"]
name = data[lan]
return name
def need_upload_screenshot(self):
return self.rootJsonData["need_upload_screenshot"]
def software_url(self):
return self.rootJsonData["software_url"]
def privacy_url(self):
return self.rootJsonData["privacy_url"]
def support_url(self):
return self.rootJsonData["support_url"]
def sku_app(self):
return self.rootJsonData["sku_app"]
def GetAppVersion(self,os):
# loadJson
data = self.rootJsonData
if os==Source.ANDROID:
name = data["APPVERSION_ANDROID"]
if os==Source.IOS:
name = data["APPVERSION_IOS"]
return name
def GetAppVersionCode(self,os):
# loadJson
data = self.rootJsonData
if os==Source.ANDROID:
name = data["APPVERSION_CODE_ANDROID"]
if os==Source.IOS:
name = data["APPVERSION_IOS"]
name = name.replace(".","")
return name
def GetAppName(self,os,lan):
# loadJson
data = self.rootJsonData
APP_NAME_CN_ANDROID = data["APP_NAME_CN_ANDROID"]
APP_NAME_EN_ANDROID = data["APP_NAME_EN_ANDROID"]
APP_NAME_CN_IOS = data["APP_NAME_CN_IOS"]
APP_NAME_EN_IOS = data["APP_NAME_EN_IOS"]
name = ""
if os==Source.ANDROID:
if lan==Source.LANGUAGE_CN:
name = APP_NAME_CN_ANDROID
if lan==Source.LANGUAGE_EN:
name = APP_NAME_EN_ANDROID
if os==Source.IOS:
if lan==Source.LANGUAGE_CN:
name = APP_NAME_CN_IOS
if lan==Source.LANGUAGE_EN:
name = APP_NAME_EN_IOS
return name
def GetAppId(self,channel):
# loadJson
data = self.rootJsonData
if channel==Source.APPSTORE:
appid = self.GetConfigDataAppId(Source.IOS,Source.APPSTORE)
else:
appid = self.GetConfigDataAppId(Source.ANDROID,channel)
return appid
# 主函数的实现
if __name__ == "__main__":
# 设置为utf8编码
# reload(sys)
# sys.setdefaultencoding("utf-8")
is_auto_plus_version = False
# 入口参数:http://blog.csdn.net/intel80586/article/details/8545572
cmdPath = mainResource.cur_file_dir()
count = len(sys.argv)
for i in range(1,count):
print("参数", i, sys.argv[i])
if i==1:
cmdPath = sys.argv[i]
if i==2:
if sys.argv[i]=="true":
is_auto_plus_version = True
mainResource.SetCmdPath(cmdPath)
print("AppInfoOld sucess")