- ]
-
- def _calculateDuration(self, durationString):
- if (durationString.find("minutes") > -1):
- duration = time.strptime(durationString, "%M minutes %S seconds")
- else:
- duration = time.strptime(durationString, "%S seconds")
- return duration.tm_min * 60 + duration.tm_sec
-
- def _fixJsonSyntax(self, json):
-
- json = re.sub(r",\s*}", "}", json, flags=re.DOTALL)
- json = re.sub(r",\s*]", "]", json, flags=re.DOTALL)
- json = json.replace('file: "', '"file": "')
- json = json.replace('title: "', '"title": "')
- json = json.replace('label: "', '"label": "')
- json = json.replace('image: "', '"image": "')
- json = json.replace('sources: [', '"sources": [')
- return json