Example #1
0
value = random.randint(300, 4550)
""" we get the value recorded in latest_file """
ldate, lvalue = stats.get_latest()
print 'date :   %s' % ldate
print 'value :  %s' % lvalue
""" we compare today's date and latest date """
today = strftime('%Y%m%d')
if today != ldate[:8]:
    print '\nLatest stat are not from today'
    response = stats.add_new_day(ldate, lvalue)
    if response == True:
        print 'Save successfull'
    else:
        print 'Problem while saving'
    print '\nWriting value to latest'
    response = stats.write_latest(value)
    if response:
        print 'Write latest succesful'
    else:
        print 'Problem while writing latest value'
else:
    print '\nLatest stats are from today'
    nvalue = int(lvalue) + value
    response = stats.write_latest(nvalue)
    if response:
        print 'New value added to lastest file\nNow latest value :     %s' % nvalue
    else:
        print 'Problem while adding new value to latest'
""" we build the stats that will be displayed """
stat_o = stats.get_overall()
print '\nDOWNLOAD STATS\n'
Example #2
0
#!/usr/bin/env python

#
# python ghellanzb statistics module
#

import ghellanzb_statistics as stats
from time import gmtime, strftime

print 'current directory is :   %s' % stats.home_dir
print 'latest file :            %s' % stats.latest_file
print '\n'

"""
print 'Write the latest value'
stats.write_latest(345)
print '\n'
"""

print 'Get the latest value'
date, value = stats.get_latest()
hour = date[-5:]
date = date[:9]
print 'date :   %s' % date
print 'hours :  %s' % hour
print 'value :  %s' % value

today = strftime('%Y%m%d')

if today != date :
    print '\nLatest stat are not from today'
Example #3
0
""" we get the value recorded in latest_file """
ldate, lvalue = stats.get_latest()
print 'date :   %s' % ldate
print 'value :  %s' % lvalue

""" we compare today's date and latest date """
today = strftime('%Y%m%d')
if today != ldate[:8] :
    print '\nLatest stat are not from today'
    response = stats.add_new_day(ldate, lvalue)
    if response == True:
        print 'Save successfull'
    else:
        print 'Problem while saving'
    print '\nWriting value to latest'
    response = stats.write_latest(value)
    if response:
        print 'Write latest succesful'
    else:
        print 'Problem while writing latest value'
else :
    print '\nLatest stats are from today'
    nvalue = int(lvalue) + value
    response = stats.write_latest(nvalue)
    if response :
        print 'New value added to lastest file\nNow latest value :     %s' % nvalue
    else :
        print 'Problem while adding new value to latest'

""" we build the stats that will be displayed """
stat_o = stats.get_overall()