-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Kodi version getting safer #12
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,20 +211,26 @@ def get_kodi_build(): | |
try: | ||
return xbmc.getInfoLabel("System.BuildVersion") | ||
except Exception: | ||
return | ||
return '' | ||
|
||
|
||
def get_kodi_version(): | ||
"""Return the version number of Kodi""" | ||
build = get_kodi_build() | ||
version = build.split(' ')[0] | ||
return version | ||
if build: | ||
version = build.split(' ')[0] | ||
return version | ||
else: | ||
return '0' | ||
|
||
|
||
def get_kodi_major_version(): | ||
"""Return the major version number of Kodi""" | ||
version = get_kodi_version().split('.')[0] | ||
return int(version) | ||
if version: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like version should never evaluate to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I worked from this function upwards, should have come back to look at it again! |
||
return int(version) | ||
else: | ||
return 0 | ||
|
||
|
||
def log_kodi_platform_version(): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning None is usually best if you're going to later test it with
if build:
for example. As you've done here, an empty string also evaluates to False. Does this necessarily need to be a string?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right - the changes in get_kodi_version make this redundant, I'll make it None.