File tree 1 file changed +25
-2
lines changed
1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
import subprocess as sub
3
3
import time
4
+ import requests
4
5
logo = '''
5
6
________ __ .__
6
7
\_____ \____________ ____ ____ _____/ |_ ____ ____ | |
11
12
'''
12
13
ip_pattern = r"(?:[0-9]{1,3}\.){3}[0-9]{1,3}"
13
14
api_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
+
15
38
16
39
def get_temp (Zone = 0 ,DEBUG = False ):
17
40
'''
@@ -101,7 +124,7 @@ def version():
101
124
:return: return orangetool-version number as string
102
125
'''
103
126
print (logo )
104
- return VERSION
127
+ return "orangetool-v" + VERSION
105
128
106
129
107
130
def wakeup (day = 0 ,hour = 0 ,minute = 0 ,DEBUG = False ):
You can’t perform that action at this time.
0 commit comments