Skip to content

Commit

Permalink
support base 16 version code format
Browse files Browse the repository at this point in the history
  • Loading branch information
matlink committed Mar 2, 2018
1 parent b798016 commit 0d4f84f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gplaycli/gplaycli.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def analyse_local_apks(self, list_of_apks, download_folder):
apk = APK(filepath)
packagename = apk.package
package_bunch.append(packagename)
version_codes.append(int(apk.version_code))
version_codes.append(util.vcode(apk.version_code))

# BulkDetails requires only one HTTP request
# Get APK info from store
Expand All @@ -500,7 +500,7 @@ def analyse_local_apks(self, list_of_apks, download_folder):
package_bunch,
list_of_apks,
version_codes):
store_version_code = int(detail['versionCode'])
store_version_code = detail['versionCode']

# Compare
if apk_version_code < store_version_code:
Expand Down
10 changes: 10 additions & 0 deletions gplaycli/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@ def list_folder_apks(folder):
"""
list_of_apks = [filename for filename in os.listdir(folder) if filename.endswith(".apk")]
return list_of_apks

def vcode(string_vcode):
"""
return integer of version
base can be 10 or 16
"""
base = 10
if string_vcode.startswith('0x'):
base = 16
return int(string_vcode, base)

0 comments on commit 0d4f84f

Please sign in to comment.