mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 12:21:35 +00:00
further refine chromehistory output
This commit is contained in:
@@ -63,12 +63,12 @@ CHROME_VERSIONHISTORY_ORDERBY_CHOICE_MAP = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHROME_VERSIONHISTORY_TITLES = {
|
CHROME_VERSIONHISTORY_TITLES = {
|
||||||
'platforms': ['name', 'platformType'],
|
'platforms': ['platform'],
|
||||||
'channels': ['name', 'channelType', 'platformType'],
|
'channels': ['channel', 'platform'],
|
||||||
'versions': ['name', 'version', 'platformType', 'channelType',
|
'versions': ['version', 'platform', 'channel',
|
||||||
'major_version', 'minor_version', 'build', 'patch'],
|
'major_version', 'minor_version', 'build', 'patch'],
|
||||||
'releases': ['name', 'version', 'fraction', 'serving.startTime',
|
'releases': ['version', 'fraction', 'serving.startTime',
|
||||||
'serving.endTime', 'platformType', 'channelType',
|
'serving.endTime', 'platform', 'channel',
|
||||||
'major_version', 'minor_version', 'build', 'patch']
|
'major_version', 'minor_version', 'build', 'patch']
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,24 +185,34 @@ def printHistory():
|
|||||||
fields=f'nextPageToken,{entityType}',
|
fields=f'nextPageToken,{entityType}',
|
||||||
**kwargs)
|
**kwargs)
|
||||||
for citem in citems:
|
for citem in citems:
|
||||||
if 'channelType' not in citem:
|
for key in list(citem):
|
||||||
|
if key.endswith('Type'):
|
||||||
|
newkey = key[:-4]
|
||||||
|
citem[newkey] = citem.pop(key)
|
||||||
|
if 'channel' in citem:
|
||||||
|
citem['channel'] = citem['channel'].lower()
|
||||||
|
else:
|
||||||
channel_match = re.search(r"\/channels\/([^/]*)", citem['name'])
|
channel_match = re.search(r"\/channels\/([^/]*)", citem['name'])
|
||||||
if channel_match:
|
if channel_match:
|
||||||
try:
|
try:
|
||||||
citem['channelType'] = channel_match.group(1)
|
citem['channel'] = channel_match.group(1)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
if 'platformType' not in citem:
|
if 'platform' in citem:
|
||||||
|
citem['platform'] = citem['platform'].lower()
|
||||||
|
else:
|
||||||
platform_match = re.search(r"\/platforms\/([^/]*)", citem['name'])
|
platform_match = re.search(r"\/platforms\/([^/]*)", citem['name'])
|
||||||
if platform_match:
|
if platform_match:
|
||||||
try:
|
try:
|
||||||
citem['platformType'] = platform_match.group(1)
|
citem['platform'] = platform_match.group(1)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if citem.get('version', '').count('.') == 3:
|
if citem.get('version', '').count('.') == 3:
|
||||||
citem['major_version'], \
|
citem['major_version'], \
|
||||||
citem['minor_version'], \
|
citem['minor_version'], \
|
||||||
citem['build'], \
|
citem['build'], \
|
||||||
citem['patch'] = citem['version'].split('.')
|
citem['patch'] = citem['version'].split('.')
|
||||||
|
citem.pop('name')
|
||||||
csvRows.append(utils.flatten_json(citem))
|
csvRows.append(utils.flatten_json(citem))
|
||||||
display.write_csv_file(csvRows, CHROME_VERSIONHISTORY_TITLES[entityType], reportTitle, todrive)
|
display.write_csv_file(csvRows, CHROME_VERSIONHISTORY_TITLES[entityType], reportTitle, todrive)
|
||||||
|
|||||||
Reference in New Issue
Block a user