mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
parent
2e2ca1c7aa
commit
93dd35b64d
2 changed files with 15 additions and 35 deletions
|
@ -10,6 +10,7 @@ import re
|
|||
import unicodedata
|
||||
import urllib
|
||||
from uuid import uuid4
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
import xbmc
|
||||
import xbmcaddon
|
||||
|
@ -95,25 +96,14 @@ def compare_version(a, b):
|
|||
1 a is larger
|
||||
0 equal
|
||||
'''
|
||||
a = a.split('.')
|
||||
b = b.split('.')
|
||||
a = LooseVersion(a)
|
||||
b = LooseVersion(b)
|
||||
|
||||
for i in range(0, max(len(a), len(b)), 1):
|
||||
try:
|
||||
aVal = a[i]
|
||||
except IndexError:
|
||||
aVal = 0
|
||||
if a < b:
|
||||
return -1
|
||||
|
||||
try:
|
||||
bVal = b[i]
|
||||
except IndexError:
|
||||
bVal = 0
|
||||
|
||||
if aVal < bVal:
|
||||
return -1
|
||||
|
||||
if aVal > bVal:
|
||||
return 1
|
||||
if a > b:
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import hashlib
|
|||
import socket
|
||||
import time
|
||||
from datetime import datetime
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
from credentials import Credentials
|
||||
from http import HTTP
|
||||
|
@ -394,25 +395,14 @@ class ConnectionManager(object):
|
|||
1 a is larger
|
||||
0 equal
|
||||
'''
|
||||
a = a.split('.')
|
||||
b = b.split('.')
|
||||
a = LooseVersion(a)
|
||||
b = LooseVersion(b)
|
||||
|
||||
for i in range(0, max(len(a), len(b)), 1):
|
||||
try:
|
||||
aVal = a[i]
|
||||
except IndexError:
|
||||
aVal = 0
|
||||
if a < b:
|
||||
return -1
|
||||
|
||||
try:
|
||||
bVal = b[i]
|
||||
except IndexError:
|
||||
bVal = 0
|
||||
|
||||
if aVal < bVal:
|
||||
return -1
|
||||
|
||||
if aVal > bVal:
|
||||
return 1
|
||||
if a > b:
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
|
Loading…
Reference in a new issue