forked from egirault/googleplay-api
-
Notifications
You must be signed in to change notification settings - Fork 2
/
helpers.py
37 lines (33 loc) · 1.1 KB
/
helpers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from config import SEPARATOR
def sizeof_fmt(num):
for x in ['bytes','KB','MB','GB','TB']:
if num < 1024.0:
return "%3.1f%s" % (num, x)
num /= 1024.0
def print_header_line():
l = [ "Title",
"Package name",
"Creator",
"Super Dev",
"Price",
"Offer Type",
"Version Code",
"Size",
"Rating",
"Num Downloads",
]
print SEPARATOR.join(l)
def print_result_line(c):
#c.offer[0].micros/1000000.0
#c.offer[0].currencyCode
l = [ c.title,
c.docid,
c.creator,
len(c.annotations.badgeForCreator), # Is Super Developer?
c.offer[0].formattedAmount,
c.offer[0].offerType,
c.details.appDetails.versionCode,
sizeof_fmt(c.details.appDetails.installationSize),
"%.2f" % c.aggregateRating.starRating,
c.details.appDetails.numDownloads]
print SEPARATOR.join(unicode(i).encode('utf8') for i in l)