def addNewHookClassnames(): app_details = apkDetailsFetcher() app_version = app_details['version'] print "Latest Youtube version", app_version if isAlreadySupported(app_version): print "Version already supported!" return direct_url = app_details['direct_url'] class_name_pair = extractor(direct_url) main_class_name = class_name_pair[0] sub_class_name = class_name_pair[1] json_data = json.loads(getJsonString()) json_data['Youtube'][app_version] = dict() json_data['Youtube'][app_version][main_class_name] = sub_class_name with open(getHookFilePath(), 'w') as f: json.dump(json_data, f, sort_keys=True, indent=4, separators=(',', ':')) print 'Updated HookClassnames.json for version : ', app_version f.close() createGitPullRequest(app_version)
def addNewHookClassnames(create_pr): app_details = apkDetailsFetcher() app_version = app_details['version'] print('Latest Youtube version', app_version) if isAlreadySupported(app_version): print('Version already supported!') return direct_url = app_details['direct_url'] class_name = extractor(direct_url) json_data = json.loads(getJsonString()) json_data['Youtube'][app_version] = class_name with open(getHookFilePath(), 'w') as f: json.dump(json_data, f, sort_keys=True, indent=4, separators=(',', ':')) print('Updated HookClassnames.json for version : ', app_version) f.close() if create_pr: print('Creating Pull Request') createGitPullRequest(app_version) else: print('Not creating Pull Request')