Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2a9e9ef

Browse files
committed
Add the version check logic
1 parent 3b6d413 commit 2a9e9ef

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

runnerplus.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
import subprocess
99
import ConfigParser
1010
import shutil
11+
import string
1112

1213
url = "http://www.runnerplus.com/"
13-
script_version = "0.02"
14+
script_version = 0.02
1415
sync_successful = False
1516
config_filename = join(os.path.expanduser("~"), ".runnerplusrc")
1617

@@ -75,7 +76,7 @@ def post_to_runnerplus(uid, fullpath, backupdir):
7576
data = f.read()
7677
f.close()
7778

78-
v = "Python uploader " + script_version + " (Linux)"
79+
v = "Python uploader " + str(script_version) + " (Linux)"
7980
post_data = urllib.urlencode({'uid' : uid, 'v' : v, 'data' : data })
8081
post_url = url + "profile/api_postdata.asp"
8182
if not testing:
@@ -94,11 +95,14 @@ def post_to_runnerplus(uid, fullpath, backupdir):
9495

9596
def version_check():
9697
print "checking for updates to script..."
97-
#sock = urllib.urlopen(url + "profile/api_version.asp")
98-
#htmlSource = sock.read()
99-
#sock.close()
100-
#print htmlSource
101-
return "0.01"
98+
sock = urllib.urlopen("http://www.kurup.org/software/runnerplus/version")
99+
htmlSource = sock.read()
100+
sock.close()
101+
try:
102+
version = string.atof(htmlSource)
103+
except:
104+
version = 0
105+
return version
102106

103107
def validate_user(email, password):
104108
if debug: print "validating user " + email + " ..."

0 commit comments

Comments
 (0)