Merge pull request #209 from libanp/develop

Fix version checks
This commit is contained in:
angelblue05 2019-02-04 02:01:22 -06:00 committed by Claus Vium
parent 2e2ca1c7aa
commit 93dd35b64d
2 changed files with 15 additions and 35 deletions

View file

@ -10,6 +10,7 @@ import re
import unicodedata import unicodedata
import urllib import urllib
from uuid import uuid4 from uuid import uuid4
from distutils.version import LooseVersion
import xbmc import xbmc
import xbmcaddon import xbmcaddon
@ -95,24 +96,13 @@ def compare_version(a, b):
1 a is larger 1 a is larger
0 equal 0 equal
''' '''
a = a.split('.') a = LooseVersion(a)
b = b.split('.') b = LooseVersion(b)
for i in range(0, max(len(a), len(b)), 1): if a < b:
try:
aVal = a[i]
except IndexError:
aVal = 0
try:
bVal = b[i]
except IndexError:
bVal = 0
if aVal < bVal:
return -1 return -1
if aVal > bVal: if a > b:
return 1 return 1
return 0 return 0

View file

@ -8,6 +8,7 @@ import hashlib
import socket import socket
import time import time
from datetime import datetime from datetime import datetime
from distutils.version import LooseVersion
from credentials import Credentials from credentials import Credentials
from http import HTTP from http import HTTP
@ -394,24 +395,13 @@ class ConnectionManager(object):
1 a is larger 1 a is larger
0 equal 0 equal
''' '''
a = a.split('.') a = LooseVersion(a)
b = b.split('.') b = LooseVersion(b)
for i in range(0, max(len(a), len(b)), 1): if a < b:
try:
aVal = a[i]
except IndexError:
aVal = 0
try:
bVal = b[i]
except IndexError:
bVal = 0
if aVal < bVal:
return -1 return -1
if aVal > bVal: if a > b:
return 1 return 1
return 0 return 0