def onDocumentOpened(self): file_size = get_file_size(self._active_doc.path) file_name = self._active_doc.name self.l.info('Opened "{}".'.format(file_name)) self.tempStatusMessage('Opened "{}" ({})'.format(file_name, format_file_size(file_size))) self.updateDirectoryActions() self.updateFileActions() self.updateEditActions() self.loadPage(0)
def saveCopy(self): file_name = self._active_doc.getSaveFilename() try: self._active_doc.saveDrawingPDF() file_size = get_file_size(self._active_doc.getSavePath()) self.l.info('Saved copy "{}" from "{}".'.format(file_name, self._active_doc.path)) self.tempStatusMessage('Saved copy as "{}" ({})'.format(file_name, format_file_size(file_size))) except RuntimeError as e: msg = str(e).capitalize() self.l.error(msg) show_error_dialog(self, msg) if self._active_dir is not None: self._active_dir.refresh()
def borgmatic(): if not utils.verify_auth_token(request.headers): return "Access denied, invalid auth token.", 403 # Backup encountered an error if isinstance(request.json, dict) and request.json.get("error", False): data = request.json backup_name = utils.get_filename_from_path(data.get('config_path')) data = { "backup_successful": False, "backup_name": backup_name, "message": data.get('message').replace("\n", "<br />\n"), "stderr": data.get('stderr').replace("\n", "<br />\n") } # Backup was successful else: data = request.json[0] backup_name = utils.get_filename_from_path( data.get('repository').get('location')) backup_duration = data.get('archive').get('duration') total_size = data.get('cache').get('stats').get('unique_csize') data = { "backup_successful": True, "backup_name": os.path.basename( os.path.normpath(data.get('repository').get('location'))), "backup_duration_formatted": time.strftime('%H:%M:%S', time.gmtime(backup_duration)), "formatted_size": utils.format_file_size(total_size) } # Build out the email and send it template = utils.load_email_template("BorgBackup.html") email_body = MIMEText(template.render(data=data), 'html') EmailSender().send_email(f"Backup complete: {backup_name}", email_body) return "Borgmatic backup email notification sent."
def __init__(self, gfile, column_index=0): ''' Initialize FileItem class. ''' TreeItem.__init__(self) self.gfile = gfile self.type = get_gfile_type(self.gfile) self.name = get_gfile_name(self.gfile) self.modification_time = get_gfile_modification_time(self.gfile) self.content_type = get_gfile_content_type(self.gfile) self.size = get_gfile_size(self.gfile) self.size_name = format_file_size(self.size) self.file_path = gfile.get_path() self.pixbuf = get_file_icon_pixbuf(self.file_path, ICON_SIZE) self.column_index = column_index self.name_width = get_name_width(self.column_index, self.name) self.modification_time_width = get_modification_time_width(self.modification_time) self.content_type_width = get_type_width(self.content_type) self.size_width = get_size_width(self.size_name)
def do_backup(): backup_report = run_borg_backup() backup_stats = get_backup_report() backup_successful = backup_report.get("backup_successful") backup_duration = format_seconds(backup_report.get("time_elapsed")) size_on_disk = format_file_size(backup_stats.get('deduplicated_size')) email_body = MIMEText(f""" <html> <body> <h1 style="color: {"#059669" if backup_successful else "#DC2626"}">{backup_name.title()} backup {"successful" if backup_successful else "failed"}</h1> { f'''<table style="display: inline-block; font-size: large;"> <tr> <td style="width: 145px;"> Duration: </td> <td> {backup_duration} </td> </tr> <tr> <td> Size on disk: </td> <td> {size_on_disk} </td> </tr> </table>''' if backup_successful else ""} </body> </html> """, 'html') EmailSender().send_email(f"{backup_name.title()} backup {'successful' if backup_successful else 'failed'}", email_body)
def get_basic_info(html_info): """ 获取游戏的基本信息 :param html_info: :return: dict """ result = {} html = html_info if html: soup = BeautifulSoup(html) name = soup.find("div", {"class": "det-name-int"}) detail = soup.find("div", {"class": "det-app-data-info"}) app_tags = soup.find(id="J_DetCate") icon_info = soup.find("div", {"class": "det-icon"}) screenshot_info = soup.findAll("div", {"class": "pic-img-box"}) developers_info = soup.findAll("div", {"class": "det-othinfo-data"}) # download_info = soup.find("a", {"class": "det-down-btn"}) params_size = soup.find("div", {"class": "det-size"}) # params_download_num = soup.find("div", {"class": "det-ins-num"}) version_info = soup.find("div", {"class": "det-othinfo-data"}) star = soup.find("div", {"class": "com-blue-star-num"}) display_name = "" introduction = "" screenshot_url = "" category = "" pname = "" download = "" install_num = "" language = "" size = "" version = "" version_code = "" star_num = "" icon_url = "" developers = "" # 获取显示名 if name: display_name = name.text if "v" in display_name: display_name = display_name.split("v")[0] # 获取简介 if detail: introduction = detail.text # 获取标签类型信息 if app_tags: category = app_tags.text # 获取icon if icon_info: icon_info = icon_info.find('img') icon_url = icon_info['src'] # 获取截图url if screenshot_info: for screen in screenshot_info: img = screen.find('img') src = img['data-src'] if src: screenshot_url += src + "\n" if developers_info: developers = developers_info[len(developers_info)-1].text #获取下载地址,版本,安装数和大小 if params_size: size = params_size.text if version_info: version = version_info.text.replace("V", "") if star: star_num = star.text #获取script游戏包名和下载地址 script_infos = soup.findAll('script') for script in script_infos: pkg_infos = script.text if "var appDetailData = {" in pkg_infos: # print pkg_infos search = re.search(r"{([\s\S]*)}", pkg_infos, re.M | re.I) # print search.group() if search: data = search.group() data = data.replace("orgame", '"orgame"', 1) data = data.replace("apkName", '"apkName"', 1) data = data.replace("apkCode", '"apkCode"', 1) data = data.replace("appId", '"appId"', 1) data = data.replace("appName", '"appName"', 1) data = data.replace("iconUrl", '"iconUrl"', 1) data = data.replace("appScore", '"appScore"', 1) data = data.replace("downTimes", '"downTimes"', 1) data = data.replace("downUrl", '"downUrl"', 1) data = data.replace("tipsUpDown", '"tipsUpDown"', 1) pkg = json.loads(data) download = pkg["downUrl"] pname = pkg["apkName"] install_num = pkg["downTimes"] version_code = pkg['apkCode'] result["display_name"] = display_name result["introduction"] = introduction result["screenshot_url"] = screenshot_url result["developers"] = developers result["category"] = category result["icon_url"] = icon_url result["version"] = version result["pkg_name"] = pname result["url1"] = download result["language"] = language result["version_code"] = version_code result["install_num"] = utils.format_install_num(install_num) result["size"] = utils.format_file_size(size) result["star_num"] = utils.format_star_num(star_num, 2) result["min_sdk_version"] = 0 return result
def get_basic_info(html_info): result = {} html = html_info pname = "" download = "" install_num = "" language = "" version = "" size = "" display_name = "" introduction = "" api_level = "" if html: soup = BeautifulSoup(html) # print soup short_desc = soup.find("meta", {"name": "description"}) #获取下载地址,版本,安装数和大小 download_info = soup.find("a", {"class": "s_btn s_btn4"}) details = soup.find("ul", {"class": "s_info"}) name = soup.find("h1", {"class": "ff f20 fb fl"}) introduction_info = soup.find("div", {"class": "o-content"}) screenshot_info = soup.find(id="lstImges") icon_star = soup.find("div", {"class": "s_intro_pic fl"}) screenshot_url = "" developers = "" category = "" icon_url = "" star_num = "" if download_info: download_info = download_info["href"] if download_info: download = "http://apk.91.com" + download_info if details: list_li = details.findAll("li") for i, li in enumerate(list_li): if i == 0: version = li.text.replace(u"版本:", "").replace(u"历史版本", "") if i == 1: install_num = li.text.replace(u"下载次数:", "") if i == 2: size = li.text.replace(u"文件大小:", "") if i == 3: api_level = li.text if i == 8: if li: developers = li.text.replace(u"开发商:", "") if i == 9: if li: tags = li.findAll("a") for tag in tags: category += tag.text + "\n" if icon_star: icon = icon_star.find('img') star = icon_star.find('a') if icon: icon_url = icon['src'] if star: star_num = star['class'] if introduction_info: introduction = introduction_info.text if name: display_name = name.text if screenshot_info: for img in screenshot_info.findAll('img'): src = img['src'] if src: screenshot_url += src + u"\n" result["pkg_name"] = pname result["version"] = version result["url1"] = download result["language"] = language result["display_name"] = display_name result["introduction"] = introduction result["screenshot_url"] = screenshot_url result["developers"] = developers result["category"] = category result["icon_url"] = icon_url result["version_code"] = "" result["install_num"] = utils.format_install_num(install_num) result["size"] = utils.format_file_size(size) result["star_num"] = utils.format_star_num(star_num, 2) result["min_sdk_version"] = utils.format_android_level(api_level) result["short_desc"] = short_desc.get("content") return result
def get_basic_info(html_info): result = {} html = html_info pname = "" download = "" language = "" version = "" size = "" display_name = "" developer = "" category = "" icon_url = "" star_num = "" screenshot_url = "" introduction = "" if html: soup = BeautifulSoup(html) #获取下载地址,版本,安装数和大小 app_info = soup.find("div", {"class": "app-info"}) download_info = soup.find("a", {"class": "download"}) details = soup.find("div", {"class": "details preventDefault"}) introductions = soup.find("p", {"class": "pslide"}) screenshot_info = soup.find(id="J_thumbnail_wrap") if download_info and "http://app.mi.com" not in download_info: download = "http://app.mi.com" + download_info['href'] if details: list_li = details.find("ul").findAll("li") for index, element in enumerate(list_li): if index == 1: size = element.text if index == 3: version = element.text if index == 7: pname = element.text if app_info: name = app_info.find("h3") icon = app_info.find("img") categorys = app_info.find("p", {"class": "special-font action"}) developers = app_info.findAll("p") star = app_info.find("div", attrs={"class": re.compile(r"star1-hover")}) if name: display_name = name.text if icon: icon_url = icon['src'] if categorys: category = categorys.text if "|" in category: category = category.split("|") category = category[0].replace(u"分类:", "") if developers: if len(developers) == 2: d = developers[0] developer = d.text if star: star_nums = star['class'] nums = star_nums.split('-', 2) if len(nums) == 3: star_num = nums[2] if screenshot_info: screenshot_info = screenshot_info.findAll('img') for img in screenshot_info: src = img['src'] if src: screenshot_url += src + "\n" if introductions: introductions = str(introductions).replace("<br />", "$##$") introductions = BeautifulSoup(introductions) introduction = introductions.text.replace("$##$", "\n") result["pkg_name"] = pname result["version"] = version result["url1"] = download result["language"] = language result["display_name"] = display_name result["introduction"] = introduction result["screenshot_url"] = screenshot_url result["developers"] = developer result["category"] = category result["icon_url"] = icon_url result["version_code"] = "" result["install_num"] = "" result["size"] = utils.format_file_size(size) result["star_num"] = utils.format_star_num(star_num) result["min_sdk_version"] = 0 result["short_desc"] = "" return result
def get_basic_info(html_info): result = {} html = html_info pname = "" download = "" install_num = "" language = "" version = "" size = "" display_name = "" category = "" icon_url = "" star_num = "" screenshot_url = "" api_level = "" if html: soup = BeautifulSoup(html) #获取下载地址,版本,安装数和大小 app_version = soup.find(id="appSoftName") details = soup.find("div", {"class": "code_box_border"}) introduction = soup.find(id="softIntroduce") screenshot_info = soup.find(id="screenImgUl") icon_star = soup.find("div", {"class": "detail_content"}) if app_version: version = app_version.text if "(" in version: display_name = version.split("(")[0] search = re.search(r"\(.*\)", version, re.M | re.I) version = search.group().replace("(", "").replace(")", "") if details: spans = details.findAll("span", {"class": "font14"}) for i, span in enumerate(spans): if i == 1: install_num = span.text if install_num: install_num = install_num.replace(u"热度", "") if i == 3: size = span.text if i == 4: category = span.text if i == 6: language = span.text # api_level = details.find("span", {"class": "font14 d_gj_line left"}) api_level = details.find("span", {"class": "font14 detailMiniSdk d_gj_line left"}) if api_level: api_level = api_level.text download_info = details.find("a", {"class": "link_btn"}) if download_info: download = download_info['href'] if "appdown" in download: pname_info = download.split("/") download = "http://apk.hiapk.com" + download if len(pname_info) > 2: pname = pname_info[2].split("?")[0] if icon_star: icon = icon_star.find("img") star = icon_star.find("div", attrs={"class": re.compile(r"star_bg star_m")}) if icon: icon_url = icon['src'] if star: if star: star_num = star['class'] if screenshot_info: screenshot_info = screenshot_info.findAll('img') for img in screenshot_info: src = img['src'] if src: screenshot_url += src + "\n" if introduction: # print introduction introduction = introduction.text result["pkg_name"] = pname result["version"] = version result["url1"] = download result["language"] = language result["display_name"] = display_name result["introduction"] = introduction result["screenshot_url"] = screenshot_url result["developers"] = "" result["category"] = category result["icon_url"] = icon_url result["version_code"] = "" result["install_num"] = utils.format_install_num(install_num) result["size"] = utils.format_file_size(size) result["star_num"] = utils.format_star_num(star_num, 0.2) result["min_sdk_version"] = utils.format_android_level(api_level) result["short_desc"] = "" return result
def get_basic_info(html_info): """ 获取游戏的基本信息 :param html_info: :return: dict """ result = {} html = html_info if html: soup = BeautifulSoup(html) display_name = soup.find(id="app-name") introduction = soup.find(id="html-brief") app_tags = soup.find("div", {"class": "app-tags"}) icon_url = soup.find("dt") short_desc = soup.find("dl", {"class": "clearfix"}) screenshot_url = "" developers = "" category = "" pname = "" download = "" install_num = "" language = "" version_name = "" version_code = 0 size = 0 star_num = 0 min_sdk_version = 0 # 获取显示名 if display_name: display_name = display_name.find("span").text # 如果获取不到介绍信息,尝试第二种方式 if not introduction: introduction = soup.find("div", {"class": "infors"}) # 获取简介,截图,开发商和类型 if introduction: # 获取截图url scroll = introduction.find(id="scrollbar") desc = introduction.find("div", {"class": "breif"}) if scroll: imgs = scroll["data-snaps"] for img in imgs.split(","): if img and "icon.png" not in img: screenshot_url += img + "\n" else: for img in introduction.findAll("img"): src = img['src'] if src and "icon.png" not in src: screenshot_url += src + "\n" if desc: desc_str = str(desc).replace("<br />", "$##$") desc_str = desc_str.replace("</td>", "$##$</td>") desc_str = BeautifulSoup(desc_str) introduction = desc_str.text.replace("$##$", "\n").replace(" ", " ") introduction = introduction.replace("versioncode", "\nversioncode") introduction = introduction.replace("updatetime", "\nupdatetime") else: introduction = str(introduction).replace("<br />", "$##$") introduction = introduction.replace("</td>", "$##$</td>") introduction = introduction.replace("</p>", "$##$</p>") introduction = BeautifulSoup(introduction) introduction = introduction.text.replace("$##$", "\n").replace(" ", " ") introduction = introduction.replace("versioncode", "\nversioncode") introduction = introduction.replace("updatetime", "\nupdatetime") #获取游戏包名和下载地址 script_infos = soup.findAll('script') for script in script_infos: pkg_infos = script.text if "var detail = (function () {" in pkg_infos: search = re.search(r"return {([\s\S]*)};", pkg_infos, re.M | re.I) # print search if search: data = search.group().replace("return", "").replace(";", "").replace("'", "\"") pkg = json.loads(data) pname = pkg['pname'] download = pkg['downloadUrl'] version_code = pkg['vcode'] #获取语言,版本,安装数和大小 pf = soup.find("div", {"class": "pf"}) basic_info = soup.find("div", {"class": "base-info"}) if pf: pf_s3 = pf.findAll("span", {"class": "s-3"}) # 下载量 star = pf.find("span", {"class": "s-1 js-votepanel"}) # 评分 if len(pf_s3) == 2: install_num = pf_s3[0].text size = pf_s3[1].text install_num = install_num.replace(u"下载:", "").replace(u"次", "") if star: star_num = star.text if basic_info: infos = basic_info.findAll("td") for info in infos: text = info.text # print text if u"作者:" in text: developers = text.replace(u"作者:", "") if u"语言" in text: language = text.replace(u"语言:", "") if u"版本" in text: search = text.split("versioncode") if len(search) > 0: version_name = search[0].replace(u"版本:", "") if u"系统:" in text: min_sdk_version = utils.format_android_level(text) # 获取标签类型信息 if app_tags: tags = app_tags.findAll("a") for tag in tags: if "360" in tag.text: continue category += tag.text + "\n" if icon_url: icon_url = icon_url.find("img") icon_url = icon_url["src"] # 获取简短描述 if short_desc: short_desc = short_desc.find("p") if short_desc: short_desc = short_desc.text short_desc = short_desc.replace(u"【小编点评】", "") result["display_name"] = display_name result["introduction"] = introduction result["screenshot_url"] = screenshot_url result["developers"] = developers result["category"] = category result["icon_url"] = icon_url result["pkg_name"] = pname result["version"] = version_name result["url1"] = download result["language"] = language result["version_code"] = version_code result["install_num"] = utils.format_install_num(install_num) result["size"] = utils.format_file_size(size) result["star_num"] = utils.format_star_num(star_num) result["min_sdk_version"] = min_sdk_version result["short_desc"] = short_desc or "" return result
def get_basic_info(html_info): """ 获取游戏的基本信息 :param html_info: :return: dict """ result = {} html = html_info if html: soup = BeautifulSoup(html) display_name = soup.find(id="app-name") introduction = soup.find(id="html-brief") app_tags = soup.find("div", {"class": "app-tags"}) icon_url = soup.find("dt") short_desc = soup.find("dl", {"class": "clearfix"}) screenshot_url = "" developers = "" category = "" pname = "" download = "" install_num = "" language = "" version_name = "" version_code = 0 size = 0 star_num = 0 min_sdk_version = 0 # 获取显示名 if display_name: display_name = display_name.find("span").text # 如果获取不到介绍信息,尝试第二种方式 if not introduction: introduction = soup.find("div", {"class": "infors"}) # 获取简介,截图,开发商和类型 if introduction: # 获取截图url scroll = introduction.find(id="scrollbar") desc = introduction.find("div", {"class": "breif"}) if scroll: imgs = scroll["data-snaps"] for img in imgs.split(","): if img and "icon.png" not in img: screenshot_url += img + "\n" else: for img in introduction.findAll("img"): src = img['src'] if src and "icon.png" not in src: screenshot_url += src + "\n" if desc: desc_str = str(desc).replace("<br />", "$##$") desc_str = desc_str.replace("</td>", "$##$</td>") desc_str = BeautifulSoup(desc_str) introduction = desc_str.text.replace("$##$", "\n").replace( " ", " ") introduction = introduction.replace("versioncode", "\nversioncode") introduction = introduction.replace("updatetime", "\nupdatetime") else: introduction = str(introduction).replace("<br />", "$##$") introduction = introduction.replace("</td>", "$##$</td>") introduction = introduction.replace("</p>", "$##$</p>") introduction = BeautifulSoup(introduction) introduction = introduction.text.replace("$##$", "\n").replace( " ", " ") introduction = introduction.replace("versioncode", "\nversioncode") introduction = introduction.replace("updatetime", "\nupdatetime") #获取游戏包名和下载地址 script_infos = soup.findAll('script') for script in script_infos: pkg_infos = script.text if "var detail = (function () {" in pkg_infos: search = re.search(r"return {([\s\S]*)};", pkg_infos, re.M | re.I) # print search if search: data = search.group().replace("return", "").replace( ";", "").replace("'", "\"") pkg = json.loads(data) pname = pkg['pname'] download = pkg['downloadUrl'] version_code = pkg['vcode'] #获取语言,版本,安装数和大小 pf = soup.find("div", {"class": "pf"}) basic_info = soup.find("div", {"class": "base-info"}) if pf: pf_s3 = pf.findAll("span", {"class": "s-3"}) # 下载量 star = pf.find("span", {"class": "s-1 js-votepanel"}) # 评分 if len(pf_s3) == 2: install_num = pf_s3[0].text size = pf_s3[1].text install_num = install_num.replace(u"下载:", "").replace(u"次", "") if star: star_num = star.text if basic_info: infos = basic_info.findAll("td") for info in infos: text = info.text # print text if u"作者:" in text: developers = text.replace(u"作者:", "") if u"语言" in text: language = text.replace(u"语言:", "") if u"版本" in text: search = text.split("versioncode") if len(search) > 0: version_name = search[0].replace(u"版本:", "") if u"系统:" in text: min_sdk_version = utils.format_android_level(text) # 获取标签类型信息 if app_tags: tags = app_tags.findAll("a") for tag in tags: if "360" in tag.text: continue category += tag.text + "\n" if icon_url: icon_url = icon_url.find("img") icon_url = icon_url["src"] # 获取简短描述 if short_desc: short_desc = short_desc.find("p") if short_desc: short_desc = short_desc.text short_desc = short_desc.replace(u"【小编点评】", "") result["display_name"] = display_name result["introduction"] = introduction result["screenshot_url"] = screenshot_url result["developers"] = developers result["category"] = category result["icon_url"] = icon_url result["pkg_name"] = pname result["version"] = version_name result["url1"] = download result["language"] = language result["version_code"] = version_code result["install_num"] = utils.format_install_num(install_num) result["size"] = utils.format_file_size(size) result["star_num"] = utils.format_star_num(star_num) result["min_sdk_version"] = min_sdk_version result["short_desc"] = short_desc or "" return result
def get_basic_info(html_info): """ 获取游戏的基本信息 :param html_info: :return: dict """ result = {} html = html_info if html: soup = BeautifulSoup(html) name = soup.find("div", {"class": "det-name-int"}) detail = soup.find("div", {"class": "det-app-data-info"}) app_tags = soup.find(id="J_DetCate") icon_info = soup.find("div", {"class": "det-icon"}) screenshot_info = soup.findAll("div", {"class": "pic-img-box"}) developers_info = soup.findAll("div", {"class": "det-othinfo-data"}) # download_info = soup.find("a", {"class": "det-down-btn"}) params_size = soup.find("div", {"class": "det-size"}) # params_download_num = soup.find("div", {"class": "det-ins-num"}) version_info = soup.find("div", {"class": "det-othinfo-data"}) star = soup.find("div", {"class": "com-blue-star-num"}) display_name = "" introduction = "" screenshot_url = "" category = "" pname = "" download = "" install_num = "" language = "" size = "" version = "" version_code = "" star_num = "" icon_url = "" developers = "" # 获取显示名 if name: display_name = name.text if "v" in display_name: display_name = display_name.split("v")[0] # 获取简介 if detail: introduction = detail.text # 获取标签类型信息 if app_tags: category = app_tags.text # 获取icon if icon_info: icon_info = icon_info.find('img') icon_url = icon_info['src'] # 获取截图url if screenshot_info: for screen in screenshot_info: img = screen.find('img') src = img['data-src'] if src: screenshot_url += src + "\n" if developers_info: developers = developers_info[len(developers_info) - 1].text #获取下载地址,版本,安装数和大小 if params_size: size = params_size.text if version_info: version = version_info.text.replace("V", "") if star: star_num = star.text #获取script游戏包名和下载地址 script_infos = soup.findAll('script') for script in script_infos: pkg_infos = script.text if "var appDetailData = {" in pkg_infos: # print pkg_infos search = re.search(r"{([\s\S]*)}", pkg_infos, re.M | re.I) # print search.group() if search: data = search.group() data = data.replace("orgame", '"orgame"', 1) data = data.replace("apkName", '"apkName"', 1) data = data.replace("apkCode", '"apkCode"', 1) data = data.replace("appId", '"appId"', 1) data = data.replace("appName", '"appName"', 1) data = data.replace("iconUrl", '"iconUrl"', 1) data = data.replace("appScore", '"appScore"', 1) data = data.replace("downTimes", '"downTimes"', 1) data = data.replace("downUrl", '"downUrl"', 1) data = data.replace("tipsUpDown", '"tipsUpDown"', 1) pkg = json.loads(data) download = pkg["downUrl"] pname = pkg["apkName"] install_num = pkg["downTimes"] version_code = pkg['apkCode'] result["display_name"] = display_name result["introduction"] = introduction result["screenshot_url"] = screenshot_url result["developers"] = developers result["category"] = category result["icon_url"] = icon_url result["version"] = version result["pkg_name"] = pname result["url1"] = download result["language"] = language result["version_code"] = version_code result["install_num"] = utils.format_install_num(install_num) result["size"] = utils.format_file_size(size) result["star_num"] = utils.format_star_num(star_num, 2) result["min_sdk_version"] = 0 return result
def get_formatted_size(self): return utils.format_file_size(self.size)