only resend info if it's been over a week

This commit is contained in:
Marcos Pinto 2007-08-07 10:45:02 +00:00
parent 666a043275
commit 9cb20a96ce
2 changed files with 18 additions and 3 deletions

View File

@ -4,8 +4,14 @@
import urllib
import platform
import gtk
import common
pygtk = '%i.%i.%i' %(gtk.pygtk_version[0],gtk.pygtk_version[1],gtk.pygtk_version[2])
urllib.urlopen("http://download.deluge-torrent.org/stats.php?processor=" + \
platform.machine() + "&python=" + platform.python_version() \
+ "&os=" + platform.system() + "&pygtk=" + pygtk)
f = open(common.CONFIG_DIR + '/infosent', 'w')
f.write("")
f.close

View File

@ -123,9 +123,18 @@ class DelugeGTK:
def send_info():
import sys
py_version = sys.version[:3]
#check if we already sent the info
file = common.INSTALL_PREFIX + '/lib/python' + py_version + '/site-packages/deluge/info.py'
os.spawnlp(os.P_NOWAIT, 'python', 'python', file, common.PROGRAM_VERSION)
#check if we've done this within the last week
import glob
import time
if os.path.exists(common.CONFIG_DIR + '/infosent'):
a=glob.glob(common.CONFIG_DIR + '/infosent')[0]
if time.time() - os.stat(a)[8] >= 604800:
file = common.INSTALL_PREFIX + '/lib/python' + py_version + '/site-packages/deluge/info.py'
os.spawnlp(os.P_NOWAIT, 'python', 'python', file, common.PROGRAM_VERSION)
else:
file = common.INSTALL_PREFIX + '/lib/python' + py_version + '/site-packages/deluge/info.py'
os.spawnlp(os.P_NOWAIT, 'python', 'python', file, common.PROGRAM_VERSION)
if self.config.get("new_releases"):
new_release_check()