|
|
|
@ -6,10 +6,6 @@ All sub-directories of bundles directory will be scanned for activity
|
|
|
|
|
bundles i.e. .xo files.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
""" FIXME: paths hard coded unix style & most likely will not work on winodws.
|
|
|
|
|
Use code written for IMM to handle it.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import glob
|
|
|
|
|
import json
|
|
|
|
|
import os
|
|
|
|
@ -19,8 +15,6 @@ from urllib.parse import quote as strToHtmlFmt
|
|
|
|
|
import zipfile
|
|
|
|
|
|
|
|
|
|
from GeneralFunctions.DataStructureManupulations import (
|
|
|
|
|
GetTextAfter,
|
|
|
|
|
UnquoteString,
|
|
|
|
|
StrListToDictionary
|
|
|
|
|
)
|
|
|
|
|
from GeneralFunctions.InputOutput import (
|
|
|
|
@ -32,6 +26,12 @@ from GeneralFunctions.OS import (
|
|
|
|
|
CreateDir
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""" FIXME: paths hard coded unix style & most likely will not work on winodws.
|
|
|
|
|
Use code written for IMM to handle it.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class extractData:
|
|
|
|
|
|
|
|
|
|
def findInfoFiles(self, bundle):
|
|
|
|
@ -56,7 +56,7 @@ class extractData:
|
|
|
|
|
assert(CreateDir("js"))
|
|
|
|
|
|
|
|
|
|
def extractActivityInfo(self, infoFilePath, zipFile):
|
|
|
|
|
infoList, infoDict = [], {}
|
|
|
|
|
infoList = []
|
|
|
|
|
infoList = zipFile.read(
|
|
|
|
|
infoFilePath).decode("utf-8").split('\n')
|
|
|
|
|
return StrListToDictionary(infoList)
|
|
|
|
@ -116,8 +116,8 @@ class extractData:
|
|
|
|
|
'</title>\n<meta charset="utf-8"/>\n<link rel="stylesheet" '
|
|
|
|
|
'type="text/css" href="../css/main.css"/>\n</head>\n<body>\n'
|
|
|
|
|
'</body>\n<h1>' + appInfo["name"] + '</h1>\n<p><img src="' +
|
|
|
|
|
str(iconsDir+pathName+'.svg')+'"></img></p>\n<div id=summary>'
|
|
|
|
|
'<h2>Summary</h2>\n<p>'+appInfo["summary"]+
|
|
|
|
|
str(iconsDir + pathName + '.svg') + '"></img></p>\n'
|
|
|
|
|
'<div id=summary><h2>Summary</h2>\n<p>' + appInfo["summary"] +
|
|
|
|
|
'</p>\n</div>\n<div id=description><h2>Description</h2>\n<p>' +
|
|
|
|
|
appInfo["description"] + '</p>\n</div>\n<div id=tags><h2>Tags'
|
|
|
|
|
'</h2>\n<ul>\n'
|
|
|
|
@ -125,7 +125,8 @@ class extractData:
|
|
|
|
|
for tag in appInfo["tags"]:
|
|
|
|
|
html += '<li>' + tag + '</li>\n'
|
|
|
|
|
html += (
|
|
|
|
|
'</ul>\n</div>\n<a href="'+str(bundlesDir+pathName+'.xo')+
|
|
|
|
|
'</ul>\n</div>\n<a href="' +
|
|
|
|
|
str(bundlesDir + pathName + '.xo') +
|
|
|
|
|
'"><h2>Download<h2></a>\n</body>\n</html>'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
@ -136,7 +137,8 @@ class extractData:
|
|
|
|
|
be created for it.
|
|
|
|
|
appends keys rather than replacing where mutiple map to same
|
|
|
|
|
"""
|
|
|
|
|
def generateIndex(self,
|
|
|
|
|
def generateIndex(
|
|
|
|
|
self,
|
|
|
|
|
infoToIndexMap={
|
|
|
|
|
"name": ("name", str),
|
|
|
|
|
"summary": ("summary", str),
|
|
|
|
@ -145,7 +147,8 @@ class extractData:
|
|
|
|
|
"tags": ("tags", list),
|
|
|
|
|
"categories": ("tags", list),
|
|
|
|
|
"category": ("tags", list)
|
|
|
|
|
}):
|
|
|
|
|
}
|
|
|
|
|
):
|
|
|
|
|
unexpectedInputError = (
|
|
|
|
|
"main.py generateIndex() : expect only str, list or tuple as "
|
|
|
|
|
"kwargs -> value[1] but found "
|
|
|
|
@ -197,7 +200,11 @@ class extractData:
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
self.indexDictList.append(indexDict)
|
|
|
|
|
self.indexJs = "search.assignIndex("+json.dumps(self.indexDictList, indent=4)+")"
|
|
|
|
|
self.indexJs = (
|
|
|
|
|
"search.assignIndex(" +
|
|
|
|
|
json.dumps(self.indexDictList, indent=4) +
|
|
|
|
|
")"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def generateInfoJson(self):
|
|
|
|
|
self.infoJson = json.dumps(self.bundlesInfoList, indent=4)
|
|
|
|
@ -265,6 +272,7 @@ class extractData:
|
|
|
|
|
WriteTextFiles("erroredBundles.txt", self.erroredBundles)
|
|
|
|
|
WriteTextFiles("iconErroredBundles.txt", self.iconErroredBundles)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def processArguments():
|
|
|
|
|
variables = {}
|
|
|
|
|
if len(sys.argv) == 3:
|
|
|
|
@ -282,9 +290,11 @@ def processArguments():
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
return variables
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
variables = processArguments()
|
|
|
|
|
extractData(variables["bundlesDir"], variables["websiteDir"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main();
|
|
|
|
|
main()
|
|
|
|
|