File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 11import os
22import subprocess as sub
33import time
4+ import requests
45logo = '''
56________ __ .__
67\_____ \____________ ____ ____ _____/ |_ ____ ____ | |
1112'''
1213ip_pattern = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}"
1314api_1 = "http://ipinfo.io/ip"
14- VERSION = "orangetool-v0.22"
15+ VERSION = "0.22"
16+ UPDATE_URL = "http://www.orangetool.ir/version"
17+ def check_update (DEBUG = False ):
18+ '''
19+ This function check orangetool site for newversion
20+ :param DEBUG: Flag for using Debug mode
21+ :type DEBUG:bool
22+ :return: True if new version is available
23+ '''
24+ try :
25+ new_version = requests .get (UPDATE_URL ).text
26+ if float (new_version )> VERSION :
27+ print ("New Version (" + new_version + ") Of Orangetool Is Available" )
28+ return True
29+ else :
30+ print ("Update!" )
31+ return False
32+ except Exception as e :
33+ if DEBUG == True :
34+ print (str (e ))
35+ return "Error"
36+
37+
1538
1639def get_temp (Zone = 0 ,DEBUG = False ):
1740 '''
@@ -101,7 +124,7 @@ def version():
101124 :return: return orangetool-version number as string
102125 '''
103126 print (logo )
104- return VERSION
127+ return "orangetool-v" + VERSION
105128
106129
107130def wakeup (day = 0 ,hour = 0 ,minute = 0 ,DEBUG = False ):
You can’t perform that action at this time.
0 commit comments